How does klayout choose region before boolean operation?

I am study the boolean operation and it seems like just process "mp_delegate" region and "other" region. Does klayout just traverse all regions of two layers and do boolean operation for each region? How does klayout choose the region to process? Thank you for your help.


  • Sorry, but I don't understand this question.

    Are you familiar with the delegate design pattern?


  • Sorry, my statement is not clear enough.

    I mean when klayout do boolean operation to 2 layers, how does klayout choose region to do boolean operation?

    Because a layer contains millions of polygons, it should have a method to choose region ( which may contains many polygons ) and then process ploygons of the regions.

    However, I can not find any function about this.

    Thank you for your help.


  • Sorry, I don't get it. What is the "region" you're referring to? And I suppose you're trying to solve a specific problem. So maybe it helps if you explain what you're trying to do.


  • Sorry, actually the "region" I mean is "dbRegion". The class index is:

    I did same test on Calibre and Klayout. Calibre cost about 100 seconds but Klayout cost about 10 hours when process Boolean Operation.

    Because Calibre is much faster than Klayout when processing Boolean Operation, I want to figure out how Klayout process Boolean Operation and try some optimization.

    I want to know is Klayout just do Boolean Operation to all ploygons of the same layer ? I guess Klayout maybe divide regions to avoid processing the large layer directly but it seems don't work.

    However, I can not find any function about how Klayout divide layer to many regions. It seems just enter

      Region operator| (const Region &other) const
        return Region (mp_delegate->or_with (other));

    It confuses me because "mp_delegate" and "other" show Klayout do divide regions before Boolean Operation, but I can not find it.

    Thank you for your patience and I'm sorry my statement casue distress to you.


  • edited February 24

    Hi Stuart,

    why do you dig into C++ code before investigating the high-level options you have?

    I assume you put in a flat huge region into the processor. Of course that's slow. You're comparing an industry-strength hierarchical tool against a simplistic, flat single-threaded scanline algorithm. You won't find the solution in the C++ code.

    Go to the DRC feature and evaluate the options you have - like deep mode and tiling. These can provide a much better performance already.

    Give me your example layout and your rule deck and I'll tell you how to bring down the times.

    And just in case your boss gave you this task, please send him to me. I would like to discuss with these people the matter of expecting competitive performance for free.


Sign In or Register to comment.