Skip to content

Fix lost interactions in the box scanner sweep - #2547

Closed
nikosavola wants to merge 3 commits into
KLayout:masterfrom
nikosavola:fork/boxscanner-pairs
Closed

nikosavola wants to merge 3 commits into
KLayout:masterfrom
nikosavola:fork/boxscanner-pairs

Conversation

@nikosavola

Copy link
Copy Markdown
Contributor

Fixes #2546. The box scanner sweep kept the pairs it had reported in a set keyed on the two object pointers. If the same object is inserted twice with different properties, as in the instance to shape interaction scan, the second pair was dropped. The brute force path below the scanner threshold reports both, so the result depended on how many shapes a cell has.

The sweep needed the set because it tests the same pair more than once. Two boxes meet again in every band they share, and in the two collection scanner also in every window they share.

Now a pair is reported only where it is first tested. In y that is the band where the later of the two enters, so its bottom is above the previous band edge. Both are still in the sweep there, because an element is only dropped when it can no longer overlap anything that enters later. Windows work the same way in x. The single scanner already paired the new elements of a window only with earlier ones, so it only needed the band check. In the two collection scanner the new elements of a window are the ones added after the partition, since the partition only reorders the older ones. So each overlapping pair is reported exactly once without the set.

The text pull had a leftover loop that inserted each text again for every subject it touches. Its filter skips texts it has already output, so the loop only cost time and is removed. Dropping the set also saves time and memory, since it held a node for every reported pair. On the vexriscv deep DRC run below both roughly halve.

vexriscv deep DRC, 1 thread master this PR
via1 in metal1 markers, clipped run 2169 4296
full run time 34.4 s 18.0 s
full run peak memory 682 MB 328 MB

In the clipped run, a build that always uses the brute force loop also gives 4296 markers. The full run doesn't hit the bug, and its output matches master. The new tests compare both scanners with brute force on many small random inputs, including repeated objects, empty boxes, touching edges and various enlargements and fill factors.

The tests compare both scanners with a brute force check on many small random inputs and a few picked ones, with the threshold set so that the sweep is always used.
A leftover loop inserted every text again for each subject it touches. The filter skips texts it has already output, so this only cost time.
The sweep remembered reported pairs in a set keyed on the object pointers only. When the same object was inserted twice with different properties, the second pair was dropped. This only happened above the scanner threshold. See KLayout#2546.

A pair is now reported in the band and window where it is first tested, so the set is not needed any more.
@nikosavola

Copy link
Copy Markdown
Contributor Author

With this branch, the check from the script in #2546 finds no missing marker edges in the deep run, against 3115 on current master.

@nikosavola nikosavola closed this Nov 12, 2026
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.

Deep DRC can miss violations when a cell has many shapes

1 participant