mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-02-16 01:26:29 -05:00
add NULL=1 backend
This commit is contained in:
17
tinygrad/runtime/ops_null.py
Normal file
17
tinygrad/runtime/ops_null.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from tinygrad.device import Compiled, Compiler, MallocAllocator, Renderer, Allocator
|
||||
|
||||
class NullRenderer(Renderer):
|
||||
def render(self, uops:list) -> str: return ""
|
||||
|
||||
class NullProgram:
|
||||
def __init__(self, name:str, lib:bytes): pass
|
||||
def __call__(self, *bufs, global_size:tuple[int,int,int]=(1,1,1), local_size:tuple[int,int,int]=(1,1,1), vals:tuple[int, ...]=(), wait=False):
|
||||
pass
|
||||
|
||||
class NullAllocator(Allocator):
|
||||
def _alloc(self, size, options): return "null"
|
||||
def _copyin(self, dest, src:memoryview): pass
|
||||
def _copyout(self, dest:memoryview, src): pass
|
||||
|
||||
class NullDevice(Compiled):
|
||||
def __init__(self, device:str): super().__init__(device, NullAllocator(), NullRenderer(), Compiler(), NullProgram)
|
||||
Reference in New Issue
Block a user