Skip to content

[rocjitsu] Add fixed-profile gfx1250 B0-to-A0 DBT library - #9062

Merged
kuhar merged 1 commit into
developfrom
users/kuhar/dbt-b0-a0-library
Jul 23, 2026
Merged

kuhar merged 1 commit into
developfrom
users/kuhar/dbt-b0-a0-library

Conversation

@kuhar

@kuhar kuhar commented Jul 23, 2026

Copy link
Copy Markdown
Member

Motivation

This PR adds a dedicated shared library for that fixed translation profile for gfx1250. It uses the model-only ISA layering from #8933, links only the generic DBT base and the gfx1250 model.

This reduces the .so size from >50MB to <5MB.

Technical Details

  • Add librocjitsu_gfx1250_b0_to_a0.so, composed from rocjitsu_dbt_internal, rocjitsu_isa_gfx1250_model, and the header-only SimDojo interface. It does not link the simulator implementation, VM, ISA registry, or non-gfx1250 decoders.
  • Add a revision-fixed C API that accepts a standalone AMDGPU ELF, always translates gfx1250 B0 to gfx1250 A0, and returns caller-owned output storage.
  • Export only rj_gfx1250_b0_to_a0_translate and rj_gfx1250_b0_to_a0_free; hide archive internals with the existing hidden visibility policy plus a Linux version script.
  • Install the library and public header with the normal RocJITsu artifacts.
  • Add a real raw gfx1250 code-object fixture and end-to-end translation test.
  • Add a binary-boundary test that checks the required gfx1250 DBT symbols, rejects execution semantics and non-gfx1250 ISA decoders, rejects broad runtime dependencies, pins the public export set, and enforces the 5 MB stripped-size ceiling.

Issue Tracking

N/A

Test Plan

ctest + check symbols with nm

Test Result

OK

Submission Checklist

@kuhar
kuhar requested review from Groverkss and atgutier July 23, 2026 00:01
@kuhar
kuhar requested a review from a team as a code owner July 23, 2026 00:01
Copilot AI review requested due to automatic review settings July 23, 2026 00:01
@therock-pr-bot

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

Copy link
Copy Markdown

✅ All Checks Passed — Ready for Review

Check Status Details
🌿 Branch Name ✅ Pass —
📝 PR Title/Description ✅ Pass —
⛔ Forbidden Files ✅ Pass —
🧪 Unit Test ✅ Pass —
🔎 pre-commit ✅ Pass —
🚫 Draft PR 🔜 To Be Enabled —
🚩 Feature Flag 🔜 To Be Enabled —
📊 Code Coverage 🔜 To Be Enabled —
🤖 therock-pr-bot ✅ Pass —

🎉 All checks passed! This PR is ready for review.

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

@therock-pr-bot

Copy link
Copy Markdown

🎉 All checks passed! This PR is ready for review.

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.

Pull request overview

Adds a new fixed-profile RocJITsu shared library that performs gfx1250 B0→A0 code-object translation with a narrow dependency surface, aiming to dramatically reduce the shipped .so size while providing a stable C API and focused end-to-end tests.

Changes:

  • Introduces rocjitsu_gfx1250_b0_to_a0 shared library with a revision-fixed C API and Linux version-script export pinning.
  • Adds kernel fixture plumbing and a new gtest that exercises argument validation and (optionally) translation of a real gfx1250 code object.
  • Installs the new shared library and exposes the new header via the existing rocjitsu/code/api.h umbrella.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
