Skip to content

Flying edges: _points takes its windows' count, so a new grid size compiles nothing new - #515

Merged
berkgeveci merged 2 commits into
Kitware:mainfrom
berkgeveci:fix/flying-edges-points-length
Dec 5, 2026
Merged

berkgeveci merged 2 commits into
Kitware:mainfrom
berkgeveci:fix/flying-edges-points-length

Conversation

@berkgeveci

Copy link
Copy Markdown
Collaborator

contour of a structured grid by flying edges compiled one of its kernels, _points, anew for every grid size. Inside its loop it compared q + 1 with windows.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 (in test_structured_contour.py) contours solids and sheets, and slices, on grids of three sizes. It checks that no kernel of _flying_edges gains a variant after the first size. Without the fix it fails with {'_points': (6, 9)}.

Results (CPU, M1 Max): test_structured_contour.py 27 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

…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 berkgeveci left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)}.
@berkgeveci
berkgeveci added this pull request to the merge queue Dec 5, 2026
Merged via the queue into Kitware:main with commit e58c766 Dec 5, 2026
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant