MCPcopy
hub / github.com/tinygrad/tinygrad / custom_add_with_tmp

Method custom_add_with_tmp

test/backend/test_custom_kernel.py:318–323  ·  view source on GitHub ↗
(o1:UOp, o2:UOp, A:UOp, B:UOp)

Source from the content-addressed store, hash-verified

316 Tensor.realize(a, b)
317
318 def custom_add_with_tmp(o1:UOp, o2:UOp, A:UOp, B:UOp) -> UOp:
319 o1,o2,A,B = o1.flatten(), o2.flatten(), A.flatten(), B.flatten()
320 i = UOp.range(o1.numel(), 0)
321 store_o1 = o1[i].store(A[i]+B[i])
322 store_o2 = o2[i].store(A[i]+B[i]+2)
323 return UOp.group(store_o1, store_o2).end(i).sink(arg=KernelInfo(name=f"add_with_tmp_{o1.numel()}")).simplify()
324
325 from tinygrad import function
326 @function(precompile=True)

Callers

nothing calls this directly

Calls 9

KernelInfoClass · 0.90
flattenMethod · 0.80
numelMethod · 0.80
rangeMethod · 0.45
storeMethod · 0.45
simplifyMethod · 0.45
sinkMethod · 0.45
endMethod · 0.45
groupMethod · 0.45

Tested by

no test coverage detected