Skip to content

[rocjitsu] Make ISA targets statically pluggable - #9099

Merged
kuhar merged 1 commit into
developfrom
users/kuhar/rocjitsu-immutable-isa-registry
Jul 24, 2026
Merged

kuhar merged 1 commit into
developfrom
users/kuhar/rocjitsu-immutable-isa-registry

Conversation

@kuhar

@kuhar kuhar commented Jul 23, 2026

Copy link
Copy Markdown
Member

Motivation

Make ISA targets statically pluggable and simplify integration of downstream NPI targets without adding them to central target switches.

Technical Details

  • Add a constexpr descriptor to each ISA that owns its names, public and ELF bindings, decoder factory, and execution capability.
  • Compose one validated immutable registry per final image from its selected provider headers, and use it for decoder creation and code-object lookup.
  • Add canonical-name decoder creation with recoverable unavailable-target errors.
  • Remove fine-grained gfx1250 execution registration markers and replace them with one generated immutable callback table while preserving model-only decoding.

Issue Tracking

N/A

Test Plan

Run ctest and pytest.

Test Result

Passed.

Submission Checklist

@kuhar
kuhar requested review from amd-eochoalo and Copilot July 23, 2026 18:27
@kuhar
kuhar requested review from a team and atgutier as code owners July 23, 2026 18:27

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 wasn't able to review this pull request because it exceeds the maximum number of lines (20,000). Try reducing the number of changed lines and requesting a review from Copilot again.

@github-actions github-actions Bot added documentation Improvements or additions to documentation project: rocjitsu labels Jul 23, 2026
@therock-pr-bot

therock-pr-bot Bot commented Jul 23, 2026 •

Copy link
Copy Markdown

❌ PR Check — Action Required

Check Status Details
🌿 Branch Name ✅ Pass —
📝 PR Title/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 Title/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.

@therock-pr-bot

Copy link
Copy Markdown

🚫 Please fix the failed policies before requesting reviews.

The following policy checks failed:

  • ❌ PR Title/Description

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

@amd-arosa amd-arosa 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.

I sent you two patches to align with the style guide.
There might be something funny happening with create_decoder_for_target, but it was pre-existing.
but other than that LGTM.

@kuhar
kuhar force-pushed the users/kuhar/rocjitsu-immutable-isa-registry branch from 388fb06 to 14e6fe5 Compare July 24, 2026 00:20

@amd-eochoalo amd-eochoalo 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.

I think this is good. Not sure if it would be interesting / good to link kTargetDescriptor to isa_properties somehow in the future (but probably not worth while on this PR at the moment).

@atgutier atgutier 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.

Approved with a minors from the agent:

MINOR

[MINOR] emulation/rocjitsu/lib/rocjitsu/src/rocjitsu/isa/arch/amdgpu/
gfx1250/CMakeLists.txt:71 — Full gfx1250 provider drops its object
libraries’ link requirements

Reasoning: rocjitsu_isa_gfx1250 exposes the model and execution objects
through $<TARGET_OBJECTS:...>, but it does not link or otherwise propagate
the underlying object-library targets. Those targets receive util and
simdojo_headers requirements through rj_add_object_library().

This differs from normal object-library providers: the registry helper both
includes their objects and links the provider target so its usage
requirements propagate. Because the full gfx1250 provider is an
INTERFACE_LIBRARY, the registry helper cannot discover the underlying model
and execution targets. Current broad in-tree consumers independently link
the missing dependencies, masking the composition gap. A narrow or
downstream consumer can therefore depend on undocumented transitive setup
or fail to link as these object libraries acquire additional non-header-
only dependencies.

Evidence:

  • gfx1250/CMakeLists.txt:35-64 creates the model and execution object
    libraries through rj_add_object_library().

  • gfx1250/CMakeLists.txt:71-77 forwards only their object files.

  • cmake/rj_add_object_library.cmake:27-30 attaches common dependencies to
    each object library.

  • cmake/rj_add_object_library.cmake:101-104 extracts objects only when the
    registered provider is itself an object library.

  • cmake/rj_add_object_library.cmake:134-139 republishes the full interface
    provider, whose interface currently contains no link dependencies.

  • docs/isa-target-providers.md:66-87 presents the provider/registry
    combination as the consumer-facing composition boundary.

