BendtorchGpu.ts_lv: def of bendtorch-gpu@1.3.0.0 Import: import bendtorch-gpu@1.3.0.0/main.bend as BendtorchGpu Lines 1380-1385 of bendtorch-gpu@1.3.0.0/main.bend: https://jend.leeeet.dev/read.txt?path=bendtorch-gpu@1.3.0.0/main.bend&start_line=1380&end_line=1385 import Base # the passes tree_sum makes over m cells: the smallest l with 2^l >= m (f is fuel) def ts_lv(f: Nat, +m: U32, +p: U32) -> Nat: match f: case 0n: 0n # bend-lint: disable-next bend-lint-rules/performance/eager_branch -- a loop of at most 32 U32 steps on the host, once per bang launch not-expected-because: a launch costs about 1 ms, the whole walk well under a microsecond case 1n+q: Bool.pick(Nat, U32.is_lt(p, m), 1n+ts_lv(q, m, (p * 2 : U32)), 0n) Uses (5): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool.pick https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.is_lt https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.mul