emulation/rocjitsu/tests/kernels/CMakeLists.txt Adds a gfx1250 raw-HSACO fixture target and install rule for DBT testing.
emulation/rocjitsu/tests/dbt/gfx1250_b0_to_a0_library_test.cpp New end-to-end tests for the fixed-profile B0→A0 translation API.
emulation/rocjitsu/tests/CMakeLists.txt Wires the new gtest executable and optional fixture dependency under Linux.
emulation/rocjitsu/lib/rocjitsu/src/rocjitsu/code/dbt/gfx1250_b0_to_a0.exports Linux linker version-script restricting exports to the two public C functions.
emulation/rocjitsu/lib/rocjitsu/src/rocjitsu/code/dbt/gfx1250_b0_to_a0_library.cpp Implements the narrow decoder factory and the translate/free C API.
emulation/rocjitsu/lib/rocjitsu/include/rocjitsu/code/rj_gfx1250_b0_to_a0.h Adds the public C header for the fixed-profile translation API.
emulation/rocjitsu/lib/rocjitsu/include/rocjitsu/code/api.h Exposes the new header from the public code API umbrella.
emulation/rocjitsu/lib/rocjitsu/CMakeLists.txt Adds the new shared library target and Linux link options for symbol control.
emulation/rocjitsu/CMakeLists.txt Installs the new shared library alongside existing RocJITsu artifacts.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@kuhar
kuhar force-pushed the users/kuhar/dbt-b0-a0-library branch from b37a94f to f11a184 Compare July 23, 2026 00:17
## Motivation

The gfx1250 B0-to-A0 translation added in #8947 is consumed at load time,
but the existing `librocjitsu_hooks.so` image also carries every AMDGPU ISA
model, simulator execution semantics, the VM, and the HSA tools integration.
That makes the stripped hooks library 50,447,272 bytes and gives a fixed
gfx1250 translator a much broader dependency surface than it needs.

This PR adds a dedicated Linux shared library for that fixed translation
profile. It uses the model-only ISA layering from #8933, links only the
generic DBT base and the gfx1250 model, and produces a stripped image below
5 MB.

## Technical Details

- Add Linux-only `librocjitsu_gfx1250_b0_to_a0.so`, composed from
  `rocjitsu_dbt_internal`, `rocjitsu_isa_gfx1250_model`, and the header-only
  SimDojo interface. It does not link the simulator implementation, VM, ISA
  registry, or non-gfx1250 decoders.
- Add a revision-fixed C API that accepts a standalone AMDGPU ELF, always
  translates gfx1250 B0 to gfx1250 A0, and returns caller-owned output storage.
- Export only `rj_gfx1250_b0_to_a0_translate` and
  `rj_gfx1250_b0_to_a0_free`; hide archive internals with the existing hidden
  visibility policy plus a Linux version script.
- Install the library and public header with the normal Linux RocJITsu
  artifacts.
- Add a real raw gfx1250 code-object fixture and end-to-end translation test.

This PR provides the narrow library and loader-facing ABI. It does not change
the separate COMGR HotSwap shim or selector; that integration must load this
SONAME and resolve the two exported RocJITsu entry points.

## Issue Tracking

Related: #8939

## Test Plan

- Build `rocjitsu_gfx1250_b0_to_a0` and its raw gfx1250 fixture.
- Run the model-only and fixed-profile library tests.
- Run the focused gfx1250 B0-to-A0 DBT regression suite.
- Compile the public header from a strict C11 client.
- Inspect the library's symbols and dynamic dependencies, then measure its
  stripped size.
- Run the RocJITsu pre-commit checks.

## Test Result

- Model-only and fixed-profile library tests: 4/4 passed.
- Focused gfx1250 B0-to-A0 DBT tests: 42/42 passed.
- Real raw gfx1250 code-object translation: passed.
- Strict C11 public-header client: passed.
- Manual binary audit: exactly two public exports; only standard C/C++ runtime
  shared-library dependencies; no simulator, VM, execution, registry, COMGR,
  HSA runtime, or non-gfx1250 ISA implementation symbols.
- Stripped library size: 4,522,664 bytes, below the 5,000,000-byte limit and
  11.15x smaller than the stripped 50,447,272-byte hooks library.
- Pre-commit checks: passed.

## Submission Checklist

- [x] Look over the contributing guidelines at
  https://github.com/ROCm/rocm-systems/blob/develop/CONTRIBUTING.md.
@kuhar
kuhar force-pushed the users/kuhar/dbt-b0-a0-library branch from f11a184 to 34beee3 Compare July 23, 2026 00:19
@kuhar
kuhar merged commit 8264cda into develop Jul 23, 2026
23 checks passed
@kuhar
kuhar deleted the users/kuhar/dbt-b0-a0-library branch July 23, 2026 00:43
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.

3 participants