hugr icon indicating copy to clipboard operation
hugr copied to clipboard

Add metadata specification document with current and planned keys

Open ss2165 opened this issue 5 months ago • 2 comments

A number of metadata keys are currently being used ad-hoc. Some are mentioned in the main spec document. We should instead have a structured document that lists the namespaces, keys, value types and meaning.

We also have metadata that can be attached to nodes but also metadata that can be attached to the contents of extension definitions.

Further, the way the model uses metadata is slightly different to how the core uses it.

Already used (what's missing)?:

General

  • core.generator for recording structured HUGR generator names and versions
  • core.used_extensions for names and versions of used extensions in HUGR

Model

  • core.meta.description for descriptions
  • core.order_hint prefix for recording order edges (is this actually metadata, it does not say meta, is this part of stable model spec instead?)
  • compat.meta_json to string encode existing metadata (like those in the General section above)

Proposed

  • core.hint prefix for adding compiler hints #2328 #2372
  • core.side_effect for marking impure OpDefs
  • core.passes.<pass name> prefix for targeting specific passes
  • Debug information, for example guppy source info

ss2165 avatar Jul 11 '25 09:07 ss2165

We also shouldn't forget about debug info metadata

mark-koch avatar Jul 11 '25 10:07 mark-koch

https://github.com/CQCL/hugr/pull/2448 added core.title to preserve private functions names when exporting. @zrho can you add it to the list above?

lmondada avatar Jul 28 '25 09:07 lmondada