You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Consider exposing control over point compression #2376
On further thought, I'm curious what the ramifications are for when you are writing a GDS, but the polygon count is too high. Does it just error out or split them? IIRC, they currently get compressed.
do you mean people want to have compression or don't want it?
That specific flag you mention is for a very specific purpose and applies to polygons generated by booleans. If you turn off compression, the resulting polygons will have many more vertices in places where original edges met for example. I don't think that is really useful. A merged polygon by definition is the minimum set of edges that encloses the original polygons, so turning off compression is a bit against that definition.
Regarding writing all points to GDS: in GDS, the polygon points is stored in a XY record whose size is limited. So you cannot fit an infinitely large number of points in a polygon. If you exceed the number of points per XY record, you will get a corrupt GDS file. There is a (inofficial) way of fitting more points by writing multiple XY records per polygon, but I think most third-party reader will not like that. OASIS has unlimited number of points per polygon.
do you mean people want to have compression or don't want it?
They don't want it. They'd rather tweak the point density manually to get a smaller GDS.
That specific flag you mention is for a very specific purpose and applies to polygons generated by booleans. If you turn off compression, the resulting polygons will have many more vertices in places where original edges met for example. I don't think that is really useful. A merged polygon by definition is the minimum set of edges that encloses the original polygons, so turning off compression is a bit against that definition.
Let's say we have a polygon that represents a circular 90° bend. It has a certain specific point density.
If, let's say, they decide to connect two of these together and merge them as a single polygon to form a 180° bend, they would assume that only the points of contact are fused, and that the rest of the points don't change.
I think the general worry stems from them knowing that with a specific polygon given to a certain foundry, they have a good idea of the result for the metrics they care about. However, if the compression happens, they have to potentially pay the cost of a wafer to figure out if this changes anything or not.
Regarding writing all points to GDS: in GDS, the polygon points is stored in a XY record whose size is limited. So you cannot fit an infinitely large number of points in a polygon. If you exceed the number of points per XY record, you will get a corrupt GDS file. There is a (inofficial) way of fitting more points by writing multiple XY records per polygon, but I think most third-party reader will not like that. OASIS has unlimited number of points per polygon.
We have multi XY records enabled by default for $DAY_JOB use, but yeah, I believe we already got a case of one third-party not supporting it. There is an internal push to switch to OASIS too.
I can't reopen #2343, so I'll just comment here since it's somewhat linked.
That specific patch is somewhat inconsistent. For the full context, the script that prompted that issue is trying to build a reticle/mask out of a few dies by just importing the GDS and applying basic transformations. This is a bit different from what prompted this issue, which is more generally about design and making the layout itself.
For #2343, I believe the code that reads the GDS outputs SimplePolygon, and potentially SimplePolygonRef / PolygonRef / ShapeRef and others that end up getting compressed.
Reverting that change, but having a global flag to control the compression would address that specific issue too.
I'm not really in favor of a global switch. There are cases where point compression is mandatory (i.e. stitching the outputs of the scanline) and the testsuite for example would not be of much value anymore. Point compression is not done for polygon size, but to eliminate artifacts.
Regarding #2343, I'd appreciate if you give me some test data to reproduce the issue - if your test case involves a full spin, I can identify the place where compression happens and eliminate it. I just verified that a simple GDS write/read cycle does not eliminate collinear points, so it has to be something else.
But how should point compression change the shape of a polygon at all? Point compression applies to collinear edges, so basically there should be no change in the form of the polygon when you combine two lines into one. Is there evidence there is a problem with that? The code is based on "vprod_sign" which is found in dbTypes.h:321. In integer units, this function should return 0 (collinear) only if the points are exactly on the same line. So in integer units, there should be absolutely no modification of the polygon shape by point compression.
Are you aware that rounding to DBU also creates significant noise? There is no way to work around that except choosing a small enough DBU.
If you speak about boolean operations and merge - point compression is implied to eliminate artifacts as mentioned above. That is not some I can change without dropping other warranties and I doubt you will like that.
An finally, a wafer has much severe limitations in terms of accuracy (dose variations, defocus, mask linearity or registration errors, etch process variations, photon shot noise, soft defects etc.). If you set the database unit low enough, the numerically induced jitter should not play any role compared to that. I'd rather worry about that. Point compression for sure is not the primary issue.
Activity
abdelq commentedon Jun 18, 2026
On further thought, I'm curious what the ramifications are for when you are writing a GDS, but the polygon count is too high. Does it just error out or split them? IIRC, they currently get compressed.
klayoutmatthias commentedon Jun 18, 2026
Hi @abdelq,
do you mean people want to have compression or don't want it?
That specific flag you mention is for a very specific purpose and applies to polygons generated by booleans. If you turn off compression, the resulting polygons will have many more vertices in places where original edges met for example. I don't think that is really useful. A merged polygon by definition is the minimum set of edges that encloses the original polygons, so turning off compression is a bit against that definition.
Regarding writing all points to GDS: in GDS, the polygon points is stored in a XY record whose size is limited. So you cannot fit an infinitely large number of points in a polygon. If you exceed the number of points per XY record, you will get a corrupt GDS file. There is a (inofficial) way of fitting more points by writing multiple XY records per polygon, but I think most third-party reader will not like that. OASIS has unlimited number of points per polygon.
Matthias
abdelq commentedon Jun 23, 2026
They don't want it. They'd rather tweak the point density manually to get a smaller GDS.
Let's say we have a polygon that represents a circular 90° bend. It has a certain specific point density.
If, let's say, they decide to connect two of these together and merge them as a single polygon to form a 180° bend, they would assume that only the points of contact are fused, and that the rest of the points don't change.
I think the general worry stems from them knowing that with a specific polygon given to a certain foundry, they have a good idea of the result for the metrics they care about. However, if the compression happens, they have to potentially pay the cost of a wafer to figure out if this changes anything or not.
We have multi XY records enabled by default for $DAY_JOB use, but yeah, I believe we already got a case of one third-party not supporting it. There is an internal push to switch to OASIS too.
abdelq commentedon Jun 23, 2026
I can't reopen #2343, so I'll just comment here since it's somewhat linked.
That specific patch is somewhat inconsistent. For the full context, the script that prompted that issue is trying to build a reticle/mask out of a few dies by just importing the GDS and applying basic transformations. This is a bit different from what prompted this issue, which is more generally about design and making the layout itself.
For #2343, I believe the code that reads the GDS outputs SimplePolygon, and potentially SimplePolygonRef / PolygonRef / ShapeRef and others that end up getting compressed.
Reverting that change, but having a global flag to control the compression would address that specific issue too.
klayoutmatthias commentedon Aug 6, 2026
Hi @abdelq,
I'm not really in favor of a global switch. There are cases where point compression is mandatory (i.e. stitching the outputs of the scanline) and the testsuite for example would not be of much value anymore. Point compression is not done for polygon size, but to eliminate artifacts.
Regarding #2343, I'd appreciate if you give me some test data to reproduce the issue - if your test case involves a full spin, I can identify the place where compression happens and eliminate it. I just verified that a simple GDS write/read cycle does not eliminate collinear points, so it has to be something else.
But how should point compression change the shape of a polygon at all? Point compression applies to collinear edges, so basically there should be no change in the form of the polygon when you combine two lines into one. Is there evidence there is a problem with that? The code is based on "vprod_sign" which is found in
dbTypes.h:321. In integer units, this function should return 0 (collinear) only if the points are exactly on the same line. So in integer units, there should be absolutely no modification of the polygon shape by point compression.Are you aware that rounding to DBU also creates significant noise? There is no way to work around that except choosing a small enough DBU.
If you speak about boolean operations and merge - point compression is implied to eliminate artifacts as mentioned above. That is not some I can change without dropping other warranties and I doubt you will like that.
An finally, a wafer has much severe limitations in terms of accuracy (dose variations, defocus, mask linearity or registration errors, etch process variations, photon shot noise, soft defects etc.). If you set the database unit low enough, the numerically induced jitter should not play any role compared to that. I'd rather worry about that. Point compression for sure is not the primary issue.
Matthias