[Mlir-commits] [mlir] [mlir][ArithToAMDGPU] Add option for saturating truncation to fp8 (PR #74153)

Jakub Kuderski llvmlistbot at llvm.org
Tue Jan 9 20:36:25 PST 2024


================
@@ -127,6 +130,60 @@ static Value castToF32(Value value, Location loc, PatternRewriter &rewriter) {
   llvm_unreachable("The only 32-bit float type is f32");
 }
 
+static Value getMaybeVectorConstant(PatternRewriter &rewriter, Location loc,
+                                    const APFloat &value, Type type) {
----------------
kuhar wrote:

nit: `Maybe` reads to me like this could fail, but this is not the case. We have a similar helper in the other arith code where it's called `createScalarOrSplatConstant`:
https://github.com/llvm/llvm-project/blob/a9f39ff2b628e38826d5b95c1e8ae3cb7c692de9/mlir/lib/Dialect/Arith/Transforms/EmulateWideInt.cpp#L62-L74

https://github.com/llvm/llvm-project/pull/74153


More information about the Mlir-commits mailing list