MCPcopy
hub / github.com/tinygrad/tinygrad / custom_add_one_kernel

Function custom_add_one_kernel

test/backend/test_custom_kernel.py:17–21  ·  view source on GitHub ↗
(B:UOp, A:UOp)

Source from the content-addressed store, hash-verified

15 return C[i, j].store((i.eq(j)).cast(C.dtype.base)).end(i, j).sink(arg=KernelInfo(name=f"custom_eye_{C.numel()}"))
16
17def custom_add_one_kernel(B:UOp, A:UOp) -> UOp:
18 A,B = A.flatten(), B.flatten()
19 assert B.numel() == A.numel()
20 i = UOp.range(A.numel(), 0)
21 return B[i].store(A[i] + 1).end(i).sink(arg=KernelInfo(name=f"add_one_{A.numel()}"))
22
23def custom_elementwise_add_kernel(C:UOp, A:UOp, B:UOp) -> UOp:
24 C,A,B = C.flatten(), A.flatten(), B.flatten()

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…