MCPcopy
hub / github.com/tinygrad/tinygrad / dcache_flush

Function dcache_flush

tinygrad/runtime/ops_qcom.py:20–29  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

18
19@functools.cache
20def dcache_flush():
21 from tinygrad.uop.ops import UOp, Ops, KernelInfo
22 from tinygrad.codegen import to_program
23 buf, n = UOp(Ops.PARAM, dtypes.uint8.ptr(), arg=0), UOp(Ops.PARAM, dtypes.uint8.ptr(), arg=1)
24 i = UOp.range(n.cast(dtypes.int), 0, dtype=dtypes.int)
25 flush = UOp(Ops.CUSTOM, dtypes.void, (buf.cast(dtypes.ulong) + i.cast(dtypes.ulong) * UOp.const(dtypes.ulong, 64),),
26 arg='__asm__ volatile("dc cvac, %0" :: "r"({0}) : "memory");')
27 sink = UOp.sink(flush.end(i), UOp(Ops.CUSTOM, dtypes.void, (), arg='__asm__ volatile("dsb sy" ::: "memory");'), arg=KernelInfo(name="dcache_flush"))
28 prg = to_program(UOp(Ops.PROGRAM, src=(sink, UOp(Ops.DEVICE, arg="CPU"), UOp(Ops.LINEAR, src=tuple(sink.toposort())))), Device["CPU"].renderer)
29 return Device["CPU"].runtime(prg.arg.function_name, prg.src[4].arg)
30
31#Parse C-style defines: <regname>_<field_x>__SHIFT and <regname>_<field_y>__MASK from the adreno module into the following format:
32# qreg.<regname>(<field_x>=..., <field_y>=..., ..., <field_n>=...)

Callers 1

_gpu_mapMethod · 0.85

Calls 10

endMethod · 0.95
UOpClass · 0.90
KernelInfoClass · 0.90
to_programFunction · 0.90
toposortMethod · 0.80
ptrMethod · 0.45
rangeMethod · 0.45
castMethod · 0.45
constMethod · 0.45
sinkMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…