Skip to content

[rocjitsu] Enable functional gfx1251 simulation - #11131

Merged
hanhanW merged 3 commits into
ROCm:developfrom
hanhanW:users/hanhanW/gfx1251-simulator-e2e
Sep 24, 2026
Merged

hanhanW merged 3 commits into
ROCm:developfrom
hanhanW:users/hanhanW/gfx1251-simulator-e2e

Conversation

@hanhanW

@hanhanW hanhanW commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Enable simulator execution on the full gfx1251 target provider now that every newly legal instruction has a real callback. Keep the architecture-only CDNA5 default on gfx1250, and keep the model-only provider callback-free by deriving its bindings without execution capability.

Use immutable concrete-target capabilities instead of adding a second architecture enum or copying the CDNA5 decoder. gfx1250 and gfx1251 share the CDNA5 encoding and execution infrastructure, while the concrete target feature set continues to decide instruction legality and the setreg behavior difference.

Add a deliberately synthetic one-CU gfx1251 functional configuration and a table-driven end-to-end simulator regression for all nine public gfx1251 instructions plus a full-dispatch regression for the target-specific setreg behavior. Each case builds a concrete gfx1251 ELF from exact public LLVM instruction bytes, loads it through normal config, submits it through the AQL queue, executes through the command processor and compute unit, stores exact results to simulated memory, and checks dispatch count, queue advancement, completion, mnemonic execution count, and all 32 lanes. The shift-left-add oracle uses only the public 0-through-4 shift range. Target/version mismatches remain fail-closed.

The encodings remain traceable to the checked-in public CDNA5 XML, repository provenance manifest, llvm/lib/Target/AMDGPU/VOP3PInstructions.td, and public gfx1251 MC tests. No generated ISA or DBT output changes.

This establishes functional simulator execution, not physical gfx1251 validation or cycle/timing fidelity. WMMA mapping, FP-mode corners, and setreg hazard behavior have public-source semantic tests but no gfx1251 hardware differential evidence.

@github-actions github-actions Bot added documentation Improvements or additions to documentation project: rocjitsu labels Sep 2, 2026
@hanhanW
hanhanW force-pushed the users/hanhanW/diff-gfx1251-setreg-vgpr-msb-fixup branch from 413fce6 to 39f8aca Compare September 22, 2026 00:41
@hanhanW
hanhanW force-pushed the users/hanhanW/gfx1251-simulator-e2e branch from 7cb7328 to 5785b10 Compare September 22, 2026 20:36
@hanhanW
hanhanW changed the base branch from users/hanhanW/diff-gfx1251-setreg-vgpr-msb-fixup to develop September 22, 2026 20:38
@hanhanW
hanhanW changed the base branch from develop to users/hanhanW/diff-gfx1251-setreg-vgpr-msb-fixup September 22, 2026 20:39
@therock-pr-bot

therock-pr-bot Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

❌ PR Check — Action Required

