Skip to content

test(tensilelite): add true16 v_max_f16 AMax activation regression#9711

Open
tony-davis wants to merge 5 commits into
developfrom
users/todavis/rocm-3994-true16-amax-regression-test
Open

test(tensilelite): add true16 v_max_f16 AMax activation regression#9711
tony-davis wants to merge 5 commits into
developfrom
users/todavis/rocm-3994-true16-amax-regression-test

Conversation

@tony-davis

Copy link
Copy Markdown
Contributor

JIRA ID : ROCM-3994

Motivation

hipBLASLt/TensileLite emits the fake16 form of the v_max_f16 activation-clamp instruction in AMaxKernelGenerator. Under a compiler that enforces real16 mode (+real-true16), the assembler rejects it (operands are not valid for this GPU or mode). PR #6652 migrated the conversion instructions to true16 but not this activation path, so the defect escaped with no test pinning it. This PR supplies the missing regression test ahead of the fix.

Technical Details

The correct true16 form binds a half-word selector to each register operand, with the suffix placed inside the abs(...) paren: v_max_f16 v[out].l, v[out].l, abs(v[val].l).

Two host-only tests (no GPU; the target arch is forced from a gfx string):

  • Primary, emit-site (Tensile/Tests/unit/test_amax_true16_activation.py): constructs an AMaxKernelGenerator for a half input, renders max_per_data/merge_sum to a string, asserts the true16 half-word form and rejects the bare fake16 form. Parametrized across the gfx11 family enabled by the NoSDWA cap (gfx1100/1101/1102/1103/1150/1151/1152/1153) rather than a single arch.
  • Secondary, rocisa unit (rocisa/test/test_instruction.py::test_instruction_vmax_f16_true16): asserts the EMaxF16 true16 rendering directly, in the style of the existing test_instruction_cvt.

Both are quarantined with a strict xfail under the W-KNOWN-BUG two-PR flow, tracked by ROCM-3994 and time-boxed to the next hipBLASLt release. They still execute every CI run; on develop they xfail, and strict=True turns the XPASS into a hard failure the moment the true16 fix lands, forcing the fix PR to delete the markers. This is a deliberate quarantine, not a disabled test. Test-only change; no production source modified.

Test Plan

Run the two tests on develop (bug present) and on the true16 fix branch (users/ericwan/true16-patch, after rebuilding rocisa):

  • pytest rocisa/test/test_instruction.py -k vmax_f16_true16 -q
  • pytest Tensile/Tests/unit/test_amax_true16_activation.py -q

CI: the secondary runs in the rocISA component lane (Linux gfx94X + Windows gfx1151); the primary runs in the TheRock blas matrix's tensilelite test step.

Test Result

  • develop (quarantined): 17 xfailed (1 secondary + 16 primary), suite green. Failure reasons confirmed: primary emits v_max_f16 v[vgprOutput], v[vgprOutput], v[vgprOutputB] (fake16); secondary fails on the absent EMaxF16 import.
  • fix branch (verified before adding markers): primary 16 passed, secondary 1 passed; emitted form v_max_f16 v[vgprOutput].l, v[vgprOutput].l, abs(v[vgprValue+0].l). With the strict-xfail markers in place, this becomes an enforced XPASS->fail that the fix PR resolves by removing them.

Submission Checklist

Risk level

None. Test-only, host-only, quarantined; no production source or goldens touched.

Made with Cursor

…OCM-3994)

Add a RED-on-develop reproducer for the true16 (real-true16) activation-clamp
defect: AMaxKernelGenerator emits the fake16 form of the v_max_f16 activation
clamp, which real-true16 assemblers reject.

- Primary emit-site test (Tensile/Tests/unit/test_amax_true16_activation.py):
  drives AMaxKernelGenerator for a half input and asserts max_per_data /
  merge_sum emit the true16 form (.l selector on every operand, suffix inside
  the abs() paren). Host-only string assertion, no GPU. Parametrized across the
  gfx11 family the NoSDWA cap enables (gfx1100/1101/1102/1103/1150/1151/1152/1153).
- Secondary rocisa unit test (rocisa/test/test_instruction.py): asserts the
  EMaxF16 true16 rendering directly.

Both are quarantined with a strict xfail (W-KNOWN-BUG two-PR flow): they run and
xfail on develop, and strict=True flips the XPASS to a failure once the true16
fix lands, forcing removal of the markers. Test-only; no production source
changed.

JIRA ID : ROCM-3994

Co-authored-by: Cursor <cursoragent@cursor.com>
@tony-davis
tony-davis requested a review from a team as a code owner July 22, 2026 16:41
Copilot AI review requested due to automatic review settings July 22, 2026 16:41
@tony-davis tony-davis changed the title test(tensilelite): add true16 v_max_f16 AMax activation regression (ROCM-3994) test(tensilelite): add true16 v_max_f16 AMax activation regression Jul 22, 2026
@therock-pr-bot

