[Mlir-commits] [mlir] [MLIR][GPU] Support bf16 and i1 gpu::shuffles to LLVMSPIRV conversion (PR #119675)
Jakub Kuderski
llvmlistbot at llvm.org
Thu Jan 2 09:28:44 PST 2025
================
@@ -286,30 +291,94 @@ struct GPUShuffleConversion final : ConvertOpToLLVMPattern<gpu::ShuffleOp> {
val == getSubgroupSize(op);
}
+ static bool needsBitCastOrExt(gpu::ShuffleOp op) {
+ Type type = op.getType(0);
+ return isa<BFloat16Type>(type) || type.isInteger(1);
+ }
+
+ static Type getBitCastOrExtTy(Type oldTy,
+ ConversionPatternRewriter &rewriter) {
+ return TypeSwitch<Type, Type>(oldTy)
+ .Case<BFloat16Type>([&](auto) { return rewriter.getIntegerType(16); })
+ .Case<IntegerType>([&](auto intTy) -> Type {
----------------
kuhar wrote:
nit: I don't see why these need to be generic over the argument type
```suggestion
.Case<BFloat16Type>([&](Type) { return rewriter.getIntegerType(16); })
.Case<IntegerType>([&](IntegerType intTy) -> Type {
```
https://github.com/llvm/llvm-project/pull/119675
More information about the Mlir-commits
mailing list