Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commita26cdab9a3

README.md

compact

Turns a keep mask into the indices of the kept elements, and the map back from every element to the place it holds among them.

indices lists the elements whose mask word is not 0 (a float mask of 0.0 and 1.0 reads the same way), in run order; its live count is the number kept. inverse holds, for every element, its place among the kept ones, or -1 for an element that is not kept, so a column carried to the kept elements (a gather by indices) and a column of per-kept values carried back (a read through inverse) agree on which element is which. The nodes that keep a subset of elements run it: core.select, core.weld, core.edges, core.boundary, core.islands, curve.grow, geometry.extrude, geometry.ribbon, instances.to_points, sdf.mesh and sim.particles.

The dispatch size n is the number of elements. One workgroup of 256 works the whole run, a tile of 256 elements at a time; the other workgroups of a larger dispatch return.

Exact: the order is the run's own, so the same mask gives the same answer on every dispatch.

Over a live count (COUNT=device, see the abi README) n is the capacity and the first domain_count mask words are the elements: words past it are not read, a slot of inverse at or past it holds -1, and the slots of indices past the kept ones hold -1. indices has room for n and its counter is the live count the next kernel takes as its domain. It binds 5 storage buffers (4 in the plain variant).