[llvm-branch-commits] [mlir] [MLIR][TOSA] Test elementwise select lowering (PR #221387)

Taufiq Rahman via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Sep 4 21:40:41 PDT 2026


https://github.com/Inconnu08 created https://github.com/llvm/llvm-project/pull/221387

Depends on #220916.

Adds explicit FileCheck coverage for the TOSA `reduce_min` and `reduce_max`
`nan_mode=IGNORE` lowering to `linalg.elementwise` select.

This addresses the missing TOSA-to-Linalg elementwise coverage noted in #221267.

Related to #221267.

Assisted-by: ChatGPT

>From 0a0f6d3e2450eaf6d0c892097a5c2d3d591d808a Mon Sep 17 00:00:00 2001
From: inconnu08 <taufiqrx8 at gmail.com>
Date: Sat, 5 Sep 2026 00:28:03 -0400
Subject: [PATCH] [MLIR][TOSA] Test elementwise select lowering

---
 mlir/test/Conversion/TosaToLinalg/tosa-to-linalg.mlir | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mlir/test/Conversion/TosaToLinalg/tosa-to-linalg.mlir b/mlir/test/Conversion/TosaToLinalg/tosa-to-linalg.mlir
index a803ee7d99153..485a53032a3b5 100644
--- a/mlir/test/Conversion/TosaToLinalg/tosa-to-linalg.mlir
+++ b/mlir/test/Conversion/TosaToLinalg/tosa-to-linalg.mlir
@@ -2438,7 +2438,7 @@ func.func @reduce_min_nan_ignore(%arg0: tensor<5x4xf32>, %arg1: tensor<5x4xf32>)
   // CHECK: tensor.empty()
   // CHECK: linalg.fill
   // CHECK: tensor.empty()
-  // CHECK: select
+  // CHECK: linalg.elementwise kind=#linalg.elementwise_kind<select>
   %5 = tosa.reduce_min %arg0 {axis = 0 : i32, nan_mode = IGNORE} : (tensor<5x4xf32>) -> tensor<1x4xf32>
   return
 }
@@ -2456,7 +2456,7 @@ func.func @reduce_max_nan_ignore(%arg0: tensor<5x4xf32>, %arg1: tensor<5x4xf32>)
   // CHECK: tensor.empty()
   // CHECK: linalg.fill
   // CHECK: tensor.empty()
-  // CHECK: select
+  // CHECK: linalg.elementwise kind=#linalg.elementwise_kind<select>
   %6 = tosa.reduce_max %arg0 {axis = 0 : i32, nan_mode = IGNORE} : (tensor<5x4xf32>) -> tensor<1x4xf32>
   return
 }



More information about the llvm-branch-commits mailing list