mirror of
https://github.com/ROCm/ROCm.git
synced 2026-04-05 03:01:17 -04:00
[ANALYSIS] Fix divisibility calculation for addptr (#1453)
This commit is contained in:
@@ -220,7 +220,16 @@ private:
|
||||
// rhs = p * d_rhs = p * p' * gcd(d_lhs, d_rhs)
|
||||
// lhs + rhs = k * d_lhs + p * d_rhs = (k * d_lhs + p * d_rhs) *
|
||||
// gcd(d_lhs, d_rhs)
|
||||
return gcd(lhs.getDivisibility(dim), rhs.getDivisibility(dim));
|
||||
auto elemSize = 1;
|
||||
if constexpr (std::is_same_v<OpTy, triton::AddPtrOp>) {
|
||||
// %ptr = addptr %lhs, %rhs
|
||||
// is equivalent to
|
||||
// %0 = mul %lhs, %elemSize
|
||||
// %ptr = add %0, %rhs
|
||||
elemSize = std::max<unsigned int>(
|
||||
1, triton::getPointeeBitWidth(op.getPtr().getType()) / 8);
|
||||
}
|
||||
return gcd(lhs.getDivisibility(dim), rhs.getDivisibility(dim) * elemSize);
|
||||
}
|
||||
|
||||
int64_t getConstancy(OpTy op, const AxisInfo &lhs, const AxisInfo &rhs,
|
||||
|
||||
Reference in New Issue
Block a user