Skip to content

Commit c118864

Browse files
authored
[MLIR][ROCDL]Add MFMA_*_F8F6F4 instructions to the ROCDL dialect (#123830)
This PR adds mfma.scale.f32.32x32x64.f8f6f4 and mfma.scale.f32.16x16x128.f8f6f4 to the ROCDL dialect. They are converted to the corresponding intrinsics in the mlir-to-llvmir pass.
1 parent cb981cc commit c118864

File tree

3 files changed

+598
-2
lines changed

3 files changed

+598
-2
lines changed

mlir/include/mlir/Dialect/LLVMIR/ROCDLOps.td

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,18 @@ class ROCDL_Mfma_IntrOp<string mnemonic, list<Trait> traits = []> :
343343
"$args attr-dict `:` functional-type($args, $res)";
344344
}
345345

346+
//===---------------------------------------------------------------------===//
347+
// MFMA intrinsics with overloaded operands
348+
class ROCDL_Mfma_OO_IntrOp<string mnemonic, list<int> overloadedOperands,
349+
list<Trait> traits = []> :
350+
LLVM_IntrOpBase<ROCDL_Dialect, mnemonic,
351+
"amdgcn_" # !subst(".","_", mnemonic),
352+
[], overloadedOperands, traits, 1>,
353+
Arguments<(ins Variadic<LLVM_Type>:$args)> {
354+
let assemblyFormat =
355+
"$args attr-dict `:` functional-type($args, $res)";
356+
}
357+
346358
// Available on all CDNA.
347359
def ROCDL_mfma_f32_32x32x1f32 : ROCDL_Mfma_IntrOp<"mfma.f32.32x32x1f32">;
348360
def ROCDL_mfma_f32_16x16x1f32 : ROCDL_Mfma_IntrOp<"mfma.f32.16x16x1f32">;
@@ -394,7 +406,8 @@ def ROCDL_mfma_f32_16x16x32_f16 : ROCDL_Mfma_IntrOp<"mfma.f32.16x16x32.f16">;
394406
def ROCDL_mfma_f32_32x32x16_bf16 : ROCDL_Mfma_IntrOp<"mfma.f32.32x32x16.bf16">;
395407
def ROCDL_mfma_i32_32x32x32_i8 : ROCDL_Mfma_IntrOp<"mfma.i32.32x32x32.i8">;
396408
def ROCDL_mfma_f32_32x32x16_f16 : ROCDL_Mfma_IntrOp<"mfma.f32.32x32x16.f16">;
397-
409+
def ROCDL_mfma_scale_f32_16x16x128_f8f6f4 : ROCDL_Mfma_OO_IntrOp<"mfma.scale.f32.16x16x128.f8f6f4", [0,1]>;
410+
def ROCDL_mfma_scale_f32_32x32x64_f8f6f4 : ROCDL_Mfma_OO_IntrOp<"mfma.scale.f32.32x32x64.f8f6f4", [0,1]>;
398411
//===---------------------------------------------------------------------===//
399412
// WMMA intrinsics
400413
class ROCDL_Wmma_IntrOp<string mnemonic, list<int> overloadedOperands,

0 commit comments

Comments
 (0)