Skip to content

✨ Record typed compiler target environments in MQT IR - #2215

Open
burgholzer wants to merge 3 commits into
codex/generalize-compiler-targetfrom
codex/payload-execution-environment
Open

✨ Record typed compiler target environments in MQT IR#2215
burgholzer wants to merge 3 commits into
codex/generalize-compiler-targetfrom
codex/payload-execution-environment

Conversation

@burgholzer

@burgholzer burgholzer commented Aug 23, 2026

Copy link
Copy Markdown
Member

🤖 AI text below 🤖

Description

Record one complete compiler target environment as typed MQT IR metadata. mqt.target_env combines immutable hardware facts with one exact payload descriptor and its effective execution capabilities. Textual MLIR pipelines can now inspect and reproduce the target contract without hidden pass state.

The hardware side preserves ordered sites, timing and fidelity data, topology knowledge, and native-operation knowledge without serializing derived routing or synthesis caches. The payload side keeps format ID, semantic version, profile, encoding, extensible capabilities, typed constraints, and whether optional capability metadata is complete. CompilerTarget remains a context-free value and converts losslessly at the IR boundary.

The attribute implements the DLTI query interface for typed MQT values and namespaced extensions. Direct lookup through the canonical mqt.target_env module attribute remains authoritative because a module can contain other DLTI query attributes.

This PR is stacked on #2218. It stays independent of the work-in-progress QDMI v1.4 API; a later adapter change can map stable QDMI descriptors and capabilities into this provider-neutral schema.

Checklist

  • The pull request only contains commits that are focused and relevant to this change.
  • I have added appropriate tests that cover the new/changed functionality.
  • I have updated the documentation to reflect these changes.
  • I have added entries to the changelog for any noteworthy additions, changes, fixes, or removals.
  • I have added migration instructions to the upgrade guide (if needed).
  • The changes follow the project guidelines and introduce no new warnings.
  • The changes are fully tested and pass the CI checks.
  • I have reviewed my own code changes.

If PR contains AI-assisted content:

  • Any agent that created, edited, or submitted GitHub content was explicitly authorized for that scope, as required by our AI Usage Guidelines.
  • Every agent-authored or agent-edited public text body begins with the visible disclosure 🤖 *AI text below* 🤖 (titles are exempt).
  • I have disclosed AI assistance in the PR description.
  • I confirm that I have personally reviewed and understood all AI-generated content, and accept full responsibility for it.

@burgholzer burgholzer added feature New feature or request c++ Anything related to C++ code MLIR Anything related to MLIR labels Aug 23, 2026
@burgholzer burgholzer self-assigned this Aug 23, 2026
@burgholzer
burgholzer force-pushed the codex/payload-execution-environment branch from 7b25247 to 07352c2 Compare August 23, 2026 10:59
@mergify mergify Bot added the conflict label Aug 23, 2026
@codecov

codecov Bot commented Aug 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.37176% with 23 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
mlir/lib/Dialect/MQT/IR/MQTDialect.cpp 94.7% 11 Missing ⚠️
mlir/lib/Compiler/Target.cpp 91.7% 10 Missing ⚠️
mlir/include/mlir/Dialect/MQT/IR/MQTAttributes.h 87.5% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@burgholzer
burgholzer force-pushed the codex/payload-execution-environment branch from 07352c2 to c2c5028 Compare August 23, 2026 11:35
@mergify mergify Bot added conflict and removed conflict labels Aug 23, 2026
@burgholzer
burgholzer force-pushed the codex/payload-execution-environment branch from c2c5028 to 420fbc8 Compare August 23, 2026 18:12
@burgholzer burgholzer changed the title ✨ Add typed payload execution environments to MQT IR ✨ Record typed compiler target environments in MQT IR Aug 23, 2026
@burgholzer
burgholzer changed the base branch from main to codex/generalize-compiler-target August 23, 2026 18:12
@mergify mergify Bot added conflict and removed conflict labels Aug 23, 2026
@burgholzer
burgholzer force-pushed the codex/payload-execution-environment branch 2 times, most recently from 36b7fbb to 99f2786 Compare August 23, 2026 18:39

@burgholzer burgholzer left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This also looks genuinely good except for one little detail.

Comment thread mlir/lib/Compiler/Target.cpp Outdated
Comment thread mlir/lib/Compiler/Target.cpp Outdated
@burgholzer
burgholzer force-pushed the codex/payload-execution-environment branch from 99f2786 to e7350d0 Compare August 24, 2026 12:46
@coderabbitai

coderabbitai Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Important

Approval pending

CodeRabbit has no unresolved comments, but it has not reviewed the latest commit.

Use the checkbox below to review the latest commit. CodeRabbit will approve the changes if it finds no blocking issues.

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@burgholzer
burgholzer force-pushed the codex/payload-execution-environment branch from e7350d0 to 86d01c1 Compare August 24, 2026 13:54
@burgholzer burgholzer added this to the MLIR Support milestone Aug 24, 2026
Record complete compiler-target facts and one exact payload execution contract as typed module metadata.

Assisted-by: GPT-5.6 Sol via Codex
Assisted-by: GPT-5.6 Sol via Codex
Remove duplicate connectivity and native-operation enum definitions. Reuse the generated MQT attribute enums across the C++ target and its materialized MLIR representation.

Assisted-by: GPT-5.6 Sol via Codex
@burgholzer
burgholzer force-pushed the codex/payload-execution-environment branch from 86d01c1 to 390e966 Compare August 24, 2026 23:47

@denialhaag denialhaag left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I really like the addition of these attribues! I only have a nitpick and a comment on the attribute descriptions, otherwise this LGTM! I'm already approving now, as neither of my comments is blocking. 😎

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not important, but I don't think we need the MQT_ prefixes here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Agreed. Let's drop them!

Comment on lines +123 to +129
let description = [{
Records the exact payload and its effective capabilities. Producers expand
descriptor baselines before creating this attribute. The capability list
remains available when optional capability metadata is unknown;
`optional_capabilities_known` records whether that optional metadata is
complete.
}];

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

While I'm generally a fan of keeping documentation concise, I think (some of) the attributes added here could benefit from some examples in their descriptions, especially because they all end up in the rendered docs. 🤔

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah, fully agree. The initial version of these was even more concise and I already urged the system to be a little more elaborate.
I like the idea of including an explicit example of a small program using that feature as ```mlir ... ``` code

@burgholzer

Copy link
Copy Markdown
Member Author

@simon1hofmann any feedback on this one? Given its low position in the stack, I'd like to not touch this part more than once anymore.

@simon1hofmann simon1hofmann left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Also went through this and looks pretty clean as well. Just have one finding that was flagged, probably worth double-checking in your Codex session.

}];
let parameters = (ins "CompilationTargetAttr":$compilation_target,
"PayloadEnvAttr":$payload_env,
OptionalParameter<"::mlir::MapAttr">:$extensions);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🤖 AI text below 🤖
MQTDialect.td:209 embeds #dlti.map, but MQT does not declare DLTIDialect as dependent. Standard contexts omit it in Programs.cpp:88-92 and mqt-cc.cpp:456-460. Consequently, valid extension-bearing target environments cannot be parsed through QCOProgram or mqt-cc; the latter crashes after parsing fails. The test masks this by registering DLTI explicitly at test_mqt_ir.cpp:51-54.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Feels like a correct finding. Let's double check and fix this where it is supposed to be fixed.

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

Labels

c++ Anything related to C++ code feature New feature or request MLIR Anything related to MLIR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants