Skip to content

feat(rocke): add scalar optimization barrier APIs - #12165

Draft
tenpercent wants to merge 2 commits into
developfrom
users/mpodkory/rocke/optimization-barrier
Draft

tenpercent wants to merge 2 commits into
developfrom
users/mpodkory/rocke/optimization-barrier

Conversation

@tenpercent

@tenpercent tenpercent commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

ISSUE ID : AICK-2253

Kernel authors sometimes need an intermediate floating-point result to round before the next operation. Combining a multiply with an add or FP16 conversion can change that result.

Add IRBuilder.optimization_barrier(value) and rocke_b_optimization_barrier(builder, value). They return the same scalar value and type while preventing the compiler from combining operations across it. The implementation uses the existing inline-assembly operation; booleans and byte-sized values widen to i32 and then return to their original type.

This PR targets develop independently of the FP4 and NVFP4 work. It includes dedicated Python/C parity emitters, scalar bit-preservation and rounding tests, and documentation linked from the API index. The guide explains supported types, use of the returned value, and the difference from sched_barrier and memory/thread synchronization.

Validation:

  • Fresh gfx1250 build: 24 GPU tests passed through COMGR and HIP, with no skips. Includes mixed lane predicates, arbitrary scalar bit patterns, multiply-add rounding, and FP32-to-FP16 rounding.
  • Strict Python/C++ CPU tests: 36 passed, plus 25 subtests; 8 CTests passed.
  • Python/C++ LLVM parity: 71 families / 774 configurations for each of LLVM 20, 22, and 23. One initial LLVM 22 RMSNorm emitter timed out; its focused retry passed without code changes.
  • Repository hooks, relative-path guard, and diff check passed.

@therock-pr-bot

therock-pr-bot Bot commented Sep 16, 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

therock-pr-bot Bot commented Sep 16, 2026

Copy link
Copy Markdown

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

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