[Mlir-commits] [mlir] [mlir][spirv] Remove `enableFastMathMode` flag from SPIR-V conversion (PR #86578)
Scott Todd
llvmlistbot at llvm.org
Wed Mar 27 14:25:25 PDT 2024
================
@@ -8,7 +8,7 @@ module attributes {
// CHECK-SAME: %[[LHS:.+]]: f32, %[[RHS:.+]]: f32
func.func @cmpf_ordered(%arg0 : f32, %arg1 : f32) -> i1 {
// CHECK: %[[T:.+]] = spirv.Constant true
- %0 = arith.cmpf ord, %arg0, %arg1 : f32
+ %0 = arith.cmpf ord, %arg0, %arg1 fastmath<fast> : f32
----------------
ScottTodd wrote:
Is there a pass in upstream MLIR to add fastmath attributes to `arith` dialect ops?
We were using the spirv fast math mode downstream here: https://github.com/openxla/iree/blob/aacdd33eb57f79711ecae088dbb37c9bd17d7031/compiler/plugins/target/WebGPUSPIRV/WebGPUSPIRVTarget.cpp#L148-L159 . To adapt to this change, I think we'd want to add these attributes to all arith ops prior to running arith to spirv patterns here: https://github.com/openxla/iree/blob/aacdd33eb57f79711ecae088dbb37c9bd17d7031/compiler/src/iree/compiler/Codegen/SPIRV/ConvertToSPIRVPass.cpp#L655-L660.
So in our case, we start with modules that don't generally use fastmath, but then partway through our lowering process we specialize for one target that requires it. For that, we want this same "just use fast math" behavior, without needing to enumerate all possible ops that need an attribute ourselves.
https://github.com/llvm/llvm-project/pull/86578
More information about the Mlir-commits
mailing list