[Mlir-commits] [mlir] [mlir][AMDGPU] Add support for AMD f16 math library calls (PR #108809)
Nirvedh Meshram
llvmlistbot at llvm.org
Thu Sep 19 11:04:18 PDT 2024
================
@@ -89,7 +91,14 @@ struct OpToFuncCallLowering : public ConvertOpToLLVMPattern<SourceOp> {
private:
Value maybeCast(Value operand, PatternRewriter &rewriter) const {
Type type = operand.getType();
- if (!isa<Float16Type>(type))
+ if (!isa<FloatType>(type))
+ return operand;
+
+ // if there's a f16 function, no need to cast f16 values
+ if (!f16Func.empty() && isa<Float16Type>(type))
+ return operand;
+
+ if (isa<Float64Type>(type) || isa<Float32Type>(type))
----------------
nirvedhmeshram wrote:
wont this also cast for other non f16/f32/f64 types?
I think you just want to modify the exisiting check to
```
// if there's a f16 function, no need to cast f16 values
if (!isa<Float16Type>(type) || !f16Func.empty())
return operand;
```
and leave rest of the logic as is?
https://github.com/llvm/llvm-project/pull/108809
More information about the Mlir-commits
mailing list