[cert] Add page/section-based CERT lowering#3253
Open
fifield wants to merge 6 commits into
Open
Conversation
Contributor
Coverage ReportCreated: 2026-07-13 23:20Click here for information about interpreting this report.
Generated by llvm-cov -- llvm version 18.1.3 |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the AIEX CERT pipeline to use a page/section-based CERT IR, lowers aie.runtime_sequence into that representation (including configure → cert.section + cert.load_pdi), and extends the uC CERT emitter to output pages/sections and the new CERT opcodes.
Changes:
- Add page/section/PDI/preempt CERT ops and update CERT job parenting to support page/section structure.
- Rework
-aie-npu-to-certto produce page-wrapped jobs, absorb referenced devices intocert.section, and add PDI-id assignment + Run-op inlining. - Update
aie-cert-to-asmemission for pages/sections and add new tests for page legalization, blockwrite splitting, and CERT-to-asm output.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| test/Targets/NPU/cert_to_asm.mlir | New translation test covering aie-cert-to-asm output formatting and emitted chain/data. |
| test/Targets/AIETargetUcCert/split_blockwrite.mlir | New test for blockwrite splitting behavior as part of -aie-npu-to-cert. |
| test/Targets/AIETargetUcCert/page_legalize.mlir | New test input for page-legalization / splitting behavior. |
| test/Conversion/NpuToCert/split_blockwrite.mlir | Adjust FileCheck ordering for split globals vs BD emission. |
| lib/Targets/AIETargetUcCert.cpp | Add emission for pages/sections/load_pdi/preempt; add outputPath plumbing and .partition header. |
| lib/Dialect/AIEX/Transforms/AIENpuToCert.cpp | Major rewrite of lowering to page-based CERT, including device absorption and legalization patterns. |
| include/aie/Targets/AIETargets.h | Extend AIETranslateToUcDma API with optional outputPath. |
| include/aie/Dialect/AIEX/Transforms/AIEXPasses.td | Change aie-npu-to-cert to a ModuleOp pass and add --device-name option. |
| include/aie/Dialect/AIEX/Transforms/AIEXPasses.h | Update pass factory signature for the ModuleOp pass. |
| include/aie/Dialect/AIEX/IR/CERTOps.td | Add cert.page, cert.section, cert.load_pdi, cert.preempt and widen cert.job parents. |
Comments suppressed due to low confidence (1)
lib/Dialect/AIEX/Transforms/AIENpuToCert.cpp:928
- SplitNpuBlockWriteOpPattern is applied to getOperation() (the whole module) even though processDevice() is intended to operate on one device at a time. This can rewrite other devices earlier than intended, and the failure path doesn't return after signalPassFailure(), so the pass may continue in a failed state. Apply the pattern to currentDevice and return on failure.
// Split oversized NpuBlockWriteOps before lowering them to cert ops
{
RewritePatternSet p(&getContext());
p.insert<SplitNpuBlockWriteOpPattern>(&getContext());
if (failed(applyPatternsGreedily(getOperation(), std::move(p))))
signalPassFailure();
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
c04b4a8 to
7a5f26c
Compare
…emission Adopt the page-based CERT representation in the AIEX dialect and lower aie.runtime_sequence into it for emission to uC control code. - CERTOps.td: add CertPageOp, CertSectionOp, CertPreemptOp, CertLoadPdiOp; widen CertJobOp parents to pages/sections. - AIENpuToCert (aie-npu-to-cert): page-based lowering with Run-op inlining, Configure->Section, page wrapping/splitting (fixes the page-split infinite loop), and PDI-id assignment. - AIETargetUcCert (aie-cert-to-asm): emit page/section/preempt/load_pdi and a .partition header; outputPath plumbing. - Tests (npu2): page_legalize, split_blockwrite, cert_to_asm. The lowering and emission are device-neutral and exercised on npu2 via aie-opt/aie-translate. CERT full-ELF generation in aiecc and the AIE2PS/AIE4 device glue depend on a CERT-capable device target that is not yet upstream; they are deferred to land alongside device enablement.
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adopt a page-based CERT representation in the AIEX dialect and lower aie.runtime_sequence into it for emission to uC control code.
The lowering and emission are device-neutral and exercised on npu2 via aie-opt/aie-translate. CERT full-ELF generation in aiecc and the AIE2PS/AIE4 device glue depend on a CERT-capable device target that is not yet upstream; they are deferred to land alongside device enablement.