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

Function exec_kernel

tinygrad/engine/realize.py:170–180  ·  view source on GitHub ↗
(ctx:ExecContext, call:UOp, ast:UOp)

Source from the content-addressed store, hash-verified

168 return None
169
170def exec_kernel(ctx:ExecContext, call:UOp, ast:UOp) -> float|None:
171 et = None
172 for bufs, device_vars in unwrap_multi(call, resolve_params(call, ctx.input_uops)):
173 var_vals = {**ctx.var_vals, **device_vars}
174 prg_bufs = [bufs[i].ensure_allocated() for i in ast.arg.globals]
175 rt = get_runtime(device:=bufs[0].device, ast, cache=ctx.cache)
176 global_size, local_size = ast.arg.launch_dims(var_vals)
177 with track_stats(ctx, call, device, prg_bufs, var_vals) as tm:
178 et = tm[0] = rt(*[b._buf for b in prg_bufs], global_size=global_size, local_size=local_size, vals=ast.arg.vals(var_vals),
179 wait=ctx.wait, timeout=ctx.timeout)
180 return et
181
182def exec_validate(ctx:ExecContext, call:UOp, ast:UOp) -> float|None:
183 import numpy as np

Callers

nothing calls this directly

Calls 8

unwrap_multiFunction · 0.85
resolve_paramsFunction · 0.85
get_runtimeFunction · 0.85
track_statsFunction · 0.85
rtFunction · 0.85
ensure_allocatedMethod · 0.80
launch_dimsMethod · 0.80
valsMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…