[Mlir-commits] [mlir] [MLIR][NVVM] Update redux.sync op (PR #166125)

Durgadoss R llvmlistbot at llvm.org
Mon Nov 3 01:51:05 PST 2025


================
@@ -0,0 +1,41 @@
+// RUN: mlir-translate -verify-diagnostics -split-input-file -mlir-to-llvmir %s
+
+// -----
+
+llvm.func @redux_sync_i32_with_abs(%value: i32, %offset: i32) {
+  // expected-error at +1 {{abs attribute is supported only for f32 type}}
+  %res = nvvm.redux.sync add %value, %offset {abs = true}: i32 -> i32
+  llvm.return
+}
+
+// -----
+
+llvm.func @redux_sync_i32_with_nan(%value: i32, %offset: i32) {
+  // expected-error at +1 {{nan attribute is supported only for f32 type}}
+  %res = nvvm.redux.sync add %value, %offset {nan = true}: i32 -> i32
+  llvm.return
+}
+
+// -----
+
+llvm.func @redux_sync_f32_with_invalid_kind(%value: f32, %offset: i32) {
+  // expected-error at +1 {{only fmin and fmax redux kinds are supported for f32 type}}
+  %res = nvvm.redux.sync add %value, %offset: f32 -> f32
+  llvm.return
+}
+
+// -----
+
+llvm.func @redux_sync_i32_with_invalid_kind(%value: i32, %offset: i32) {
+  // expected-error at +1 {{fmin and fmax redux kind must be used with f32 type}}
----------------
durga4github wrote:

I wonder if we can do a slightly better error message for this and the above test:

```
'add' redux kind unsupported with i32 type. Supported ones are: a,b,c

similarly,
`xyz' redux kind unsupported with f32 type. Supported ones are: fmin,fmax
```

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


More information about the Mlir-commits mailing list