[Mlir-commits] [mlir] [mlir][nvgpu] add `nvgpu.rcp` op (PR #100965)

Guray Ozen llvmlistbot at llvm.org
Sun Jul 28 23:59:12 PDT 2024


================
@@ -20,6 +20,7 @@
 #ifndef NVGPU
 #define NVGPU
 
+include "mlir/Interfaces/InferTypeOpInterface.td"
----------------
grypp wrote:

My point was about inferring the result type. When someone sees an IR like `%out = nvgpu.rcp_approx %in : vector<32x16xf32>`, the return type is unclear, making the IR unreadable. To understand the return type, one would need to look at the TableGen definition of the operation or read the C++ implementation.

```
// Current OP, unclear what is %out
%out = nvgpu.rcp_approx %in : vector<32x16xf32> 
// This is my proposal, it's clear what is %out
%out = nvgpu.rcp_approx %in : vector<32x16xf32> -> vector<32x16xf32>
```

You could use `PredOpTrait` or `SameOperandsAndResultType`, or handle it in the verifier. Does `SameOperandsAndResultType` forces to infer result type?

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


More information about the Mlir-commits mailing list