mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-04-29 03:00:14 -04:00
view doesn't have buffer, fix the tests [pr] (#7841)
* view doesn't have buffer, fix the tests [pr] * need assigns
This commit is contained in:
2
test/external/fuzz_graph.py
vendored
2
test/external/fuzz_graph.py
vendored
@@ -29,7 +29,7 @@ def alloc_rawbuffer(device, fill=False):
|
||||
if fill:
|
||||
with Context(DEBUG=0):
|
||||
data = np.random.randint(-10000, 10000, size=rawbuf.size, dtype=_to_np_dtype(rawbuf.dtype))
|
||||
rawbuf.copyin(Tensor(data).realize().lazydata.realized.as_buffer())
|
||||
rawbuf.copyin(Tensor(data).realize().lazydata.base.realized.as_buffer())
|
||||
return rawbuf
|
||||
|
||||
def gen_kernel_ji(device, deps):
|
||||
|
||||
2
test/external/fuzz_linearizer.py
vendored
2
test/external/fuzz_linearizer.py
vendored
@@ -75,7 +75,7 @@ def get_fuzz_rawbufs(lin):
|
||||
data = np.random.uniform(-1, 1, size=rawbuf.size).astype(dtype=_to_np_dtype(rawbuf.dtype))
|
||||
else:
|
||||
data = np.random.uniform(-10, 10, size=rawbuf.size).astype(dtype=_to_np_dtype(rawbuf.dtype))
|
||||
rawbuf.copyin(Tensor(data, device=lin.opts.device).realize().lazydata.realized.as_buffer())
|
||||
rawbuf.copyin(Tensor(data, device=lin.opts.device).realize().lazydata.base.realized.as_buffer())
|
||||
return rawbufs
|
||||
|
||||
def get_fuzz_rawbuf_like(old_rawbuf, zero=False, copy=False, size=None, force_device=None):
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
# compare kernels created by HEAD against master
|
||||
import os, multiprocessing, logging, pickle, sqlite3, difflib, functools
|
||||
from typing import Callable, List, Tuple, Union, cast
|
||||
from typing import Callable, List, Set, Tuple, Union, cast
|
||||
from tinygrad.helpers import VERSION, Context, ContextVar, colored, db_connection, getenv, tqdm
|
||||
from tinygrad.engine.schedule import ScheduleContext, full_ast_rewrite
|
||||
from tinygrad.codegen.kernel import Kernel, Opt
|
||||
@@ -28,7 +28,8 @@ if REF == "master": SKIP_PROCESS_REPLAY = True
|
||||
|
||||
# *** recreators
|
||||
|
||||
def recreate_sched(ast:UOp) -> UOp: return full_ast_rewrite(ast, ScheduleContext())[0]
|
||||
def recreate_sched(ast:UOp, assigns:Set[UOp]) -> UOp:
|
||||
return full_ast_rewrite(ast, ScheduleContext(assigns=assigns))[0]
|
||||
def recreate_kernel(ast:UOp, opts:Renderer, applied_opts:List[Opt], name:str, _) -> str:
|
||||
k = Kernel(ast, opts=opts)
|
||||
for opt in applied_opts: k.apply_opt(opt)
|
||||
|
||||
@@ -36,7 +36,7 @@ def helper_alloc_rawbuffer(device, fill=False):
|
||||
if fill:
|
||||
with Context(DEBUG=0):
|
||||
data = np.random.randint(-10000, 10000, size=rawbuf.size, dtype=_to_np_dtype(rawbuf.dtype))
|
||||
rawbuf.copyin(Tensor(data).realize().lazydata.realized.as_buffer())
|
||||
rawbuf.copyin(Tensor(data).realize().lazydata.base.realized.as_buffer())
|
||||
return rawbuf
|
||||
|
||||
def helper_run_jit(jis, bufs, out_buffers):
|
||||
|
||||
Reference in New Issue
Block a user