Skip to content

refactor(hipblaslt): remove standalone AMax and LayerNorm extension operations - #11374

Closed
newling wants to merge 2 commits into
ROCm:developfrom
newling:remove/hipblaslt-extop-amax
Closed

newling wants to merge 2 commits into
ROCm:developfrom
newling:remove/hipblaslt-extop-amax

Conversation

@newling

@newling newling commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

hipBLASLt currently carries standalone AMax and LayerNorm operations outside its GEMM APIs. Each operation has its own exported C entry point, assembly generator, packaged kernels, runtime model, benchmark, tests, documentation, and samples. Public usage searches found no framework consumers; the direct callers surfaced were the project-owned validation code and examples.

This removes both standalone operations as one support decision instead of retaining one side of the same maintenance tradeoff. Softmax remains as the surviving generated extension operation. Fused GEMM HIPBLASLT_MATMUL_DESC_AMAX_D_POINTER support is unchanged.

The build also removes stale AMax and LayerNorm generator outputs before rebuilding extension metadata. This prevents an incremental build directory from retaining metadata for kernels that are no longer linked into the extension code object.

Alternative

This is the remove-both alternative. #11373 retains both standalone AMax and LayerNorm and fixes their shared LDS-reuse race. The two pull requests are mutually exclusive and only one should merge.

Compatibility

This removes the exported hipblasltExtAMax and hipblasltExtLayerNorm C APIs. The corresponding AMax, mixed-precision AMax, and LayerNorm examples in ROCm/rocm-examples need companion cleanup if this direction is selected.

Validation

The hipBLASLt library, test client, surviving extension clients, and gfx1151 extension library build locally. The resulting shared library exports only hipblasltExtSoftmax among these generated extension operations, and the packaged extension metadata contains only Softmax.

A stale-metadata incremental-build check confirms that old AMax and LayerNorm generator files are removed before packaging. The surviving Softmax benchmark runs successfully, and all six remaining extension-operation tests pass.

@therock-pr-bot

therock-pr-bot Bot commented Aug 27, 2026 •

Copy link
Copy Markdown

✅ All Checks Passed — Ready for Review

Check Status Details
📝 PR 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.

🙋 Wish to Override Policy?

@therock-pr-bot

Copy link
Copy Markdown

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

@codecov

codecov Bot commented Aug 27, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #11374      +/-   ##
===========================================
+ Coverage    69.42%   69.47%   +0.06%     
===========================================
  Files         2828     2828              
  Lines       470113   469724     -389     
  Branches     69417    69391      -26     
===========================================
- Hits        326343   326337       -6     
+ Misses      120066   119682     -384     
- Partials     23704    23705       +1     
Flag Coverage Δ *Carryforward flag
TensileLite-CPP 38.51% <ø> (-0.01%) ⬇️
TensileLite-Unit 76.06% <ø> (ø)
hipBLAS 90.62% <ø> (ø) Carriedforward from 16ed5df
hipBLASLt 35.88% <ø> (+0.66%) ⬆️
hipCUB 82.68% <ø> (ø) Carriedforward from 16ed5df
hipDNN 87.02% <ø> (ø) Carriedforward from 16ed5df
hipFFT 42.66% <ø> (ø) Carriedforward from 16ed5df
hipRAND 76.12% <ø> (ø) Carriedforward from 16ed5df
hipSOLVER 68.92% <ø> (ø) Carriedforward from 16ed5df
hipSPARSE 86.99% <ø> (ø) Carriedforward from 16ed5df
rocBLAS 48.31% <ø> (ø) Carriedforward from 16ed5df
rocFFT 47.78% <ø> (ø) Carriedforward from 16ed5df
rocRAND 56.90% <ø> (ø) Carriedforward from 16ed5df
rocSOLVER 76.83% <ø> (ø) Carriedforward from 16ed5df
rocSPARSE 74.61% <ø> (ø) Carriedforward from 16ed5df
rocThrust 91.60% <ø> (ø) Carriedforward from 16ed5df

*This pull request uses carry forward flags. Click here to find out more.

