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

Function fixup_code

examples/webgpu/stable_diffusion/compile.py:104–111  ·  view source on GitHub ↗
(code, key)

Source from the content-addressed store, hash-verified

102 prg = ""
103
104 def fixup_code(code, key):
105 code = code.replace(key, 'main')\
106 .replace("var<uniform> INFINITY : f32;\n", "fn inf(a: f32) -> f32 { return a/0.0; }\n")\
107 .replace("@group(0) @binding(0)", "")\
108 .replace("INFINITY", "inf(1.0)")
109
110 for i in range(1,9): code = code.replace(f"binding({i})", f"binding({i-1})")
111 return code
112
113 def compile_step(model, step: Step):
114 linear, output_bufs = jit_model(step, *step.input)

Callers 1

compile_stepFunction · 0.85

Calls 1

replaceMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…