def cols

bend-parallel@0.1.0.0 · histogram.bend:268

import bend-parallel@0.1.0.0/histogram.bend as Histogram
import Base

268# Pass 2b's forks: d levels down to groups of 2^w columns under group index
269# j. ft and fc are two handles each to the table and the counts. Group j
270# reads only its columns of the table and writes only its counts (entries
271# j * 2^w to j * 2^w + 2^w - 1): no two lanes write one slot.
272def cols(+d: Nat, +j: U32, +w: Nat, +k: U32, +o: U32, +step: U32, +nb: Nat, ft: Array<U32> & Array<U32>, fc: Array<U32> & Array<U32>) -> Two:
273  match d:
274    case 0n:
275      (t, t2) = ft
276      (cs, cs2) = fc
277      two.rejoin(t2, cs2, cols.go(U32.to_nat((U32.shln(1, w) - 1 : U32)), U32.shln(j, w), k, o, step, nb, Two{t, cs}))
278    case 1n+p:
279      (t0, t1) = ft
280      (c0, c1) = fc
281      +i = (j * 2 : U32)
282      l r = cols(p, i, w, k, o, step, nb, Array.fork(U32, t0), Array.fork(U32, c0))
283        cols(p, (i + 1 : U32), w, k, o, step, nb, Array.fork(U32, t1), Array.fork(U32, c1))
284      two.join(l, r)

Uses (15)

Used by (1)