Repository navigation
Flying edges: _points takes its windows' count, so a new grid size compiles nothing new - #515
Conversation
…mpiles nothing new _points compared q + 1 with windows.shape[0] inside its loop, which bakes the length into the code: every grid of another size compiled it anew. The count is an argument now. A test contours solids and sheets and slices on three grid sizes and checks that no flying-edges kernel gains a variant after the first.
berkgeveci
left a comment
There was a problem hiding this comment.
I’d approve this change at 02253ad0. The scalar passed to _points matches the allocated window count for solids, sheets, and plane slices. On CPU, _points stayed at three compiled variants across all three grid sizes. The same regression test failed on the base commit as the count grew from six to nine.
The test compares only seen[1] and seen[2], so it could miss an extra compilation between the first and second sizes. All three snapshots already match on CPU. As a non-blocking follow-up, I’d assert seen[0] == seen[1] == seen[2] to cover both transitions. Test assertion
All 27 structured-contour tests passed on CPU with default and 64-bit IDs, and all 27 passed on Metal with default IDs. The new regression test also passed on CPU with debug bounds checks enabled.
…third
The test compared only the second and third grid sizes' compile counts, so
a kernel compiled once more at the second size alone would pass (the
review's point). It asserts the three are equal; against the old _points
it fails with {'_points': (3, 6, 9)}.
contourof a structured grid by flying edges compiled one of its kernels,_points, anew for every grid size. Inside its loop it comparedq + 1withwindows.shape[0], and a dimension read in a kernel's body is baked into the code (only the parallel loop's own bound is not). The count,nrows * nlevels, is now passed as a scalar.Test:
test_a_new_grid_size_compiles_nothing_new(intest_structured_contour.py) contours solids and sheets, and slices, on grids of three sizes. It checks that no kernel of_flying_edgesgains a variant after the first size. Without the fix it fails with{'_points': (6, 9)}.Results (CPU, M1 Max):
test_structured_contour.py27 passed; ruff and the changelog check are clean.This is a fix for 0.8. It was found while building the compile log for #325, which itself is 0.9.
🤖 Generated with Claude Code