Files with missing lines Coverage Δ
...slt/clients/common/include/hipblaslt_arguments.hpp 28.65% <ø> (-0.39%) ⬇️
...brary/src/amd_detail/hipblaslt-ext-op-internal.hpp 0.00% <ø> (ø)
...blaslt/library/src/amd_detail/hipblaslt-ext-op.cpp 20.67% <ø> (+7.36%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@newling newling changed the title refactor(hipblaslt): remove standalone AMax extension operation refactor(hipblaslt): remove standalone AMax and LayerNorm extension operations Aug 28, 2026
@newling
newling marked this pull request as ready for review August 28, 2026 22:02
@newling
newling requested review from a team as code owners August 28, 2026 22:02
@newling
newling requested a review from Serge45 August 28, 2026 22:12
@newling
newling force-pushed the remove/hipblaslt-extop-amax branch from 735d8b4 to bae10ea Compare August 31, 2026 21:10
@newling

newling commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

Just a note, the active amax work in (for example) #11525 is orthogonal to this removal proposal. In this PR, the removal is of the standalone reduction in hipblaslt. In #11525, it is fused GEMM output amax, a different thing.

@newling
newling force-pushed the remove/hipblaslt-extop-amax branch from bae10ea to 1780bf4 Compare September 2, 2026 15:56
Remove the exported hipblasltExtAMax API, its generated kernels and library metadata, dedicated clients and samples, and the client-only amaxScaleA/B paths. Preserve fused GEMM AMAX_D_POINTER support and the remaining Softmax and LayerNorm extension operations.
@newling
newling force-pushed the remove/hipblaslt-extop-amax branch from 1780bf4 to f75587c Compare September 9, 2026 20:10
@newling

newling commented Sep 11, 2026

Copy link
Copy Markdown
Contributor Author

Closing in favour of the fix, #11373

@newling newling closed this Sep 11, 2026
newling added a commit that referenced this pull request Sep 15, 2026
JIRA ID: AIHPBLAS-4632

## Summary

AMax and LayerNorm reduce wave-local values through a small LDS scratch
buffer. At each tree level, upper waves publish partial results and
lower waves read those results before the same LDS slots are reused by
the next level.

The existing barrier orders the upper-wave writes before the lower-wave
reads. It does not prevent the next tree level from overwriting those
slots while the preceding reads are still in flight. That creates a
write-after-read race in both generated kernels.

This change routes every participating wave through a second barrier
after the reads complete and before the reduction loop reuses LDS. The
existing public APIs and numerical behavior are unchanged.

A focused generator test covers AMax and LayerNorm. It verifies that the
upper, lower, and inactive-wave paths converge at the LDS-reuse barrier,
and that the lower-wave read occurs between the publication and reuse
barriers. The LayerNorm generator is also installed with the TensileLite
test artifacts so this test works from the installed test tree.

## Validation

rocJITsu reproduced the write-after-read conflict before the fix:

| Operation | Target-kernel dispatches | LDS race reports |
|---|---:|---:|
| AMax | 2 | 2 |
| LayerNorm | 1 | 3 |

A representative pre-fix AMax report shows a lower wave reading the
current partial value while an upper wave begins reusing the same LDS
slot for the next tree level. Intervening address and branch
instructions are elided:

```text
RACE kernel=AMax_Ti_H_To_S_W_256_C_4
  type=LDS access=write wave=1 lane=0 wg=0,0,0

Race on LDS byte 0:
  ==> ds_read_u16   v2, v24  ; wave 0 reads the current partial value
      s_waitcnt     vmcnt(63) expcnt(7) lgkmcnt(0)
      v_max_f16_e32 v1, v1, v2
      ...
  ==> ds_write_b16  v24, v1  ; wave 1 reuses the slot for the next level
END_RACE
```

The second barrier ensures the read is retired before that next write
can occur.

After the fix, AMax completed 20 target-kernel dispatches and LayerNorm
completed 10 without a race report. AMax numerical comparisons remained
exact, and LayerNorm produced identical mean and inverse-variance
results across repeated runs.

The focused generator regression test passes for both operations.
Required Math CI also exercises the existing GPU numerical tests: AMax
compares twelve FP16/FP32 input-output and shape combinations against a
CPU reference, while LayerNorm compares output, mean, and inverse
variance against its CPU reference.

The rocJITsu run is retained as validation evidence rather than added as
a permanent shared sidecar workload.

## Alternative

(Decided to reject this alternative, we want to go with this fix) PR
#11374 removes the standalone AMax and LayerNorm operations and their
supporting surfaces. The two pull requests are mutually exclusive; only
one should merge.
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.

1 participant