therock-pr-bot Bot commented Jul 22, 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 PR does not contain code files — Unit Test auto-passed
🔎 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 host-only regression coverage for ROCM-3994, pinning the expected true16 encoding of the v_max_f16 activation-clamp emitted by TensileLite/rocisa, while quarantining the tests via strict xfail as part of a two-PR known-bug flow (test lands ahead of the production fix).

Changes:

  • Add a new TensileLite unit test that renders AMaxKernelGenerator output for half inputs and asserts v_max_f16 uses true16 half-word selectors (and that the .l/.h suffix is inside abs(...)).
  • Add a rocisa unit test that asserts the true16 rendering of the EMaxF16 helper (activation/merge shapes), also quarantined with strict xfail.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
projects/hipblaslt/tensilelite/Tensile/Tests/unit/test_amax_true16_activation.py New host-only parametrized regression tests validating true16 v_max_f16 emission in AMaxKernelGenerator (quarantined with strict xfail).
projects/hipblaslt/tensilelite/rocisa/test/test_instruction.py New rocisa-level unit test validating EMaxF16 true16 string rendering (quarantined with strict xfail).

Comment thread projects/hipblaslt/tensilelite/rocisa/test/test_instruction.py Outdated
…test

Address PR review: resolve the assembler path with ROCM_PATH + shutil.which
(matching test_mubuf.py::_isa_context) instead of the bare "amdclang++" string,
so rocIsa.init works when ROCm's bin dir is not on PATH. Falls back to the bare
name if not found.

JIRA ID : ROCM-3994

Co-authored-by: Cursor <cursoragent@cursor.com>
Comment thread projects/hipblaslt/tensilelite/rocisa/test/test_instruction.py
Comment thread projects/hipblaslt/tensilelite/rocisa/test/test_instruction.py
Comment thread projects/hipblaslt/tensilelite/rocisa/test/test_instruction.py

@davidd-amd davidd-amd 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 that the existence of the test as self documenting code and a improved safety net is the most important thing. The testing has issues from the perspective of unit testing but we can't fix that now and this gets us to a better place in the near term.

…ain decouple

Address PR review (davidd-amd): add a brief comment explaining that the test
constructs EMaxF16, renders it via str(), and asserts on the emitted assembly
form (no assembler/GPU invoked), and note what vgpr(...) constructs. Add a
TODO(#9720) to decouple these string-rendering tests from the toolchain/env init.

JIRA ID : ROCM-3994

Co-authored-by: Cursor <cursoragent@cursor.com>
@codecov

codecov Bot commented Jul 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #9711      +/-   ##
===========================================
- Coverage    69.50%   68.55%   -0.95%     
===========================================
  Files         2770     2764       -6     
  Lines       452498   459457    +6959     
  Branches     66620    71410    +4790     
===========================================
+ Hits        314492   314968     +476     
- Misses      117526   122096    +4570     
- Partials     20480    22393    +1913     
Flag Coverage Δ *Carryforward flag
TensileLite 34.35% <ø> (+0.04%) ⬆️ Carriedforward from 01f8565
TensileLite-CPP 38.09% <ø> (ø)
TensileLite-Unit 64.77% <ø> (ø)
hipBLAS 90.62% <ø> (ø) Carriedforward from 01f8565
hipBLASLt 34.63% <ø> (ø)
hipCUB 82.68% <ø> (ø) Carriedforward from 01f8565
hipDNN 86.34% <ø> (-<0.01%) ⬇️ Carriedforward from 01f8565
hipFFT 50.30% <ø> (+2.96%) ⬆️ Carriedforward from 01f8565
hipRAND 76.12% <ø> (ø) Carriedforward from 01f8565
hipSOLVER 69.18% <ø> (ø) Carriedforward from 01f8565
hipSPARSE 86.27% <ø> (ø) Carriedforward from 01f8565
rocBLAS 47.95% <ø> (ø) Carriedforward from 01f8565
rocFFT 49.16% <ø> (+2.61%) ⬆️ Carriedforward from 01f8565
rocRAND 57.05% <ø> (+0.04%) ⬆️ Carriedforward from 01f8565
rocSOLVER 76.84% <ø> (-0.08%) ⬇️ Carriedforward from 01f8565
rocSPARSE 72.49% <ø> (-0.09%) ⬇️ Carriedforward from 01f8565
rocThrust 91.36% <ø> (ø) Carriedforward from 01f8565

*This pull request uses carry forward flags. Click here to find out more.
see 145 files 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.

The true16 AMax activation regression test (ROCM-3994) imports AMaxGenerator directly from the tensilelite root, but that script was never installed into share/hipblaslt/tensilelite/. In the CI artifact tree the bare `import AMaxGenerator` raised ModuleNotFoundError, which aborted the whole Tensile/Tests/unit collection and reddened the tensilelite shard.

Ship AMaxGenerator.py at the install root alongside the other test artifacts so the regression test can actually run in CI.

Co-authored-by: Cursor <cursoragent@cursor.com>
@tony-davis
tony-davis requested a review from a team as a code owner July 24, 2026 15:37
@tony-davis
tony-davis enabled auto-merge (squash) July 24, 2026 15:50

@Alex-Vasile Alex-Vasile 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.

looks good. Thanks for the test

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