vtr-verilog-to-routing icon indicating copy to clipboard operation
vtr-verilog-to-routing copied to clipboard

Can't write out large rr_graphs in capnp format

Open duck2 opened this issue 1 year ago • 2 comments

direct_rf from titan_quick_qor with default settings creates a rr_graph with ~236M edges. Trying to write it out will result in a crash with the message failed: total size of struct list is larger than max segment size.

Expected Behaviour

If the rr_graph fits in memory, we should be able to write it out to the disk.

Current Behaviour

We can't

Possible Solution

Apparently Cap'n Proto has a hard limit [1] [2] for words in a single segment. A similar limit applies to lists of structs. From [2]:

D (29 bits) = Size of the list: when C <> 7: Number of elements in the list. when C = 7: Number of words in the list, not counting the tag word (see below). [...] A struct list must always be written using C = 7.

In my understanding, this means the size of a list of structs is limited to 8 bytes * 2^29 = 2 GiB. When the list of edges is bigger than that capnp just refuses to serialize it.

A serialized rr_graph edge is 3 uint32s plus a metadata list (which I suppose is a "list tag" of 64 bits) so it's 20 bytes. 236M edges will require ~4.7 GB.

Any ideas on how to go about this? I can't think of a way to solve it without manually tweaking the schema, which somewhat ruins the purpose of having a auto-generated one.

(Maybe this can be an excuse to finally drop uxsdcxx and provide a standalone converter for XML rr graph owners, but I need to progress on the parallel router first...)

Steps to Reproduce

  1. Run titan_quick_qor
  2. Go to run directory for directrf_stratixiv_arch_timing.blif
  3. Get run command from vpr.out, append --write_rr_graph rr_graph.bin and execute it

duck2 avatar Jul 23 '23 08:07 duck2

@amin1377 @kimiatkh Any clue about this?

duck2 avatar Jul 24 '23 17:07 duck2

@amin1377 @kimiatkh Any clue about this?

I have never used capnp format to serialize the RR graph. So far, I have only used XML to serialize it, and it has been faster than building the graph from scratch (at least for my test cases which usually involve big circuits)

amin1377 avatar Jul 24 '23 18:07 amin1377