project-rig / rig

A collection of tools for developing SpiNNaker applications.
GNU General Public License v2.0
4 stars 0 forks source link

Fix ordering of flood-fill regions #264

Closed mundya closed 7 years ago

mundya commented 7 years ago

This is a bug that only appears with flood fills of large machines, which is why it has only just shown up. The problem occurs because a RegionTree iterates over its subregions recursively, whereas the entire tree should be iterated over in increasing y before x.

For example, the selected regions:

.... .... .... ....
.... .... .... ....
.... .... .... ....
2... .... .... ....

.... .... .... ....
.... .... .... ....
.... .... .... ....
13.. .... .... ....

Should be produced in the order (1, 2, 3) but are actually produced in the order (1, 3, 2) causing SC&MP to ignore region transmitted after 2.

This commit fixes the problem by including an additional call to sorted in compress_flood_fill_regions. Ideally some better iteration over the tree could be implemented. This needs further thought so I suggest this fix for now.

Thanks to @lplana for bringing this bug to my attention.

neworderofjamie commented 7 years ago

Sorting the things which need to be sorted looks entirely sensible to me!