Skip to content

hk.collective

Stability: experimental. These names may change in any release (stability).

hk.collective: combining a reduction across the warps of a workgroup.

Every reduction on a tile is per-warp. A workgroup that splits a row across W warps holds W partial answers, and nothing in the register file sees across a wave; these two route them through LDS with the barriers in the right place.

hk.collective.COMBINERS

('add', 'max', 'min', 'mul')

hk.collective.cross_warp

hk.collective.cross_warp(vec: Vec, op: str, warps: int, *, scratch: Optional[SharedVec] = None, name: str = 'xw') -> Vec

One register vector per warp combined, the answer in every warp.

hk.collective.fold_rows

hk.collective.fold_rows(vec: Vec, op: str, warps: int, *, scratch: Optional[SharedVec] = None, name: str = 'fold') -> Vec

Reduce a column vector's own entries, the answer in all of them -- for a row folded onto a tile's 16 rows. The result is uniform.