MCPcopy
hub / github.com/tinygrad/tinygrad / compile_linear

Function compile_linear

tinygrad/engine/realize.py:246–250  ·  view source on GitHub ↗
(linear:UOp, beam:int|None=None, validate=False)

Source from the content-addressed store, hash-verified

244 pm_exec = pm_hcq_exec + pm_exec
245
246def compile_linear(linear:UOp, beam:int|None=None, validate=False) -> UOp:
247 if validate: linear = graph_rewrite(linear, pm_validate, name="validate", walk=True)
248 if (beam_val:=BEAM.value if beam is None else beam) >= 1: linear = graph_rewrite(linear, pm_beam, ctx=beam_val, walk=True)
249 linear = graph_rewrite(linear, pm_compile, name="precompile kernels", walk=True)
250 return graph_rewrite(linear, pm_optimize_local_size, name="optimize local size", walk=True)
251
252def run_linear(linear:UOp, var_vals:dict[str, int]|None=None, input_uops:tuple[UOp, ...]=(), update_stats=True, jit=False, wait=False):
253 if not jit: linear = compile_linear(linear, validate=VALIDATE_WITH_CPU)

Callers 15

jit_lowerFunction · 0.90
simple_matmul.pyFile · 0.90
compileMethod · 0.90
get_statsFunction · 0.90
check_scheduleFunction · 0.90
_get_flopsMethod · 0.90
test_tri_complexityMethod · 0.90
make_graphFunction · 0.90

Calls 1

graph_rewriteFunction · 0.90

Tested by 14

compileMethod · 0.72
get_statsFunction · 0.72
check_scheduleFunction · 0.72
_get_flopsMethod · 0.72
test_tri_complexityMethod · 0.72
make_graphFunction · 0.72
check_scheduleFunction · 0.72
cntMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…