Suggested fix: retain the explicit $<TARGET_OBJECTS:...> entries, but
propagate both underlying targets’ usage requirements:

target_link_libraries(
rocjitsu_isa_gfx1250
INTERFACE
rocjitsu_isa_gfx1250_model
rocjitsu_isa_gfx1250_exec
)

Alternatively, extend the provider helper to record and forward
implementation dependencies. Add a narrow final-image link test that
consumes the full gfx1250 registry without also inheriting the simulator’s
broad dependency list.

Confidence: medium-high. The usage-requirement propagation gap is definite;
existing production targets currently mask it, so I did not reproduce an
in-tree link failure.

@kuhar
kuhar force-pushed the users/kuhar/rocjitsu-immutable-isa-registry branch from 14e6fe5 to 4c6d2f4 Compare July 24, 2026 15:19
Make ISA targets statically pluggable and simplify integration of downstream
NPI targets without adding them to central target switches.

- Add a constexpr descriptor to each ISA that owns its names, public and ELF
  bindings, decoder factory, and execution capability.
- Compose one validated immutable registry per final image from its selected
  provider headers, and use it for decoder creation and code-object lookup.
- Add canonical-name decoder creation with recoverable unavailable-target
  errors.
- Remove fine-grained gfx1250 execution registration markers and replace them
  with one generated immutable callback table while preserving model-only
  decoding.

N/A

Run ctest and pytest.

Passed.

- [x] Look over the contributing guidelines at
  https://github.com/ROCm/rocm-systems/blob/develop/CONTRIBUTING.md.
@kuhar
kuhar force-pushed the users/kuhar/rocjitsu-immutable-isa-registry branch from 4c6d2f4 to 5e30a63 Compare July 24, 2026 18:38
@kuhar
kuhar merged commit 909c7c9 into develop Jul 24, 2026
26 of 27 checks passed
@kuhar
kuhar deleted the users/kuhar/rocjitsu-immutable-isa-registry branch July 24, 2026 19:01
amd-josnarlo pushed a commit that referenced this pull request Jul 28, 2026
## Motivation

Make ISA targets statically pluggable and simplify integration of
downstream NPI targets without adding them to central target switches.

## Technical Details

- Add a constexpr descriptor to each ISA that owns its names, public and
ELF bindings, decoder factory, and execution capability.
- Compose one validated immutable registry per final image from its
selected provider headers, and use it for decoder creation and
code-object lookup.
- Add canonical-name decoder creation with recoverable
unavailable-target errors.
- Remove fine-grained gfx1250 execution registration markers and replace
them with one generated immutable callback table while preserving
model-only decoding.

## Issue Tracking

N/A

## Test Plan

Run ctest and pytest.

## Test Result

Passed.

## Submission Checklist

- [x] Look over the contributing guidelines at
https://github.com/ROCm/rocm-systems/blob/develop/CONTRIBUTING.md.
theSK2005 added a commit that referenced this pull request Aug 7, 2026
PR #7470 had a bad merge with PRs #8933 and #9099 in _generator.py. Regeneration
currently fails on develop, this fixes it. No changes to generated ISA.
theSK2005 added a commit that referenced this pull request Aug 7, 2026
PR #7470 had a bad merge with PRs #8933 and #9099 in _generator.py. Regeneration
currently fails on develop, this fixes it. No changes to generated ISA.

(cherry picked from commit bc71280)
atgutier pushed a commit that referenced this pull request Aug 7, 2026
PR #7470 had a bad merge with PRs #8933 (intended to bring in
register_exec_fn) and #9099 (intended to remove register_exec_fn) in
_generator.py. Prior to PR #7470, develop didn't have this function and
PR #7470 brought it back in when it shouldn't. Regeneration currently
fails on develop, this fixes it. No changes to generated ISA.

## Test Plan

Reran all rocjitsu tests

## Test Result

All pass

## Submission Checklist

- [x] Look over the contributing guidelines at
https://github.com/ROCm/rocm-systems/blob/develop/CONTRIBUTING.md.
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.

5 participants