-
Notifications
You must be signed in to change notification settings - Fork 75
[AMDGPU] Use fmac_f64 in "if (cond) a -= c" #466
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: amd-staging
Are you sure you want to change the base?
Conversation
|
5% improvement in 450.md on MI350 (as expected) |
506f858 to
80498f5
Compare
michaelselehov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Conditional approve after QA performance testing.
See minor comments in the code.
| if (TrueConst) | ||
| return false; | ||
|
|
||
| // Check if select and the add/sub are in same loop context. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optional: Consider adding a comment explaining why we skip loop-invariant selects:
// Check if select and the add/sub are in same loop context.
// Even for loop-invariant select (which might get hoisted), we skip
// the optimization because it wouldn't provide benefit in the loop body
// (same 1 instruction, but worse register pressure: 2 vs 4+ registers).
if (MLI->getLoopFor(MI.getParent()) != MLI->getLoopFor(SelMI->getParent()))
return false;This will help future maintainers understand the reasoning.
| if (!FalseConst || !FalseConst->Value.isExactlyValue(0.0)) | ||
| return false; | ||
|
|
||
| // Check if TrueVal is not constant. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider updating the comment to reflect that constant support is deferred:
// Check if TrueVal is not constant.
// TODO: Support constants in a follow-up patch. Currently disabled due to
// codegen issues that need investigation.
if (TrueConst)
return false;|
|
||
| // New register. | ||
| LIS->createAndComputeVirtRegInterval(CondValueReg); | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optional: Add validation after LiveIntervals updates to catch potential issues early:
// Validate LiveIntervals after revert transformation
assert(LIS->verify() && "LiveIntervals verification failed after FMA revert");Note: Check if LIS has verify() or similar method. The -verify-machineinstrs tests should catch issues anyway, but an explicit assert helps with debugging.
PSDB only.