MCPcopy
hub / github.com/tinygrad/tinygrad / write_buffer

Function write_buffer

tinygrad/runtime/ops_webgpu.py:28–30  ·  view source on GitHub ↗
(device:WGPUDevPtr, buf:WGPUBufPtr, offset:int, src:memoryview|bytearray|bytes)

Source from the content-addressed store, hash-verified

26 assert webgpu.wgpuInstanceWaitAny(instance, 1, webgpu.WGPUFutureWaitInfo(future=future), 2**64-1) == webgpu.WGPUWaitStatus_Success, "Future failed"
27
28def write_buffer(device:WGPUDevPtr, buf:WGPUBufPtr, offset:int, src:memoryview|bytearray|bytes):
29 src = bytearray(src)
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] = []

Callers 2

create_uniformFunction · 0.85
_copyinMethod · 0.85

Calls 1

from_bufferMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…