()
| 18 | |
| 19 | @functools.cache |
| 20 | def 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>=...) |
no test coverage detected
searching dependent graphs…