-
Notifications
You must be signed in to change notification settings - Fork 265
Description
When writing large lists or dictionaries (I am very much not a fan of this practice, but alas) as MetaInfos, klayout will happily write the gds, but fail on reading it.
Example:
import klayout.db as kdb
ly = kdb.Layout()
c = ly.create_cell("TEST")
# first entries are just to illustrate that the total size of the records is not the problem, the 8190 line is enough to trigger the error
for i in (
1,
10,
100,
1000,
3000,
8188,
# 8190, # does not work if uncommented
):
print(i)
c.add_meta_info(kdb.LayoutMetaInfo(str(i), [1 for _ in range(i)], persisted=True))
c.write("test.oas")I suspect MetaInfos have a maximum size. when opening this file directly from a terminal I get
ERROR: ../../../src/tl/tl/tlDeflate.cc,248,n < sizeof (m_buffer) / 2
ERROR: Internal error: ../../../src/tl/tl/tlDeflate.cc:248 n < sizeof (m_buffer) / 2 was not true
When doing the same but through klive (i.e. it will just tell the layout view to reload), I get:
Caught the following exception:
ENDEL, PROPATTR or PROPVALUE record expected (position=31499, record number=22, cell=$$$CONTEXT_INFO$$$) in LayoutViewBase.reload_layout (Class RuntimeError)
tl;dr
I am pretty sure that klayout expects the entry to have a maximum size in bytes, but on write will happily write larger entries.
It would be nice if klayout could either
- throw an error if record written is too large
- read unlimited size of record
Whichever is easier to implement. (First one would allow me to not entertain ridiculous ideas though 😝)
P.S.:
Is there an absolute maximum of number of records the $$$CONTEXT_INFO$$$ cell can hold? We had it that in one tapeout klayout stopped writing metainfos at a seemingly random number of metainfos, but I couldn't confirm or deny yet.