[clang] [llvm] [AMDGPU] Fix monitor-sleep duration validation on GFX12.5 (PR #241042)
Yaxun Liu via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 11 05:03:43 PST 2026
================
@@ -248,17 +248,18 @@ bool AMDGPULowerIntrinsicsImpl::visitMonitorSleep(IntrinsicInst &I) {
assert(I.getIntrinsicID() == Intrinsic::amdgcn_s_monitor_sleep);
const GCNSubtarget &ST = TM.getSubtarget<GCNSubtarget>(*I.getFunction());
- if (!ST.hasNoSleepForever())
- return false;
-
- int Sleep = cast<ConstantInt>(I.getArgOperand(0))->getSExtValue();
- if (!(Sleep & 0x8000))
+ unsigned Sleep = cast<ConstantInt>(I.getArgOperand(0))->getZExtValue();
+ unsigned NewSleep;
+ if (ST.hasNoSleepForever() && (Sleep & 0x8000)) {
+ NewSleep = 127;
+ } else if (ST.hasMonitorSleep7BitDuration() && (Sleep & 0x7f80)) {
+ NewSleep = (Sleep & 0x8000) | 127;
----------------
yxsamliu wrote:
Moved the new duration check to the target verifier. The existing sleep-forever fallback stays.
https://github.com/llvm/llvm-project/pull/241042
More information about the cfe-commits
mailing list