Add shim DMA BD reuse tests for >16 task sequences#3026
Merged
erwei-xilinx merged 3 commits intoXilinx:mainfrom Apr 9, 2026
Merged
Add shim DMA BD reuse tests for >16 task sequences#3026erwei-xilinx merged 3 commits intoXilinx:mainfrom
erwei-xilinx merged 3 commits intoXilinx:mainfrom
Conversation
Add two tests that verify buffer descriptor ID reuse via dma_await_task + dma_free_task on shim tiles: 1. Pass-level test (good-bd-reuse-multi-buffer.mlir): Verifies the aie-assign-runtime-sequence-bd-ids pass accepts 20 tasks on one tile when BD IDs are recycled between batches. 2. E2E hardware test (shim_dma_bd_reuse/): Fires 20 MM2S tasks on one shim channel (exceeds the 16-BD limit), alternating between two source buffers. BD IDs 0-7 are recycled 3 times via periodic await+free. Core tile has a looping DMA passthrough. Host verifies all 20 transfers arrive correctly in the output buffer. This pattern matches the kv_cache_prefill RoPE LUT scenario where VIn sends hundreds of fire-and-forget MM2S tasks from two different memrefs on the same channel. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds new regression tests to validate shim DMA BD-ID reuse across runtime-sequence task batches, enabling >16 MM2S tasks per tile by awaiting/freeing tasks to recycle BD IDs.
Changes:
- Add an E2E NPU XRT hardware test that issues 20 shim MM2S “fire-and-forget” tasks while recycling BD IDs.
- Add an MLIR pass-level test for
--aie-assign-runtime-sequence-bd-idsto prove BD IDs are reused across batches with multiple buffers. - Add a lit runner to compile and execute the new E2E test on NPU1/NPU2.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| test/npu-xrt/shim_dma_bd_reuse/test.cpp | Host-side XRT test that runs the 20-transfer BD-reuse scenario and validates output ordering/data. |
| test/npu-xrt/shim_dma_bd_reuse/run.lit | lit script to build xclbin/instructions, compile host, and run on NPU1/NPU2. |
| test/npu-xrt/shim_dma_bd_reuse/aie.mlir | AIE design + runtime sequence implementing shim MM2S batching/await/free for BD reuse and core passthrough. |
| test/bd-chains-and-dma-tasks/assign-runtime-sequence-bd-ids/good-bd-reuse-multi-buffer.mlir | aie-opt FileCheck test asserting BD-ID reuse across >16 tasks on one shim tile. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
test/bd-chains-and-dma-tasks/assign-runtime-sequence-bd-ids/good-bd-reuse-multi-buffer.mlir
Outdated
Show resolved
Hide resolved
…ds check - Fix FileCheck patterns to use positional dma_bd format instead of non-existent "offset = N" named syntax - Increase memref sizes from 4096 to 40960 to cover max offset+length - Fix clang-format alignment on OUT_SIZE comment - Add std::find_if end-iterator check before dereference - Fix inaccurate "20 iterations" comment on continuous passthrough Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.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.
Summary
aie-assign-runtime-sequence-bd-idsaccepts >16 tasks per tile whendma_await_task+dma_free_taskrecycle BD IDs between batchesTest plan
aie-opt --aie-assign-runtime-sequence-bd-ids good-bd-reuse-multi-buffer.mlirpasses (BD IDs reused)aiecc.pycompilesshim_dma_bd_reuse/aie.mlirsuccessfullyPASS! (20 MM2S fire-and-forget, BD reuse, 2 src buffers)🤖 Generated with Claude Code