Skip to content

[stinkytofu] Implement legalizeImplicitSpecialRegisters function#7268

Merged
pschang-phy merged 1 commit into
developfrom
users/pochang/implicit_special_registers
May 13, 2026
Merged

[stinkytofu] Implement legalizeImplicitSpecialRegisters function#7268
pschang-phy merged 1 commit into
developfrom
users/pochang/implicit_special_registers

Conversation

@pschang-phy
Copy link
Copy Markdown
Contributor

Motivation

Implicit registers, eg. SCC, VCC, and EXEC must be attached to instruction's src/dest list so the def-use chain builder sees those dependencies. Today this only happens in the rocisa → stinkytofu converter, so any StinkyInstruction created via another path — most notably stinkytofu-opt parsing assembly text, but also instructions created inside legalization passes — is missing its implicit special registers.

Technical Details

  • Extracted the logic into a shared helper legalizeImplicitSpecialRegisters(StinkyInstruction*, uint32_t wavefrontSize) in LegalizationUtils.{hpp,cpp}.
  • ToStinkyTofuUtils.cpp now calls the helper instead of the inline if-chain — behavior unchanged for the rocisa path.
  • StinkyBuildImplicitDependencyPass runs the helper on every instruction in every basic block, in addition to its existing LDS/MemTokenData handling.
  • Result: stinkytofu-opt (and any other pipeline that builds IR outside the rocisa converter) gets correct implicit SCC/VCC/EXEC operands by simply adding StinkyBuildImplicitDependencyPass.

Test Plan

Test Result

Submission Checklist

Copy link
Copy Markdown
Contributor

@cycheng cycheng left a comment

Choose a reason for hiding this comment

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

LGTM, few notes.

Comment thread shared/stinkytofu/src/transforms/asm/LegalizationUtils.cpp Outdated
Comment thread shared/stinkytofu/src/conversion/rocisa/ToStinkyTofuUtils.cpp Outdated
@pschang-phy pschang-phy force-pushed the users/pochang/implicit_special_registers branch 2 times, most recently from 182efe8 to 6c872c9 Compare May 12, 2026 03:45
Copy link
Copy Markdown
Contributor

@darrenhsieh-amd darrenhsieh-amd left a comment

Choose a reason for hiding this comment

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

LGTM

Comment thread shared/stinkytofu/src/conversion/rocisa/ToStinkyTofuUtils.cpp Outdated
@pschang-phy pschang-phy force-pushed the users/pochang/implicit_special_registers branch from 6c872c9 to 45514ab Compare May 12, 2026 06:36
for handling implicit special registers (SCC, VCC, EXEC) in instructions
And, use both in ToStinkyTofuUtils and StinkyBuildImplicitDependencyPass
@pschang-phy pschang-phy force-pushed the users/pochang/implicit_special_registers branch from 45514ab to d773a6f Compare May 12, 2026 07:36
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

❌ Your project status has failed because the head coverage (69.24%) is below the target coverage (80.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #7268   +/-   ##
========================================
  Coverage    64.36%   64.36%           
========================================
  Files          603      603           
  Lines       112196   112196           
  Branches     15498    15498           
========================================
  Hits         72205    72205           
  Misses       34724    34724           
  Partials      5267     5267           
Flag Coverage Δ *Carryforward flag
hipBLASLt 39.85% <ø> (ø)
hipDNN 85.56% <ø> (ø) Carriedforward from 171d97b
hipFFT 49.22% <ø> (ø) Carriedforward from 171d97b
hipSOLVER 69.24% <ø> (ø) Carriedforward from 171d97b
rocFFT 47.60% <ø> (ø) Carriedforward from 171d97b
rocRAND 57.02% <ø> (ø) Carriedforward from 171d97b

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

🚀 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.

@pschang-phy pschang-phy merged commit e3fe66d into develop May 13, 2026
42 checks passed
@pschang-phy pschang-phy deleted the users/pochang/implicit_special_registers branch May 13, 2026 02:29
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