NVlabs / timeloop

Timeloop performs modeling, mapping and code-generation for tensor algebra workloads on various accelerator architectures.
https://timeloop.csail.mit.edu/
BSD 3-Clause "New" or "Revised" License
303 stars 99 forks source link

Fix Ruby incorrect utilized_spatial_elems_ #243

Closed tanner-andrulis closed 4 months ago

tanner-andrulis commented 4 months ago

The bug: Previously, imperfectly-factorized spatial loops would use residual values every time the ONE loop above was it.

for X in [0..3):
  for X in [0..3):
    spatial-for X in [0..3, 1): // <-- Triggered three times instead of 1

This was a significant bug because mappings missed significant numbers of computes (up to 80% error).

Fixed with some new logic. Tested with deep loop nests of many imperfectly-factorized loops. Still 0-0.2% error in total #computes... likely due to rounding errors somewhere.