mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-01-23 05:48:08 -05:00
fix options on old pyopencl
This commit is contained in:
@@ -3,7 +3,7 @@ import os, functools
|
||||
import numpy as np
|
||||
import pyopencl as cl # type: ignore
|
||||
from collections import defaultdict
|
||||
from typing import List, Tuple, Optional, Dict, Union, Set
|
||||
from typing import List, Tuple, Optional, Dict, Union, Set, Tuple
|
||||
from tinygrad.helpers import prod, ConvArgs
|
||||
from tinygrad.ops import DEBUG, UnaryOps, BinaryOps, ReduceOps, MovementOps, ProcessingOps
|
||||
from tinygrad.shapetracker import ShapeTracker, View, strides_for_shape
|
||||
@@ -44,10 +44,10 @@ class CL:
|
||||
@functools.lru_cache(maxsize=None)
|
||||
class CLProgram:
|
||||
kernel_cnt = 0
|
||||
def __init__(self, name:str, prg:str, options=tuple(), argdtypes=None):
|
||||
def __init__(self, name:str, prg:str, options:Tuple[str, ...]=tuple(), argdtypes=None):
|
||||
self.name, self.prg, self.options, self.argdtypes = f"{name}_{CLProgram.kernel_cnt}", prg.replace(f"{name}(", f"{name}_{CLProgram.kernel_cnt}("), options, argdtypes
|
||||
self.clprogram = cl.Program(CL().cl_ctx, self.prg)
|
||||
self.clprg = self.clprogram.build(options=self.options).__getattr__(self.name)
|
||||
self.clprg = self.clprogram.build(options=list(self.options)).__getattr__(self.name)
|
||||
if self.argdtypes is not None: self.clprg.set_scalar_arg_dtypes(self.argdtypes)
|
||||
CLProgram.kernel_cnt += 1
|
||||
def __call__(self, *args):
|
||||
|
||||
Reference in New Issue
Block a user