Expose PDI output format for alternative runtimes on npu1#79
Merged
Conversation
Add output_format='pdi' so users can emit a raw aie.pdi (plus the insts.bin instruction sidecar) for an alternative (non-XRT) runtime that loads PDIs directly, motivated by issue #53. - Bump pinned mlir-air to 2026071405+c7ee42f, the first wheel that includes the aircc --output-format=pdi / --pdi-name flags from Xilinx/mlir-air PR #1729. The bump must land with this change since older wheels lack the flag. - Accept 'pdi' in npu_config.output_format (env AMD_TRITON_NPU_OUTPUT_FORMAT), alongside 'elf' and 'xclbin'. - Add a PDI branch to _aircc_compile that passes --output-format pdi --pdi-name aie.pdi -i insts.bin, and generalize the artifact cache get/put to a format-neutral bin_path so pdi and xclbin share the same insts.bin plumbing. - PDI targets a non-XRT runtime, so the in-repo XRT launcher cannot dispatch a .pdi: guard the launcher to throw a clear error when the device binary ends in .pdi (mirroring mlir-air's XRTBackend.load()). Use AMD_TRITON_NPU_COMPILE_ONLY=1 to export the artifacts. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR exposes a new NPU backend output format (output_format='pdi') intended for npu1/Phoenix workflows where an alternative (non-XRT) runtime consumes a raw aie.pdi plus an insts.bin sidecar, and updates the pinned mlir-air revision to a build that supports the necessary aircc flags.
Changes:
- Bump the pinned
mlir-aircommit/timestamp to a build that includesaircc --output-format=pdi/--pdi-name. - Extend backend configuration parsing/validation to accept
output_format="pdi"vianpu_configandAMD_TRITON_NPU_OUTPUT_FORMAT. - Add a PDI compilation branch in
driver._aircc_compile, generalize artifact caching tobin_path, and make the generated XRT launcher fail early with a clear error when given a.pdi.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| utils/mlir-air-hash.txt | Updates pinned mlir-air commit/timestamp to a build that provides the new aircc PDI flags. |
| amd_triton_npu/backend/driver.py | Adds PDI compile support and format-neutral caching changes; adds an explicit runtime error when attempting to XRT-launch a .pdi. |
| amd_triton_npu/backend/config.py | Accepts and validates output_format="pdi" from config/env and documents the new option. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Address Copilot review on PR #79: - multilaunch.py read cached["xclbin_path"] on both the cache-hit and cache-miss paths, but the artifact dict key was renamed to bin_path; update both call sites so xclbin (and pdi) multi-launch compiles no longer KeyError. - Update _get_cached_aircc_artifacts and MultiLaunch.compile docstrings to reflect the elf/xclbin/pdi shapes. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Collaborator
Author
|
Addressed the Copilot review in 9e0577b:
Verified no remaining dict-key references to |
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.
Summary
Exposes
output_format='pdi'on npu1/Phoenix (motivated by #53), producing a rawaie.pdiplus aninsts.bininstruction sidecar for an alternative runtime that loads PDIs directly (not XRT). The PDI path is the same internal flow as xclbin — the xclbin just wraps the PDI in an extra layer.2026071405+c7ee42f— the first release wheel containing theaircc --output-format=pdi/--pdi-nameflags from Xilinx/mlir-air PR #1729. Older wheels lack the flag, so the bump must land in the same PR.'pdi'innpu_config.output_format(envAMD_TRITON_NPU_OUTPUT_FORMAT), alongsideelf/xclbin._aircc_compilepassing--output-format pdi --pdi-name aie.pdi -i insts.bin; artifact cache get/put generalized to a format-neutralbin_pathsopdiandxclbinshare theinsts.binplumbing..pdi. It now throws a clear error when the device binary ends in.pdi(mirroring mlir-air'sXRTBackend.load()). Export artifacts withAMD_TRITON_NPU_COMPILE_ONLY=1and hand the.pdi+.insts.binto the target runtime.Test plan
aircc --helpnow lists--output-format=pdi/--pdi-name.matmul_i8_m64_n64_k64,matmul_i8_m128_n64_k64,matmul_bf16_m64_n64_k64,vec-add,relu.AMD_TRITON_NPU_OUTPUT_FORMAT=pdi+AMD_TRITON_NPU_COMPILE_ONLY=1) on npu1 hardware — not exercised here (npu2 defaults to elf; PDI is npu1-oriented and export-only).🤖 Generated with Claude Code