Skip to content

Conversation

@amin1377
Copy link
Contributor

@amin1377 amin1377 commented Dec 1, 2025

This PR adds a schema file ID to the RR graph attributes. The ID is included in both the XML and Cap’n Proto (binary) formats. When reading an RR graph, VTR now loads the schema ID stored in its internal schema and compares it with the ID found in the XML or binary file. If the IDs do not match, an error is raised.

@AlexandreSinger: I believe this also addresses your earlier concern about including an ID for the XML file.

Below is the first line of the RR graph XML, showing the added schema ID:

image

For the Cap’n Proto file: each time the schema is generated, Cap’n Proto assigns a random 64-bit number in the format @0x.... This number is stored as the schema ID in both the XML and binary RR graph files.

@github-actions github-actions bot added the lang-cpp C/C++ code label Dec 1, 2025
@amin1377
Copy link
Contributor Author

amin1377 commented Dec 1, 2025

Note that if an XML file does not contain this attribute, it can still be read. An error is raised only when the schema_id attribute is present and does not match the schema used by VPR.

Copy link
Contributor

@AlexandreSinger AlexandreSinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Amin! Some minor comments below.

So, just to confirm, if the XML file does not have this attribute, this code will not error out? My concern is that many users of VTR generate the RR-graph XML using external tools. So is our solution to this is just to tell them not to set this attribute? That way they "opt-out" of this error checking.

#ifdef VTR_ENABLE_CAPNPROTO
::capnp::Schema schema = ::capnp::Schema::from<ucap::RrGraph>();
schema_file_id = schema.getProto().getScopeId();
VTR_LOG("Schema file ID: 0x%016lx\n", schema_file_id);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we make this a verbose message? I am not sure if this message will make sense for most users of VPR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have a strong opinion on it, but I think if you are reading or writing the RR Graph, this is relevant information to print even when verbose mode is not enabled.

#ifdef VTR_ENABLE_CAPNPROTO
::capnp::Schema schema = ::capnp::Schema::from<ucap::RrGraph>();
schema_file_id = schema.getProto().getScopeId();
VTR_LOG("Schema file ID: 0x%016lx\n", schema_file_id);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment here. I am wondering if we should make this a verbose log message.

@amin1377
Copy link
Contributor Author

amin1377 commented Dec 3, 2025

Thanks Amin! Some minor comments below.

So, just to confirm, if the XML file does not have this attribute, this code will not error out? My concern is that many users of VTR generate the RR-graph XML using external tools. So is our solution to this is just to tell them not to set this attribute? That way they "opt-out" of this error checking.

Yes, you are right. If this attribute doesn't exist in XML file, we don't error out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lang-cpp C/C++ code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants