XOR Fails on 32-bit Win XP, works on 64-bit Win 7

edited October 2010 in General
I have klayout-0.20.2-win32-install.exe installed on both Win XP 32-bit and Win 7 64-bit.

I have a large, complete IC I decided to test the XOR function against (I removed one small piece of metal 1 from the design). On Win XP 32-bit, it fails part way through with an error window that reports:


The process runs using about ~400 MB of private memory. There is 2GB of memory in the machine, and monitoring the system with Process Explorer still shows > 1 GB of physical memory free when it fails.

The same thing run on Win 7 64-bit runs to completion with accurate results.

Running the 64-bit binary of KLayout on Win 64-bit also works to completion just fine.


  • edited November -1


    frankly, the XOR is coded in some straightforward but not quite efficient way. Basically, it collects all the shapes (in fact: their edges) from the layout and runs a scanline boolean over it. Even in medium-size cases this implies a considerable memory usage and a somewhat poor performance. I think that in your case KLayout simply hits the 2G process size limit which is natural for a 32bit process and then aborts.

    There are more elobarate algorithms available that reduce the memory consumption. So far, I did not have time yet to implement a more efficient scheme. As a workaround, the XOR function provides a tiling option which basically cuts the layout into tiles with the specified size and performs an XOR on a tile-by-tile basis. The results should be identical as well as the runtime. With the tiling approach however, the memory consumption is lower because a single tile will require less storage space. The choice of the tiling size is crucial: if it is too small, the overhead required for clipping, overlap region handling and shape selection will increase the run time. A rough recommendation for the tile size is 500 to 1000 micron for a typical CMOS technology.

    Best regards,


  • edited November -1
    Thanks for the further instruction. Indeed, the tiling works on Win32. However, I still have on interesting finding. My test case design is 3800 um x 3800 um. I've tried the tile size from 25 um (just for fun) up to 3000 um. In a small range between 800 to 1000 um, part way through an Error window is presented:

    Internal error:
    m_open.empty() was not true.

    Another aspect of making the tile size too small is that geometries are broken up over the tiles and the Count of XOR difference climbs.

    We're rather pleased with your implementation, even though you may not see it as very well coded yet.

  • edited November -1


    thank you for that feedback. It's very encouraging ... :-)

    Thanks for reporting the internal error. I think it's worth looking at. I'll try to figure out what caused that logic error.

    Best regards,


Sign In or Register to comment.