liveBook · Manning

Histogram binning

As explained in GPU Programming with Triton

The assignment and counting of data values into discrete intervals called bins.

Histogram binning assigns input values to discrete intervals, or bins, and counts how many values fall into each bin. On a GPU, each program instance can read a tile of values and determine their bins. section 4.1.3

Bin destinations depend on the input values, so different program instances can update the same counter. A plain tl.store can overwrite another instance’s update and produce an incorrect count. Use tl.atomic_add to coordinate increments to shared bins; tl.store is suitable when each instance owns a unique output region. section 4.1.3

Two tiles, one bin

If values from two different tiles fall into the same bin, both instances must increment that bin’s counter. Atomic addition prevents one increment from silently overwriting the other. section 4.1.3

How GPU Programming with Triton covers it

How deep it goes
Explains shared-bin write conflicts and their remedy, without specifying a complete histogram kernel.
Examples
Illustrates values from different input tiles landing in the same bin.
What you can do after
Apply it via Triton’s tl.atomic_add to update counters shared by program instances.
How it connects
Connects histogram binning to atomic operations and data-dependent write destinations.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of GPU Programming with Triton. The section links point to the parts of the book it draws on.