[Mlir-commits] [mlir] [mlir][AMDGPU] Rename gfx1250 packed extension ops, change firstScale… (PR #170718)
Erick Ochoa Lopez
llvmlistbot at llvm.org
Thu Dec 4 10:52:08 PST 2025
================
@@ -1627,34 +1628,35 @@ LogicalResult ExtPackedFp8OpLowering::matchAndRewrite(
return success();
}
-int32_t getScaleSel(int32_t blockSize, unsigned bitWidth,
- int32_t firstScaleLane, int32_t firstScaleByte) {
- // When lowering amdgpu.scaled_ext_packed816 to rocdl.cvt.scale.pk*.f*.f*
- // operations, the attributes blockSize, sourceType, firstScaleLane and
+int32_t getScaleSel(int32_t blockSize, unsigned bitWidth, int32_t scaleWaveHalf,
+ int32_t firstScaleByte) {
+ // When lowering amdgpu.scaled_ext_packed_matrix to rocdl.cvt.scale.pk*.f*.f*
+ // operations, the attributes blockSize, sourceType, scaleWaveHalf, and
// firstScaleByte are merged into a single attribute scaleSel. This is how
- // those values are merged together.
+ // those values are merged together. (Note: scaleWaveHalf isn't a high-level
+ // attribute but is derifed from firstScaleLane).
assert(llvm::is_contained({16, 32}, blockSize));
assert(llvm::is_contained(llvm::ArrayRef<unsigned>{4, 6, 8}, bitWidth));
- const bool is_fp8 = bitWidth == 8;
- const bool is_block_16 = blockSize == 16;
+ const bool isFp8 = bitWidth == 8;
+ const bool isBlock16 = blockSize == 16;
- if (!is_fp8) {
- int bit_0 = is_block_16;
+ if (!isFp8) {
+ int32_t bit0 = isBlock16;
assert(llvm::is_contained({0, 1, 2}, firstScaleByte));
- int bit_1 = (firstScaleByte == 2) << 1;
+ int32_t bit1 = (firstScaleByte == 2) << 1;
assert(llvm::is_contained({0, 1}, firstScaleLane));
- int bit_2 = firstScaleLane << 2;
- return bit_2 | bit_1 | bit_0;
+ int32_t bit2 = scaleWaveHalf << 2;
+ return bit2 | bit1 | bit0;
}
- int bit_0 = is_block_16;
+ int32_t bit0 = isBlock16;
// firstScaleByte is guaranteed to be defined by two bits.
assert(llvm::is_contained({0, 1, 2, 3}, firstScaleByte));
- int bit_2_and_1 = firstScaleByte << 1;
+ int32_t bits2and1 = firstScaleByte << 1;
assert(llvm::is_contained({0, 1}, firstScaleLane));
----------------
amd-eochoalo wrote:
```suggestion
assert(llvm::is_contained({0, 1}, scaleWaveHalf));
```
https://github.com/llvm/llvm-project/pull/170718
More information about the Mlir-commits
mailing list