simx/dxa: match RTL out-of-order response drain - #385
Open
ForeverHYX wants to merge 2 commits into
Open
Conversation
Drain ready non-last responses without waiting for older GMEM requests, while keeping completion notification ordered. Add a deterministic unit test for out-of-order returns.
There was a problem hiding this comment.
Pull request overview
Aligns the SimX DXA GMEM-response drain behavior with the RTL’s out-of-order “direct drain” semantics (non-last responses may drain when ready; the last response remains deferred to preserve ordered completion notification). Adds a deterministic SimX unit test to exercise out-of-order return sequences and validate LMEM writes and notify_done behavior.
Changes:
- Update
sim/simx/dxa/dxa_core.cppto select any ready non-last inflight slot for draining and keep a selected slot active until its multicast/scatter writes complete; only drain thelastslot when it is the only outstanding response. - Add a new unit test (
tests/unittest/dxa_ooo) and hook it into bothtests/unittestandsim/simxbuild/run targets. - Extend
sim/simx/Makefilewith atest-dxa-oootarget and build rules fordxa_ooo_test.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/unittest/Makefile | Adds dxa_ooo to the unit-test project list so it runs with the unittest suite. |
| tests/unittest/dxa_ooo/Makefile | New unittest wrapper that builds/runs the SimX dxa_ooo_test with DXA enabled. |
| tests/unittest/dxa_ooo/main.cpp | New deterministic OoO-response test validating LMEM writes and ordered completion notification behavior. |
| sim/simx/Makefile | Builds dxa_ooo_test and adds a test-dxa-ooo run target; includes dependency tracking and cleanup. |
| sim/simx/dxa/dxa_core.cpp | Implements OoO direct-drain selection with drain_slot pinning and ordered last-response deferral. |
Suppressed comments (3)
tests/unittest/dxa_ooo/main.cpp:127
- The expected LMEM address for B is hard-coded (0x240). To keep the test configuration-independent, derive this from the configured line size and SMEM base (e.g., base + 1*VX_CFG_L1_LINE_SIZE).
check_write(wait_for_lmem_write(dxa.get()), 0x240, 0xbb, false);
tests/unittest/dxa_ooo/main.cpp:116
- The GMEM address assertions are hard-coded for 64B cache lines (0x1000/0x1040/0x1080). If VX_CFG_L1_LINE_SIZE changes, the addresses and/or number of reads will change even though the OoO drain behavior under test is still correct. Consider expressing these expectations in terms of VX_CFG_L1_LINE_SIZE and the base address.
if (reads.at(0).addr != 0x1000 || reads.at(1).addr != 0x1040 || reads.at(2).addr != 0x1080)
fail("unexpected GMEM request addresses");
tests/unittest/dxa_ooo/main.cpp:132
- The expected LMEM addresses for A/C are hard-coded (0x200/0x280). Deriving these from the SMEM base and VX_CFG_L1_LINE_SIZE makes the test robust to configuration changes.
check_write(wait_for_lmem_write(dxa.get()), 0x200, 0xaa, false);
check_write(wait_for_lmem_write(dxa.get()), 0x280, 0xcc, true);
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+86
to
+101
| constexpr uint32_t slot = 0; | ||
| constexpr uint32_t dcr = VX_DCR_DXA_DESC_BASE + slot * VX_DCR_DXA_DESC_STRIDE; | ||
| dxa->dcr_write(dcr + VX_DCR_DXA_DESC_BASE_LO_OFF, 0x1000); | ||
| dxa->dcr_write(dcr + VX_DCR_DXA_DESC_BASE_HI_OFF, 0); | ||
| dxa->dcr_write(dcr + VX_DCR_DXA_DESC_SIZE0_OFF, 192); | ||
| dxa->dcr_write(dcr + VX_DCR_DXA_DESC_META_OFF, 1); | ||
| dxa->dcr_write(dcr + VX_DCR_DXA_DESC_ESTRIDE0_OFF, 1); | ||
| dxa->dcr_write(dcr + VX_DCR_DXA_DESC_TILESIZE01_OFF, 192); | ||
|
|
||
| DxaReq req{}; | ||
| req.core = core; | ||
| req.uuid = 1; | ||
| req.desc_slot = slot; | ||
| req.cta_mask = 1; | ||
| req.smem_addr = 0x200; | ||
| dxa->dxa_req_in.at(0).send(req); |
Keep the three-response scenario portable across supported L1 line-size configurations.
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.
Problem
DXA GMEM responses are drained differently in RTL and SimX. The RTL direct-drain path can consume a ready non-last response without waiting for an older request, while SimX always waits for the oldest issued tag. This makes SimX serialize response handling when GMEM responses return out of order.
Fix
Validation
make -C tests/unittest run OBJCACHE=make -C hw/unittest/dxa_core run OBJCACHE=make -C tests/regression/dxa_copy run-simxmake -C tests/regression/dxa_copy_mcast run-simxmake -C tests/regression/dxa_kmajor_check run-simxmake -C tests/regression/sgemm2_dxa run-simxFixes #384