Check Status Details
📝 PR Description ❌ Fail Error: PR description must reference a JIRA ID, ISSUE ID, or a GitHub closing keyword.
Expected: include a JIRA ID / ISSUE ID line (separator : or -, or omitted; value may be a JIRA key, a number with/without #, or a link), OR a closing keyword + issue reference. Accepted examples:
• JIRA ID : TESTAUTO-6039
• JIRA ID - #330
• JIRA ID #330
• JIRA ID (on separate line)
ROCM-25757
• ISSUE ID : TESTUTO-3334
• ISSUE ID #3334
• ISSUE ID - TESTAUTO-3433
• ISSUE ID (on separate line)
AIRUNTIME-2352
• ISSUE ID : https://github.com/<org_name>/<repo_name>/issues/1234
• Closes #10
• Fixes octo-org/octo-repo#100
• Resolves: #123
• #123
• https://github.com/<org_name>/<repo_name>/issues/123
Current: no valid JIRA/ISSUE/closing-keyword reference found
⛔ Forbidden Files ✅ Pass —
🧪 Unit Test ✅ Pass —
🔎 pre-commit ✅ Pass —
🚫 Draft PR 🔜 To Be Enabled —
🚩 Feature Flag 🔜 To Be Enabled —
📊 Code Coverage 🔜 To Be Enabled —

⚠️ 1 policy check(s) failed. Please address the issues above before this PR can be Reviewed.

🚫 Please fix the failed policies

  • ❌ PR Description

The Not ready to Review label was added to this PR. Once all policies pass, the label is removed automatically.

📖 Need help? See the Policy FAQ for details on every check and how to fix failures.

🙋 Wish to Override Policy?

@therock-pr-bot

Copy link
Copy Markdown

🚫 Please fix the failed policies before requesting reviews.

The following policy checks failed:

  • ❌ PR Description

The Not ready to Review label has been added to this PR.
Once all policies pass, the label will be removed automatically.

@hanhanW
hanhanW requested review from sjain-stanford and removed request for amd-eochoalo September 22, 2026 20:52
@hanhanW
hanhanW marked this pull request as ready for review September 22, 2026 20:52
@hanhanW
hanhanW requested review from a team and atgutier as code owners September 22, 2026 20:52
@hanhanW
hanhanW force-pushed the users/hanhanW/gfx1251-simulator-e2e branch from 5785b10 to 6e16c3f Compare September 22, 2026 22:38

@sjain-stanford sjain-stanford left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we should build the target/version mismatch cases from an otherwise valid configuration and assert the specific mismatch diagnostic (emulation/rocjitsu/tests/config_test.cpp:1437). At e5d5b748, both fixtures fail first with vm.gpu.device.num_sdma_queues_per_engine must be nonzero when vm.gpu.device.num_sdma_engines is nonzero; matching target/version pairs fail identically. The loader validates the device before checking the target/version, and these fixtures also omit topology. Consequently, the passing EXPECT_THROW assertions do not protect the mismatch guard. Starting from gfx1251_synthetic.json and changing only the target/version pair would avoid these unrelated failures.

Enable simulator execution on the full gfx1251 target provider now that every newly legal instruction has a real callback. Keep the architecture-only CDNA5 default on gfx1250, and keep the model-only provider callback-free by deriving its bindings without execution capability.

Use immutable concrete-target capabilities instead of adding a second architecture enum or copying the CDNA5 decoder. gfx1250 and gfx1251 share the CDNA5 encoding and execution infrastructure, while the concrete target feature set continues to decide instruction legality and the setreg behavior difference.

Add a deliberately synthetic one-CU gfx1251 functional configuration and a table-driven end-to-end simulator regression for all nine gfx1251 instructions plus a full-dispatch regression for the target-specific setreg behavior. Each case builds a concrete gfx1251 ELF from exact LLVM MC-test instruction bytes, loads it through normal config, submits it through the AQL queue, executes through the command processor and compute unit, stores exact results to simulated memory, and checks dispatch count, queue advancement, completion, mnemonic execution count, and all 32 lanes. The shift-left-add oracle uses only the documented 0-through-4 shift range. Target/version mismatches remain fail-closed.

Update the Sphinx architecture and supported-target pages so they no longer describe gfx1251 as decode-only. Document that its checked-in topology is a synthetic functional configuration rather than a product or timing model.

The encodings remain traceable to the checked-in CDNA5 XML and provenance manifest, llvm/lib/Target/AMDGPU/VOP3PInstructions.td, and gfx1251 MC tests. No generated ISA or DBT output changes.

This establishes functional simulator execution, not physical gfx1251 validation or cycle/timing fidelity. The WMMA end-to-end case deliberately uses uniform inputs, so it validates dispatch and arithmetic without independently validating lane or element placement. The source-derived WMMA mapping, fixed FP-mode policy, and setreg behavior have repository regression coverage but no gfx1251 hardware differential evidence.

Signed-off-by: hanhanW <hanhan0912@gmail.com>
Compile gfx1251 vector-add and matrix-multiply fixtures and run them through the functional simulator. Decode every emitted instruction before dispatch, require execution callbacks, and verify queue completion and output behavior.

Give the standalone topology the two wave slots required by a 64-thread wave32 workgroup, and include gfx1251 in generic executable-target coverage. Keep older toolchains buildable while reporting unavailable compiler fixtures as an explicit skipped test.
Bound compiled-kernel preflight decoding to exact sized STT_FUNC ranges and traverse only code reachable from the selected kernel. This prevents inter-function alignment padding and unrelated functions from blocking dispatch while retaining callback validation for the kernel and its callees.

Route synthetic configs through the installed-test path lookup and build target/version mismatch cases from valid configurations with an exact diagnostic assertion. Add a symbol-range regression that preserves gaps between function bodies.

Signed-off-by: hanhanW <hanhan0912@gmail.com>
@hanhanW
hanhanW changed the base branch from users/hanhanW/diff-gfx1251-setreg-vgpr-msb-fixup to develop September 23, 2026 21:31
Copilot AI lite review requested due to automatic review settings September 23, 2026 21:32
@hanhanW
hanhanW force-pushed the users/hanhanW/gfx1251-simulator-e2e branch from e5d5b74 to f09174f Compare September 23, 2026 21:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

The broad simulator, target, ELF, and regression changes warrant final human review.

Review effort: Lite
Findings: None

What changed in this PR

Enables functional gfx1251 simulation using existing CDNA5 infrastructure, with synthetic configuration and end-to-end regressions.

Changes:

  • Enables gfx1251 execution capabilities and target validation.
  • Adds instruction, setreg, and compiled-kernel simulator tests.
  • Adds sized function-range discovery and documentation updates.
File Description
emulation/​rocjitsu/​tests/​kernels/​CMakeLists.txt Adds gfx1251 kernel fixtures.
emulation/​rocjitsu/​tests/​isa_target_registry_test.cpp Validates executable gfx1251 registration.
emulation/​rocjitsu/​tests/​gfx1251_compiled_kernel_test.cpp Tests compiled-kernel dispatch.
emulation/​rocjitsu/​tests/​config_test.cpp Tests configuration and version validation.
emulation/​rocjitsu/​tests/​code/​relocation_function_table_test.cpp Tests function-range gaps.
emulation/​rocjitsu/​tests/​CMakeLists.txt Registers new tests and definitions.
emulation/​rocjitsu/​tests/​cdna5_gfx1251_simulation_test.cpp Adds end-to-end gfx1251 regressions.
emulation/​rocjitsu/​tests/​cdna5_architecture_test.cpp Updates execution expectations.
emulation/​rocjitsu/​tests/​amdgpu_vm_test.cpp Accepts executable concrete targets.
emulation/​rocjitsu/​tests/​amdgpu_elf_test_support.h Declares ELF fixture helpers.
emulation/​rocjitsu/​tests/​amdgpu_elf_test_support.cpp Implements ELF fixture helpers.
emulation/​rocjitsu/​lib/​rocjitsu/​src/​rocjitsu/​isa/​arch/​amdgpu/​cdna5/​target_descriptor.h Enables gfx1251 execution.
emulation/​rocjitsu/​lib/​rocjitsu/​src/​rocjitsu/​code/​relocation_function_table.h Adds sized function-range APIs.
emulation/​rocjitsu/​lib/​rocjitsu/​src/​rocjitsu/​code/​relocation_function_table.cpp Implements function-range discovery.
emulation/​rocjitsu/​docs/​sphinx/​reference/​supported-architectures.md Documents supported targets.
emulation/​rocjitsu/​docs/​sphinx/​conceptual/​architecture.md Documents execution and model separation.
emulation/​rocjitsu/​docs/​configuration.md Documents target selection and synthetic configuration.
emulation/​rocjitsu/​configs/​gfx1251_synthetic.json Defines the synthetic gfx1251 topology.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@sjain-stanford sjain-stanford left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Reviewed f09174f; no actionable findings remain. The earlier compiled-kernel preflight, config-path override, and target/version mismatch test concerns are addressed.

@hanhanW
hanhanW merged commit 139adfd into ROCm:develop Sep 24, 2026
83 of 85 checks passed
@hanhanW
hanhanW deleted the users/hanhanW/gfx1251-simulator-e2e branch September 24, 2026 00:37
@systems-assistant

Copy link
Copy Markdown
Contributor

TheRock Submodule Bump Activity

Newest first

anujshuk-amd pushed a commit that referenced this pull request Sep 25, 2026
Enable simulator execution on the full gfx1251 target provider now that
every newly legal instruction has a real callback. Keep the
architecture-only CDNA5 default on gfx1250, and keep the model-only
provider callback-free by deriving its bindings without execution
capability.

Use immutable concrete-target capabilities instead of adding a second
architecture enum or copying the CDNA5 decoder. gfx1250 and gfx1251
share the CDNA5 encoding and execution infrastructure, while the
concrete target feature set continues to decide instruction legality and
the setreg behavior difference.

Add a deliberately synthetic one-CU gfx1251 functional configuration and
a table-driven end-to-end simulator regression for all nine public
gfx1251 instructions plus a full-dispatch regression for the
target-specific setreg behavior. Each case builds a concrete gfx1251 ELF
from exact public LLVM instruction bytes, loads it through normal
config, submits it through the AQL queue, executes through the command
processor and compute unit, stores exact results to simulated memory,
and checks dispatch count, queue advancement, completion, mnemonic
execution count, and all 32 lanes. The shift-left-add oracle uses only
the public 0-through-4 shift range. Target/version mismatches remain
fail-closed.

The encodings remain traceable to the checked-in public CDNA5 XML,
repository provenance manifest,
llvm/lib/Target/AMDGPU/VOP3PInstructions.td, and public gfx1251 MC
tests. No generated ISA or DBT output changes.

This establishes functional simulator execution, not physical gfx1251
validation or cycle/timing fidelity. WMMA mapping, FP-mode corners, and
setreg hazard behavior have public-source semantic tests but no gfx1251
hardware differential evidence.

---------

Signed-off-by: hanhanW <hanhan0912@gmail.com>
dgaliffiAMD pushed a commit that referenced this pull request Sep 25, 2026
Enable simulator execution on the full gfx1251 target provider now that
every newly legal instruction has a real callback. Keep the
architecture-only CDNA5 default on gfx1250, and keep the model-only
provider callback-free by deriving its bindings without execution
capability.

Use immutable concrete-target capabilities instead of adding a second
architecture enum or copying the CDNA5 decoder. gfx1250 and gfx1251
share the CDNA5 encoding and execution infrastructure, while the
concrete target feature set continues to decide instruction legality and
the setreg behavior difference.

Add a deliberately synthetic one-CU gfx1251 functional configuration and
a table-driven end-to-end simulator regression for all nine public
gfx1251 instructions plus a full-dispatch regression for the
target-specific setreg behavior. Each case builds a concrete gfx1251 ELF
from exact public LLVM instruction bytes, loads it through normal
config, submits it through the AQL queue, executes through the command
processor and compute unit, stores exact results to simulated memory,
and checks dispatch count, queue advancement, completion, mnemonic
execution count, and all 32 lanes. The shift-left-add oracle uses only
the public 0-through-4 shift range. Target/version mismatches remain
fail-closed.

The encodings remain traceable to the checked-in public CDNA5 XML,
repository provenance manifest,
llvm/lib/Target/AMDGPU/VOP3PInstructions.td, and public gfx1251 MC
tests. No generated ISA or DBT output changes.

This establishes functional simulator execution, not physical gfx1251
validation or cycle/timing fidelity. WMMA mapping, FP-mode corners, and
setreg hazard behavior have public-source semantic tests but no gfx1251
hardware differential evidence.

---------

Signed-off-by: hanhanW <hanhan0912@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants