[PATCH] D142262: [AMDGPU] Use std::clamp to avoid overflow in the scheduler
Matt Arsenault via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 20 18:29:41 PST 2023
arsenm added inline comments.
================
Comment at: llvm/lib/Target/AMDGPU/GCNSchedStrategy.cpp:93
SGPRCriticalLimit =
- std::min(SGPRCriticalLimit - SGPRLimitBias, SGPRCriticalLimit);
- SGPRCriticalLimit =
- std::min(SGPRCriticalLimit - ErrorMargin, SGPRCriticalLimit);
- VGPRCriticalLimit =
- std::min(VGPRCriticalLimit - VGPRLimitBias, VGPRCriticalLimit);
+ SGPRCriticalLimit -
+ std::clamp(SGPRLimitBias + ErrorMargin, 0u, SGPRCriticalLimit);
----------------
clamp with min of 0 seems weird. Also could use -=
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D142262/new/
https://reviews.llvm.org/D142262
More information about the llvm-commits
mailing list