MCPcopy Index your code
hub / github.com/tinygrad/tinygrad / _run

Function _run

tinygrad/runtime/ops_webgpu.py:32–43  ·  view source on GitHub ↗
(async_fun, cb_info_type, cb_type, status_enum, res_idx:int|None, msg_idx:int|None, *params)

Source from the content-addressed store, hash-verified

30 webgpu.wgpuQueueWriteBuffer(webgpu.wgpuDeviceGetQueue(device), buf, offset, (ctypes.c_uint8 * len(src)).from_buffer(src), len(src))
31
32def _run(async_fun, cb_info_type, cb_type, status_enum, res_idx:int|None, msg_idx:int|None, *params):
33 result: List[Any] = []
34
35 def cb(*params):
36 result[:] = params
37 if msg_idx: result[msg_idx] = from_wgpu_str(result[msg_idx])
38
39 cb_info = cb_info_type(mode=webgpu.WGPUCallbackMode_WaitAnyOnly, callback=cb_type(cb))
40 _wait(async_fun(*params, cb_info))
41
42 if result[0] != 1: raise RuntimeError(f"[{status_enum.get(result[0]) if status_enum else 'ERROR'}]{result[msg_idx] if msg_idx else ''}")
43 return result[res_idx] if res_idx else None
44
45def copy_buffer_to_buffer(dev:WGPUDevPtr, src:WGPUBufPtr, src_offset:int, dst:WGPUBufPtr, dst_offset:int, size:int):
46 encoder = webgpu.wgpuDeviceCreateCommandEncoder(dev, webgpu.WGPUCommandEncoderDescriptor())

Callers 6

read_bufferFunction · 0.70
pop_errorFunction · 0.70
__call__Method · 0.70
__init__Method · 0.70
synchronizeMethod · 0.70
__call__Method · 0.50

Calls 2

_waitFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…