Skip to content

Update: enable A5 SDMA workspace by default - #1615

Open
doraemonmj wants to merge 1 commit into
hw-native-sys:mainfrom
doraemonmj:hccl
Open

Update: enable A5 SDMA workspace by default#1615
doraemonmj wants to merge 1 commit into
hw-native-sys:mainfrom
doraemonmj:hccl

Conversation

@doraemonmj

Copy link
Copy Markdown
Contributor

Summary

  • provision the pinned PTO-ISA SDMA workspace in every A5 onboard build
  • keep URMA as the explicit alternative for the single communication workspace
  • run the A5 SDMA completion demo by default and remove the obsolete overlay guide

Validation

  • python -m pytest tests/ut/py/test_runtime_builder.py -q (45 passed)
  • pre-commit hooks passed

- Provision the pinned PTO-ISA SDMA workspace in every A5 onboard build.
- Keep URMA as the explicit alternative for the single communication workspace.
- Run the A5 SDMA demo by default and remove the obsolete overlay guide.
@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

A5 onboard runtime builds now enable SDMA workspace provisioning by default. URMA remains an explicit alternative. PTO-ISA resolution and embedding are unconditional for A5, and tests, examples, and documentation reflect the new behavior.

Changes

A5 workspace backend

Layer / File(s) Summary
Runtime PTO-ISA setup
simpler_setup/runtime_builder.py, simpler_setup/runtime_compiler.py
A5 runtime setup always resolves PTO-ISA metadata. Host configuration forwards only the URMA workspace option.
Host workspace backend
src/a5/platform/onboard/host/CMakeLists.txt, src/a5/platform/onboard/host/comm_hccl.cpp
The host runtime derives SDMA as the default backend, enables URMA through its explicit option, and always requires PTO-ISA headers.
Runtime builder validation
tests/ut/py/test_runtime_builder.py
Tests now validate default A5 PTO-ISA provenance, cache stamping, host defines, and URMA pin resolution.
Documentation and demo behavior
docs/*, examples/a5/tensormap_and_ringbuffer/*
Documentation and demos describe default SDMA behavior, optional URMA builds, revised skip conditions, and removal of the obsolete overlay document.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related issues

Possibly related PRs

Poem

A rabbit hops where SDMA runs,
With PTO-ISA beneath the sun.
URMA waits by choice, not chance,
While tests and docs join the dance.
The old overlay fades from sight—
Default paths now build just right.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 62.50% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely identifies the main change: enabling the A5 SDMA workspace by default.
Description check ✅ Passed The description directly explains the default SDMA workspace, URMA alternative, demo changes, documentation removal, and validation results.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@examples/a5/tensormap_and_ringbuffer/sdma_async_completion_demo/README.md`:
- Around line 21-33: Gate the demo’s test requirements in README.md to the SDMA
backend, and update kernel_sdma_tget_async.cpp to validate that the workspace
backend is SDMA before calling SdmaTget. Preserve the existing A5 platform and
two-die requirements while preventing execution when the workspace is URMA.

In
`@examples/a5/tensormap_and_ringbuffer/urma_deferred_completion_demo/test_urma_deferred_completion_demo.py`:
- Line 217: Update the skip reason in the URMA deferred completion test to state
that SIMPLER_ENABLE_PTO_URMA_WORKSPACE=ON must be set both before rebuilding and
when running pytest, so the test-time environment requirement is explicit.

In `@simpler_setup/runtime_builder.py`:
- Around line 201-205: Update the `_build_cache_stamp` documentation in
`_resolve_build_pto_isa_commit` to state that both A2A3 and A5 onboard builds
include the PTO-ISA commit. In `src/a5/platform/onboard/host/CMakeLists.txt`
lines 126-131, replace the SDMA-specific cache explanation with wording that
also covers explicit URMA builds embedding PTO-ISA headers.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 7060565c-d42f-489b-93a5-39294f9e730c

📥 Commits

Reviewing files that changed from the base of the PR and between 80aa287 and ebfdedd.

📒 Files selected for processing (16)
  • docs/README.md
  • docs/a5-sdma-overlay.md
  • docs/capability-survey.md
  • docs/comm-domain.md
  • examples/a5/tensormap_and_ringbuffer/README.md
  • examples/a5/tensormap_and_ringbuffer/sdma_async_completion_demo/README.md
  • examples/a5/tensormap_and_ringbuffer/sdma_async_completion_demo/kernels/aiv/kernel_sdma_tget_async.cpp
  • examples/a5/tensormap_and_ringbuffer/sdma_async_completion_demo/test_sdma_async_completion_demo.py
  • examples/a5/tensormap_and_ringbuffer/urma_deferred_completion_demo/README.md
  • examples/a5/tensormap_and_ringbuffer/urma_deferred_completion_demo/kernels/aiv/kernel_urma_tget_async.cpp
  • examples/a5/tensormap_and_ringbuffer/urma_deferred_completion_demo/test_urma_deferred_completion_demo.py
  • simpler_setup/runtime_builder.py
  • simpler_setup/runtime_compiler.py
  • src/a5/platform/onboard/host/CMakeLists.txt
  • src/a5/platform/onboard/host/comm_hccl.cpp
  • tests/ut/py/test_runtime_builder.py
💤 Files with no reviewable changes (3)
  • docs/a5-sdma-overlay.md
  • examples/a5/tensormap_and_ringbuffer/sdma_async_completion_demo/test_sdma_async_completion_demo.py
  • docs/README.md

Comment on lines +21 to 33
## Requirements

Unlike its a2a3 namesake, the a5 demo needs the PTO async-SDMA workspace
compiled into the host runtime:
The a5 host runtime includes the PTO async-SDMA workspace by default:

| Gate | Effect |
| ---- | ------ |
| `@pytest.mark.platforms(["a5"])` | deselected on any other `--platform` |
| `@pytest.mark.device_count(2)` | needs two dies |
| `@pytest.mark.skipif(...)` | skipped unless `SIMPLER_ENABLE_PTO_SDMA_WORKSPACE` is `1` / `ON` / `TRUE` / `YES` |

The CMake option defaults `OFF`, so a stock build skips this test even on a5
hardware — **a green CI run says nothing about SDMA completion on a5.**

```bash
SIMPLER_ENABLE_PTO_SDMA_WORKSPACE=ON pip install --no-build-isolation -e .
SIMPLER_ENABLE_PTO_SDMA_WORKSPACE=ON \
pytest examples/a5/tensormap_and_ringbuffer/sdma_async_completion_demo \
pytest examples/a5/tensormap_and_ringbuffer/sdma_async_completion_demo \
--platform a5 --device 0-1
```

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

test_file="$(fd -t f 'test_sdma_async_completion_demo.py' examples/a5/tensormap_and_ringbuffer | head -n 1)"
test -n "$test_file"

rg -n -C 6 'skipif|PTO_(URMA|SDMA)_WORKSPACE|platforms|device_count|run\(' "$test_file"
rg -n -C 8 'SIMPLER_ENABLE_PTO_(URMA|SDMA)_WORKSPACE|domain_workspace_addr|workSpace' \
  src/a5/platform/onboard/host/CMakeLists.txt \
  src/a5/platform/onboard/host/comm_hccl.cpp

Repository: hw-native-sys/simpler

Length of output: 26072


🏁 Script executed:

#!/bin/bash
set -euo pipefail

test_file="$(fd -t f 'test_sdma_async_completion_demo.py' examples/a5/tensormap_and_ringbuffer | head -n 1)"
kernel_file="examples/a5/tensormap_and_ringbuffer/sdma_async_completion_demo/kernels/aiv/kernel_sdma_tget_async.cpp"
readme_file="examples/a5/tensormap_and_ringbuffer/sdma_async_completion_demo/README.md"

printf '%s\n' '--- test file ---'
wc -l "$test_file"
sed -n '1,215p' "$test_file"

printf '%s\n' '--- kernel ---'
wc -l "$kernel_file"
sed -n '1,125p' "$kernel_file"

printf '%s\n' '--- README ---'
cat -n "$readme_file"

printf '%s\n' '--- backend option propagation ---'
rg -n -C 5 'SIMPLER_ENABLE_PTO_(URMA|SDMA)_WORKSPACE|PTO.*WORKSPACE|RuntimeBuilder|host_runtime' \
  --glob '!**/build/**' --glob '!**/node_modules/**' .

Repository: hw-native-sys/simpler

Length of output: 1928


🏁 Script executed:

#!/bin/bash
set -euo pipefail

python3 - <<'PY'
from pathlib import Path
import re

test = Path("examples/a5/tensormap_and_ringbuffer/sdma_async_completion_demo/test_sdma_async_completion_demo.py").read_text()
kernel = Path("examples/a5/tensormap_and_ringbuffer/sdma_async_completion_demo/kernels/aiv/kernel_sdma_tget_async.cpp").read_text()
cmake = Path("src/a5/platform/onboard/host/CMakeLists.txt").read_text()
comm = Path("src/a5/platform/onboard/host/comm_hccl.cpp").read_text()

checks = {
    "test_has_platform_gate": bool(re.search(r"`@pytest`\.mark\.platforms\(\[\"a5\"\]\)", test)),
    "test_has_device_count_gate": bool(re.search(r"`@pytest`\.mark\.device_count\(2\)", test)),
    "test_has_backend_gate": bool(re.search(r"skipif|PTO_(?:URMA|SDMA)_WORKSPACE", test)),
    "kernel_guard_checks_workspace": bool(re.search(r"nranks\s*!=\s*2\s*\|\|\s*comm_ctx->workSpace\s*==\s*0", kernel)),
    "kernel_calls_sdma_tget": "SdmaTget" in kernel,
    "cmake_makes_sdma_default": bool(re.search(
        r"if\s*\(\s*SIMPLER_ENABLE_PTO_URMA_WORKSPACE\s*\).*?"
        r"set\s*\(\s*SIMPLER_ENABLE_PTO_SDMA_WORKSPACE\s+OFF\s*\).*?"
        r"else\s*\(\).*?"
        r"set\s*\(\s*SIMPLER_ENABLE_PTO_SDMA_WORKSPACE\s+ON\s*\)",
        cmake, re.S)),
    "urma_assigns_same_workspace": bool(re.search(
        r"h->host_ctx\.workSpace\s*=\s*reinterpret_cast<uint64_t>\(h->urma_workspace->GetWorkspaceAddr\(\)\)",
        comm)),
    "sdma_assigns_same_workspace": bool(re.search(
        r"h->host_ctx\.workSpace\s*=\s*reinterpret_cast<uint64_t>\(h->sdma_workspace->GetWorkspaceAddr\(\)\)",
        comm)),
}
for name, value in checks.items():
    print(f"{name}={value}")
PY

Repository: hw-native-sys/simpler

Length of output: 1928


Gate the demo to the SDMA backend.

When SIMPLER_ENABLE_PTO_URMA_WORKSPACE is enabled, CommContext::workSpace contains a valid URMA workspace, but the kernel still calls SdmaTget. Add an SDMA backend gate to the test and validate the backend before using SdmaTget in the kernel.

📍 Affects 2 files
  • examples/a5/tensormap_and_ringbuffer/sdma_async_completion_demo/README.md#L21-L33 (this comment)
  • examples/a5/tensormap_and_ringbuffer/sdma_async_completion_demo/kernels/aiv/kernel_sdma_tget_async.cpp#L47-L48
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@examples/a5/tensormap_and_ringbuffer/sdma_async_completion_demo/README.md`
around lines 21 - 33, Gate the demo’s test requirements in README.md to the SDMA
backend, and update kernel_sdma_tget_async.cpp to validate that the workspace
backend is SDMA before calling SdmaTget. Preserve the existing A5 platform and
two-die requirements while preventing execution when the workspace is URMA.

not _urma_workspace_enabled(),
reason="URMA workspace overlay not enabled (set SIMPLER_ENABLE_PTO_URMA_WORKSPACE=ON to run). "
"See docs/a5-sdma-overlay.md (#1315).",
reason="URMA workspace backend not enabled (set SIMPLER_ENABLE_PTO_URMA_WORKSPACE=ON before rebuilding).",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Mention the test-time environment requirement.

The skip condition reads SIMPLER_ENABLE_PTO_URMA_WORKSPACE when pytest runs. A user who sets it only before rebuilding still gets a skipped test. State that the variable must be set both when rebuilding and when running pytest.

Proposed wording
-    reason="URMA workspace backend not enabled (set SIMPLER_ENABLE_PTO_URMA_WORKSPACE=ON before rebuilding).",
+    reason="URMA workspace backend not enabled (set SIMPLER_ENABLE_PTO_URMA_WORKSPACE=ON before rebuilding and when running pytest).",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
reason="URMA workspace backend not enabled (set SIMPLER_ENABLE_PTO_URMA_WORKSPACE=ON before rebuilding).",
reason="URMA workspace backend not enabled (set SIMPLER_ENABLE_PTO_URMA_WORKSPACE=ON before rebuilding and when running pytest).",
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@examples/a5/tensormap_and_ringbuffer/urma_deferred_completion_demo/test_urma_deferred_completion_demo.py`
at line 217, Update the skip reason in the URMA deferred completion test to
state that SIMPLER_ENABLE_PTO_URMA_WORKSPACE=ON must be set both before
rebuilding and when running pytest, so the test-time environment requirement is
explicit.

Comment on lines 201 to +205
def _resolve_build_pto_isa_commit(self) -> str:
"""Return the pinned pto-isa commit baked into this build.

When host code embeds pto-isa headers (a2a3 onboard, or a5 onboard
with the SDMA or URMA overlay ON), a pto-isa bump must invalidate that build's
When host code embeds pto-isa headers (a2a3 or a5 onboard), a pto-isa
bump must invalidate that build's

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Update the PTO-ISA cache documentation.

The implementation now covers both A5 backends and both onboard embedding platforms. The current comments retain narrower old behavior.

  • simpler_setup/runtime_builder.py#L201-L205: Update the _build_cache_stamp text at Line 225. It must state that A2A3 and A5 onboard builds include the PTO-ISA commit.
  • src/a5/platform/onboard/host/CMakeLists.txt#L126-L131: Replace the SDMA-specific explanation. The cache key also protects explicit URMA builds that embed PTO-ISA headers.
📍 Affects 2 files
  • simpler_setup/runtime_builder.py#L201-L205 (this comment)
  • src/a5/platform/onboard/host/CMakeLists.txt#L126-L131
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@simpler_setup/runtime_builder.py` around lines 201 - 205, Update the
`_build_cache_stamp` documentation in `_resolve_build_pto_isa_commit` to state
that both A2A3 and A5 onboard builds include the PTO-ISA commit. In
`src/a5/platform/onboard/host/CMakeLists.txt` lines 126-131, replace the
SDMA-specific cache explanation with wording that also covers explicit URMA
builds embedding PTO-ISA headers.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant