Skip to content

[mlir][tosa] Add several level checks #128074

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 3, 2025
Merged

Conversation

tatwaichong
Copy link
Contributor

@tatwaichong tatwaichong commented Feb 20, 2025

Add the following types of level check to consolidate the level validity

  • Complete rank level checks for operations.
  • Add MAX_LOG2_SIZE level check: The maximum value is 63 when the
    level is set to "none" and 31 when the level is set to "8K".
  • Add MAX_TENSOR_LIST_SIZE level check : The maximum value is 256
    when the level is set to "none" and 64 when the level is set to "8K".
  • TOSA 1.0 spec does not allow operations with dynamic shapes, so
    an error should be raised instead

Co-authored-by: TatWai Chong [email protected]

@llvmbot
Copy link
Member

llvmbot commented Feb 20, 2025

@llvm/pr-subscribers-mlir-tosa

@llvm/pr-subscribers-mlir

Author: TatWai Chong (tatwaichong)

Changes

Add the following types of level check to consolidate the level validity

  • Add rank level checks for Erf, Cos, and Sin.
  • Add MAX_LOG2_SIZE level check: The maximum value is 63 when the level is set to "none" and 31 when the level is set to "8K".
  • Add MAX_TENSOR_LIST_SIZE level check : The maximum value is 256 when the level is set to "none" and 64 when the level is set to "8K".
  • Add lit tests.

Change-Id: I797fafe504219e43950824c04839c7187065fe8e


Patch is 45.84 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/128074.diff

2 Files Affected:

  • (modified) mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp (+151-69)
  • (modified) mlir/test/Dialect/Tosa/level_check.mlir (+590-2)
diff --git a/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp b/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp
index f74a4b4c58b80..f8e788c0497fd 100644
--- a/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp
+++ b/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp
@@ -70,17 +70,22 @@ struct TosaLevel {
   int32_t MAX_KERNEL = 0;
   int32_t MAX_STRIDE = 0;
   int32_t MAX_SCALE = 0;
-
-  // @todo: MAX_LOG2_SIZE value and checks
+  int32_t MAX_LOG2_SIZE = 0;
+  int32_t MAX_NESTING = 0;
+  int32_t MAX_TENSOR_LIST_SIZE = 0;
 
   bool operator==(const TosaLevel &rhs) {
     return MAX_RANK == rhs.MAX_RANK && MAX_KERNEL == rhs.MAX_KERNEL &&
-           MAX_STRIDE == rhs.MAX_STRIDE && MAX_SCALE == rhs.MAX_SCALE;
+           MAX_STRIDE == rhs.MAX_STRIDE && MAX_SCALE == rhs.MAX_SCALE &&
+           MAX_LOG2_SIZE == rhs.MAX_LOG2_SIZE &&
+           MAX_NESTING == rhs.MAX_NESTING &&
+           MAX_TENSOR_LIST_SIZE == rhs.MAX_TENSOR_LIST_SIZE;
   }
 };
 
-static constexpr TosaLevel TOSA_LEVEL_EIGHTK = {6, 8192, 8192, 256};
-static constexpr TosaLevel TOSA_LEVEL_NONE = {0, 0, 0, 0};
+static constexpr TosaLevel TOSA_LEVEL_EIGHTK = {6, 8192, 8192, 256, 31, 6, 64};
+static constexpr TosaLevel TOSA_LEVEL_NONE = {32, 2147483647, 2147483647, 2048,
+                                              63, 256,        256};
 
 //===----------------------------------------------------------------------===//
 // TOSA Validation Pass.
@@ -147,107 +152,149 @@ struct TosaValidation : public tosa::impl::TosaValidationBase<TosaValidation> {
     return true;
   }
 
-  bool levelCheckRank(Operation *op, const Value &v,
-                      const std::string &checkDesc) {
+  bool levelCheckListSize(Operation *op, int32_t v,
+                          const std::string &checkDesc) {
+    if (v > tosaLevel.MAX_TENSOR_LIST_SIZE) {
+      op->emitOpError() << "failed level check for MAX_TENSOR_LIST_SIZE: "
+                        << checkDesc;
+      return false;
+    }
+    return true;
+  }
+
+  bool levelCheckRankAndSizes(Operation *op, const Value &v,
+                              const std::string &operandOrResult) {
     if (ShapedType type = dyn_cast<ShapedType>(v.getType())) {
       if (!type.hasRank()) {
         op->emitOpError() << "failed level check: unranked tensor";
         return false;
       }
       if (type.getRank() > tosaLevel.MAX_RANK) {
-        op->emitOpError() << "failed level check: " << checkDesc;
+        op->emitOpError() << "failed level check: " << operandOrResult
+                          << " rank(shape) <= MAX_RANK";
         return false;
       }
+
+      const int64_t max_dim = (1L << tosaLevel.MAX_LOG2_SIZE) - 1;
+      const int64_t max_size = (1L << (tosaLevel.MAX_LOG2_SIZE + 1)) - 1;
+
+      auto shape = type.getShape();
+      bool has_dynamic = false;
+      for (auto dim : shape) {
+        if (mlir::ShapedType::isDynamic(dim)) {
+          has_dynamic = true;
+          continue;
+        }
+        if (dim > max_dim) {
+          op->emitOpError() << "failed level check: " << operandOrResult
+                            << " shape dimension <= (1<<MAX_LOG2_SIZE) - 1";
+          return false;
+        }
+      }
+      if (!has_dynamic) {
+        int64_t element_bits = type.getElementTypeBitWidth();
+        int64_t element_bytes = std::max(1L, element_bits / 8);
+        int64_t size = element_bytes * type.getNumElements();
+        if (size > max_size) {
+          op->emitOpError()
+              << "failed level check: " << operandOrResult
+              << " tensor size (in bytes) <= (1<<MAX_LOG2_SIZE+1) - 1";
+          return false;
+        }
+      }
     }
     return true;
   }
 
   template <typename T>
-  bool levelCheckRanksFor(Operation *op) {
+  bool levelCheckRanksAndSizesFor(Operation *op) {
     if (dyn_cast<T>(op)) {
       // level check ranks of all operands and results
       for (auto v : op->getOperands()) {
-        if (!levelCheckRank(op, v, "operand rank(shape) <= MAX_RANK"))
+        if (!levelCheckRankAndSizes(op, v, "operand"))
           return false;
       }
       for (auto v : op->getResults()) {
-        if (!levelCheckRank(op, v, "result rank(shape) <= MAX_RANK"))
+        if (!levelCheckRankAndSizes(op, v, "result"))
           return false;
       }
     }
     return true;
   }
 
-  bool levelCheckRanks(Operation *op) {
-#define CHECK_RANKS_FOR(tosaOp)                                                \
-  if (!levelCheckRanksFor<tosaOp##Op>(op))                                     \
+  bool levelCheckRanksAndSizes(Operation *op) {
+#define CHECK_RANKS_AND_SIZES_FOR(tosaOp)                                      \
+  if (!levelCheckRanksAndSizesFor<tosaOp##Op>(op))                             \
     return false;
 
     // tensor operators:
-    CHECK_RANKS_FOR(ArgMax);
+    CHECK_RANKS_AND_SIZES_FOR(ArgMax);
     // all activation functions:
-    CHECK_RANKS_FOR(Clamp);
-    CHECK_RANKS_FOR(Sigmoid);
-    CHECK_RANKS_FOR(Tanh);
+    CHECK_RANKS_AND_SIZES_FOR(Clamp);
+    CHECK_RANKS_AND_SIZES_FOR(Erf);
+    CHECK_RANKS_AND_SIZES_FOR(Sigmoid);
+    CHECK_RANKS_AND_SIZES_FOR(Tanh);
     // all elementwise binary operators:
-    CHECK_RANKS_FOR(Add);
-    CHECK_RANKS_FOR(ArithmeticRightShift);
-    CHECK_RANKS_FOR(BitwiseAnd);
-    CHECK_RANKS_FOR(BitwiseOr);
-    CHECK_RANKS_FOR(BitwiseXor);
-    CHECK_RANKS_FOR(IntDiv);
-    CHECK_RANKS_FOR(LogicalAnd);
-    CHECK_RANKS_FOR(LogicalLeftShift);
-    CHECK_RANKS_FOR(LogicalRightShift);
-    CHECK_RANKS_FOR(LogicalOr);
-    CHECK_RANKS_FOR(LogicalXor);
-    CHECK_RANKS_FOR(Maximum);
-    CHECK_RANKS_FOR(Minimum);
-    CHECK_RANKS_FOR(Mul);
-    CHECK_RANKS_FOR(Pow);
-    CHECK_RANKS_FOR(Sub);
-    CHECK_RANKS_FOR(Table);
+    CHECK_RANKS_AND_SIZES_FOR(Add);
+    CHECK_RANKS_AND_SIZES_FOR(ArithmeticRightShift);
+    CHECK_RANKS_AND_SIZES_FOR(BitwiseAnd);
+    CHECK_RANKS_AND_SIZES_FOR(BitwiseOr);
+    CHECK_RANKS_AND_SIZES_FOR(BitwiseXor);
+    CHECK_RANKS_AND_SIZES_FOR(IntDiv);
+    CHECK_RANKS_AND_SIZES_FOR(LogicalAnd);
+    CHECK_RANKS_AND_SIZES_FOR(LogicalLeftShift);
+    CHECK_RANKS_AND_SIZES_FOR(LogicalRightShift);
+    CHECK_RANKS_AND_SIZES_FOR(LogicalOr);
+    CHECK_RANKS_AND_SIZES_FOR(LogicalXor);
+    CHECK_RANKS_AND_SIZES_FOR(Maximum);
+    CHECK_RANKS_AND_SIZES_FOR(Minimum);
+    CHECK_RANKS_AND_SIZES_FOR(Mul);
+    CHECK_RANKS_AND_SIZES_FOR(Pow);
+    CHECK_RANKS_AND_SIZES_FOR(Sub);
+    CHECK_RANKS_AND_SIZES_FOR(Table);
     // all elementwise unary operators:
-    CHECK_RANKS_FOR(Abs);
-    CHECK_RANKS_FOR(BitwiseNot);
-    CHECK_RANKS_FOR(Ceil);
-    CHECK_RANKS_FOR(Clz);
-    CHECK_RANKS_FOR(Exp);
-    CHECK_RANKS_FOR(Floor);
-    CHECK_RANKS_FOR(Log);
-    CHECK_RANKS_FOR(LogicalNot);
-    CHECK_RANKS_FOR(Negate);
-    CHECK_RANKS_FOR(Reciprocal);
-    CHECK_RANKS_FOR(Rsqrt);
+    CHECK_RANKS_AND_SIZES_FOR(Abs);
+    CHECK_RANKS_AND_SIZES_FOR(BitwiseNot);
+    CHECK_RANKS_AND_SIZES_FOR(Ceil);
+    CHECK_RANKS_AND_SIZES_FOR(Clz);
+    CHECK_RANKS_AND_SIZES_FOR(Cos);
+    CHECK_RANKS_AND_SIZES_FOR(Exp);
+    CHECK_RANKS_AND_SIZES_FOR(Floor);
+    CHECK_RANKS_AND_SIZES_FOR(Log);
+    CHECK_RANKS_AND_SIZES_FOR(LogicalNot);
+    CHECK_RANKS_AND_SIZES_FOR(Negate);
+    CHECK_RANKS_AND_SIZES_FOR(Reciprocal);
+    CHECK_RANKS_AND_SIZES_FOR(Rsqrt);
+    CHECK_RANKS_AND_SIZES_FOR(Sin);
     // all elementwise ternary operators:
-    CHECK_RANKS_FOR(Select);
+    CHECK_RANKS_AND_SIZES_FOR(Select);
     // all comparison operators:
-    CHECK_RANKS_FOR(Equal);
-    CHECK_RANKS_FOR(Greater);
-    CHECK_RANKS_FOR(GreaterEqual);
+    CHECK_RANKS_AND_SIZES_FOR(Equal);
+    CHECK_RANKS_AND_SIZES_FOR(Greater);
+    CHECK_RANKS_AND_SIZES_FOR(GreaterEqual);
     // all reduction operators:
-    CHECK_RANKS_FOR(ReduceAll);
-    CHECK_RANKS_FOR(ReduceAny);
-    CHECK_RANKS_FOR(ReduceMax);
-    CHECK_RANKS_FOR(ReduceMin);
-    CHECK_RANKS_FOR(ReduceProd);
-    CHECK_RANKS_FOR(ReduceSum);
+    CHECK_RANKS_AND_SIZES_FOR(ReduceAll);
+    CHECK_RANKS_AND_SIZES_FOR(ReduceAny);
+    CHECK_RANKS_AND_SIZES_FOR(ReduceMax);
+    CHECK_RANKS_AND_SIZES_FOR(ReduceMin);
+    CHECK_RANKS_AND_SIZES_FOR(ReduceProd);
+    CHECK_RANKS_AND_SIZES_FOR(ReduceSum);
     // all data layout operators:
-    CHECK_RANKS_FOR(Concat);
-    CHECK_RANKS_FOR(Pad);
-    CHECK_RANKS_FOR(Reshape);
-    CHECK_RANKS_FOR(Reverse);
-    CHECK_RANKS_FOR(Slice);
-    CHECK_RANKS_FOR(Tile);
-    CHECK_RANKS_FOR(Transpose);
+    CHECK_RANKS_AND_SIZES_FOR(Concat);
+    CHECK_RANKS_AND_SIZES_FOR(Pad);
+    CHECK_RANKS_AND_SIZES_FOR(Reshape);
+    CHECK_RANKS_AND_SIZES_FOR(Reverse);
+    CHECK_RANKS_AND_SIZES_FOR(Slice);
+    CHECK_RANKS_AND_SIZES_FOR(Tile);
+    CHECK_RANKS_AND_SIZES_FOR(Transpose);
     // all type conversion operators:
-    CHECK_RANKS_FOR(Cast);
-    CHECK_RANKS_FOR(Rescale);
+    CHECK_RANKS_AND_SIZES_FOR(Cast);
+    CHECK_RANKS_AND_SIZES_FOR(Rescale);
     // all data nodes operators:
-    CHECK_RANKS_FOR(Const);
-    CHECK_RANKS_FOR(Identity);
+    CHECK_RANKS_AND_SIZES_FOR(Const);
+    CHECK_RANKS_AND_SIZES_FOR(Identity);
 
-#undef CHECK_RANKS_FOR
+#undef CHECK_RANKS_AND_SIZES_FOR
     return true;
   }
 
@@ -396,6 +443,32 @@ struct TosaValidation : public tosa::impl::TosaValidationBase<TosaValidation> {
     return true;
   }
 
+  bool levelCheckListSize(Operation *op) {
+    if (auto concat = dyn_cast<tosa::ConcatOp>(op)) {
+      return levelCheckListSize(op, concat.getInput1().size(), "input1");
+    }
+    if (auto custom = dyn_cast<tosa::CustomOp>(op)) {
+      if (!levelCheckListSize(op, custom.getInputList().size(), "input_list") ||
+          !levelCheckListSize(op, custom.getOutputList().size(),
+                              "output_list")) {
+        return false;
+      }
+    }
+    if (auto condIf = dyn_cast<tosa::IfOp>(op)) {
+      if (!levelCheckListSize(op, condIf.getInputs().size(), "inputs") ||
+          !levelCheckListSize(op, condIf.getOutput().size(), "outputs")) {
+        return false;
+      }
+    }
+    if (auto w = dyn_cast<tosa::WhileOp>(op)) {
+      if (!levelCheckListSize(op, w.getInputs().size(), "inputs") ||
+          !levelCheckListSize(op, w.getOutput().size(), "outputs")) {
+        return false;
+      }
+    }
+    return true;
+  }
+
   // configure profile and level values from pass options profileName and
   // levelName
   void configLevelAndProfile() {
@@ -449,7 +522,7 @@ LogicalResult TosaValidation::applyLevelCheck(Operation *op) {
     return success();
   }
 
-  if (!levelCheckRanks(op)) {
+  if (!levelCheckRanksAndSizes(op)) {
     return failure();
   }
 
@@ -465,6 +538,11 @@ LogicalResult TosaValidation::applyLevelCheck(Operation *op) {
     return failure();
   }
 
+  // level check MAX_TENSOR_LIST_SIZE
+  if (!levelCheckListSize(op)) {
+    return failure();
+  }
+
   return success();
 }
 
@@ -695,6 +773,10 @@ LogicalResult TosaValidation::applyErrorIfCheck(Operation *op) {
 }
 
 bool TosaValidation::isValidElementType(Type type) {
+  if (auto quantType =
+      llvm::dyn_cast<mlir::quant::QuantizedType>(type))
+    type = quantType.getStorageType();
+
   if (isa<FloatType>(type)) {
     return type.isF32() || type.isF16() || type.isBF16();
   } else if (auto intTy = dyn_cast<IntegerType>(type)) {
diff --git a/mlir/test/Dialect/Tosa/level_check.mlir b/mlir/test/Dialect/Tosa/level_check.mlir
index 90c4551564d1e..74e71dd8d1c19 100644
--- a/mlir/test/Dialect/Tosa/level_check.mlir
+++ b/mlir/test/Dialect/Tosa/level_check.mlir
@@ -2,7 +2,7 @@
 // Enable all supported profiles and extensions to focus the verification of expected level errors.
 //--------------------------------------------------------------------------------------------------
 
-// RUN: mlir-opt %s -split-input-file -verify-diagnostics --tosa-validate="profile=pro_int,pro_fp,mt extension=int16,int4,bf16,fp8e4m3,fp8e5m2,fft,variable"
+// RUN: mlir-opt %s -split-input-file -verify-diagnostics --tosa-validate="profile=pro_int,pro_fp extension=int16,int4,bf16,fp8e4m3,fp8e5m2,fft,variable"
 
 func.func @test_argmax(%arg0: tensor<1x1x1x1x29x29x4xf32>) -> tensor<1x1x1x1x29x4xi32> {
   // expected-error@+1 {{'tosa.argmax' op failed level check: operand rank(shape) <= MAX_RANK}}
@@ -12,6 +12,311 @@ func.func @test_argmax(%arg0: tensor<1x1x1x1x29x29x4xf32>) -> tensor<1x1x1x1x29x
 
 // -----
 
+func.func @test_clamp(%arg0: tensor<1x1x1x1x13x21x3xf32>) -> tensor<1x1x1x1x13x21x3xf32> {
+  // expected-error@+1 {{'tosa.clamp' op failed level check: operand rank(shape) <= MAX_RANK}}
+  %0 = tosa.clamp %arg0 {min_val = -3.40282347E+38 : f32, max_val = 3.40282347E+38 : f32} : (tensor<1x1x1x1x13x21x3xf32>) -> tensor<1x1x1x1x13x21x3xf32>
+  return %0 : tensor<1x1x1x1x13x21x3xf32>
+}
+
+// -----
+
+func.func @test_erf(%arg0: tensor<1x1x1x1x13x21x3xf32>) -> tensor<1x1x1x1x13x21x3xf32> {
+  // expected-error@+1 {{'tosa.erf' op failed level check: operand rank(shape) <= MAX_RANK}}
+  %0 = tosa.erf %arg0 : (tensor<1x1x1x1x13x21x3xf32>) -> tensor<1x1x1x1x13x21x3xf32>
+  return %0 : tensor<1x1x1x1x13x21x3xf32>
+}
+
+// -----
+
+func.func @test_sigmoid(%arg0: tensor<1x1x1x1x13x21x3xf32>) -> tensor<1x1x1x1x13x21x3xf32> {
+  // expected-error@+1 {{'tosa.sigmoid' op failed level check: operand rank(shape) <= MAX_RANK}}
+  %0 = tosa.sigmoid %arg0 : (tensor<1x1x1x1x13x21x3xf32>) -> tensor<1x1x1x1x13x21x3xf32>
+  return %0 : tensor<1x1x1x1x13x21x3xf32>
+}
+
+// -----
+
+func.func @test_tanh(%arg0: tensor<1x1x1x1x13x21x3xf32>) -> tensor<1x1x1x1x13x21x3xf32> {
+  // expected-error@+1 {{'tosa.tanh' op failed level check: operand rank(shape) <= MAX_RANK}}
+  %0 = tosa.tanh %arg0 : (tensor<1x1x1x1x13x21x3xf32>) -> tensor<1x1x1x1x13x21x3xf32>
+  return %0 : tensor<1x1x1x1x13x21x3xf32>
+}
+
+// -----
+
+func.func @test_add(%arg0: tensor<1x1x1x1x13x21x3xf32>, %arg1: tensor<1x1x1x1x13x21x3xf32>) -> tensor<1x1x1x1x13x21x3xf32> {
+  // expected-error@+1 {{'tosa.add' op failed level check: operand rank(shape) <= MAX_RANK}}
+  %0 = tosa.add %arg0, %arg1 : (tensor<1x1x1x1x13x21x3xf32>, tensor<1x1x1x1x13x21x3xf32>) -> tensor<1x1x1x1x13x21x3xf32>
+  return %0 : tensor<1x1x1x1x13x21x3xf32>
+}
+
+// -----
+
+func.func @test_arithmetic_right_shift(%arg0: tensor<1x1x1x1x13x21x3xf32>, %arg1: tensor<1x1x1x1x13x21x3xf32>) -> tensor<1x1x1x1x13x21x3xf32> {
+  // expected-error@+1 {{'tosa.arithmetic_right_shift' op failed level check: operand rank(shape) <= MAX_RANK}}
+  %0 = tosa.arithmetic_right_shift %arg0, %arg1 {round = false} : (tensor<1x1x1x1x13x21x3xf32>, tensor<1x1x1x1x13x21x3xf32>) -> tensor<1x1x1x1x13x21x3xf32>
+  return %0 : tensor<1x1x1x1x13x21x3xf32>
+}
+
+// -----
+
+func.func @test_bitwise_and(%arg0: tensor<1x1x1x1x13x21x3xi32>, %arg1: tensor<1x1x1x1x13x21x3xi32>) -> tensor<1x1x1x1x13x21x3xi32> {
+  // expected-error@+1 {{'tosa.bitwise_and' op failed level check: operand rank(shape) <= MAX_RANK}}
+  %0 = tosa.bitwise_and %arg0, %arg1 : (tensor<1x1x1x1x13x21x3xi32>, tensor<1x1x1x1x13x21x3xi32>) -> tensor<1x1x1x1x13x21x3xi32>
+  return %0 : tensor<1x1x1x1x13x21x3xi32>
+}
+
+// -----
+
+func.func @test_bitwise_or(%arg0: tensor<1x1x1x1x13x21x3xi32>, %arg1: tensor<1x1x1x1x13x21x3xi32>) -> tensor<1x1x1x1x13x21x3xi32> {
+  // expected-error@+1 {{'tosa.bitwise_or' op failed level check: operand rank(shape) <= MAX_RANK}}
+  %0 = tosa.bitwise_or %arg0, %arg1 : (tensor<1x1x1x1x13x21x3xi32>, tensor<1x1x1x1x13x21x3xi32>) -> tensor<1x1x1x1x13x21x3xi32>
+  return %0 : tensor<1x1x1x1x13x21x3xi32>
+}
+
+// -----
+
+func.func @test_bitwise_xor(%arg0: tensor<1x1x1x1x13x21x3xi32>, %arg1: tensor<1x1x1x1x13x21x3xi32>) -> tensor<1x1x1x1x13x21x3xi32> {
+  // expected-error@+1 {{'tosa.bitwise_xor' op failed level check: operand rank(shape) <= MAX_RANK}}
+  %0 = tosa.bitwise_xor %arg0, %arg1 : (tensor<1x1x1x1x13x21x3xi32>, tensor<1x1x1x1x13x21x3xi32>) -> tensor<1x1x1x1x13x21x3xi32>
+  return %0 : tensor<1x1x1x1x13x21x3xi32>
+}
+
+// -----
+
+func.func @test_int_div(%arg0: tensor<1x1x1x1x13x21x3xi32>, %arg1: tensor<1x1x1x1x13x21x3xi32>) -> tensor<1x1x1x1x13x21x3xi32> {
+  // expected-error@+1 {{'tosa.int_div' op failed level check: operand rank(shape) <= MAX_RANK}}
+  %0 = tosa.int_div %arg0, %arg1 : (tensor<1x1x1x1x13x21x3xi32>, tensor<1x1x1x1x13x21x3xi32>) -> tensor<1x1x1x1x13x21x3xi32>
+  return %0 : tensor<1x1x1x1x13x21x3xi32>
+}
+
+// -----
+
+func.func @test_logical_and(%arg0: tensor<1x1x1x1x13x21x3xi1>, %arg1: tensor<1x1x1x1x13x21x3xi1>) -> tensor<1x1x1x1x13x21x3xi1> {
+  // expected-error@+1 {{'tosa.logical_and' op failed level check: operand rank(shape) <= MAX_RANK}}
+  %0 = tosa.logical_and %arg0, %arg1 : (tensor<1x1x1x1x13x21x3xi1>, tensor<1x1x1x1x13x21x3xi1>) -> tensor<1x1x1x1x13x21x3xi1>
+  return %0 : tensor<1x1x1x1x13x21x3xi1>
+}
+
+// -----
+
+func.func @test_logical_left_shift(%arg0: tensor<1x1x1x1x13x21x3xi32>, %arg1: tensor<1x1x1x1x13x21x3xi32>) -> tensor<1x1x1x1x13x21x3xi32> {
+  // expected-error@+1 {{'tosa.logical_left_shift' op failed level check: operand rank(shape) <= MAX_RANK}}
+  %0 = tosa.logical_left_shift %arg0, %arg1 : (tensor<1x1x1x1x13x21x3xi32>, tensor<1x1x1x1x13x21x3xi32>) -> tensor<1x1x1x1x13x21x3xi32>
+  return %0 : tensor<1x1x1x1x13x21x3xi32>
+}
+
+// -----
+
+func.func @test_logical_right_shift(%arg0: tensor<1x1x1x1x13x21x3xi32>, %arg1: tensor<1x1x1x1x13x21x3xi32>) -> tensor<1x1x1x1x13x21x3xi32> {
+  // expected-error@+1 {{'tosa.logical_right_shift' op failed level check: operand rank(shape) <= MAX_RANK}}
+  %0 = tosa.logical_right_shift %arg0, %arg1 : (tensor<1x1x1x1x13x21x3xi32>, tensor<1x1x1x1x13x21x3xi32>) -> tensor<1x1x1x1x13x21x3xi32>
+  return %0 : tensor<1x1x1x1x13x21x3xi32>
+}
+
+// -----
+
+func.func @test_logical_or(%arg0: tensor<1x1x1x1x13x1x3xi1>, %arg1: tensor<1x1x1x1x13x21x3xi1>) -> tensor<1x1x1x1x13x21x3xi1> {
+  // expected-error@+1 {{'tosa.logical_or' op failed level check: operand rank(shape) <= MAX_RANK}}
+  %0 = tosa.logical_or %arg0, %arg1 : (tensor<1x1x1x1x13x1x3xi1>, tensor<1x1x1x1x13x21x3xi1>) -> tensor<1x1x1x1x13x21x3xi1>
+  return %0 : tensor<1x1x1x1x13x21x3xi1>
+}
+
+// -----
+
+func.func @test_logical_xor(%arg0: tensor<1x1x1x1x13x1x3xi1>, %arg1: tensor<1x1x1x1x13x21x3xi1>) -> tensor<1x1x1x1x13x21x3xi1> {
+  // expected-error@+1 {{'tosa.logical_xor' op failed level check: operand rank(shape) <= MAX_RANK}}
+  %0 = tosa.logical_xor %arg0, %arg1 : (tensor<1x1x1x1x13x1x3xi1>, tensor<1x1x1x1x13x21x3xi1>) -> tensor<1x1x1x1x13x21x3xi1>
+  return %0 : tensor<1x1x1x1x13x21x3xi1>
+}
+
+// -----
+
+func.func @test_max(%arg0: tensor<1x1x1x1x13x21x3xf32>, %arg1: tensor<1x1x1x1x13x21x1xf32>) -> tensor<1x1x1x1x13x21x3xf32> {
+  // expected-error@+1 {{'tosa.maximum' op failed level check: operand rank(shape) <= MAX_RANK}}
+  %0 = tosa.maximum %arg0, %arg1 : (tensor<1x1x1x1x13x21x3xf32>, tensor<1x1x1x1x13x21x1xf32>) -> tensor<1x1x1x1x13x21x3xf32>
+  return %0 : tensor<1x1x1x1x13x21x3xf32>
+}
+
+// -----
+
+func.func @test_min(%arg0: tensor<1x1x1x1x13x21x3xf32>, %arg1: tensor<1x1x1x1x1x21x3xf32>) -> tensor<1x1x1x1x13x21x3xf32> {
+  // expected-error@+1 {{'tosa.minimum' op failed level check: operand rank(shape) <= MAX_RANK}}
+  %0 = tosa.minimum %arg0, %arg1 : (tensor<1x1x1x1x13x21x3xf32>, tensor<1x1x1x1x1x21x3xf32>) -> tensor<1x1x1x1x13x21x3xf32>
+  return %0 : tensor<1x1x1x1x13x21x3xf32>
+}
+
+// -----
+
+func.func @test_mul(%arg0: tensor<1x1x1x1x13x21x3xf32>, %arg1: tensor<1x1x1x1x13x1x3xf32>) -> tensor<1x1x1x1x13x21x3xf32> {
+  %shift = "tosa.const"() <{value = dense<0> : tensor<1xi8>}> : () -> tensor<1xi8>
+  // expected-error@+1 {{'tosa.mul' op failed level check: operand rank(shape) <= MAX_RANK}}
+  %0 = tosa.mul %arg0, %arg1, %shift : (tensor<1x1x1x1x13x21x3xf32>, tensor<1x1x1x1x13x1x3xf32>, tensor<1xi8>) -> tensor<1x1x1x1x13x21x3xf32>
+  return %0 : tensor<1x1x1x1x13x21x3xf32>
+}
+
+// -----
+
+func.func @test_pow(%arg0: tensor<1x1x1x1x13x21x3xf32>, %arg1: tensor<1x1x1x1x13x21x1xf32>) -> tensor<1x1x1x1x13x21x3xf32> {
+  // expected-error@+1 {{'tosa.pow' op failed level check: operand rank(shape) <= MAX_RANK}}
+  %0 = tosa.pow %arg0, %arg1 : (tensor<1x1x1x1x13x21x3xf32>, tensor<1x1x1x1x13x21x1xf32>) -> tensor<1x1x1x1x13x21x3xf32>
+  return %0 : tensor<1x1x1x1x13x21x3xf32>
+}
+
+// -----
+
+func.func @test_sub(%arg0: tensor<1x1x1x1x1x21x3xf32>, %arg1: tensor<1x1x1x1x13x21x3xf32>) -> tensor<1x1x1x1x13x21x3xf32> {
+  // expected-error@+1 {{'tosa.sub' op failed level check: operand rank(shape) <= MAX_RANK}}
+  %0 = tosa.sub %arg0, %arg1 : (tensor<1x1x1x1x1x21x3xf32>, tensor<1x1x1x1x13x21x3xf32>) -> te...
[truncated]

Copy link

github-actions bot commented Feb 20, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

@tatwaichong tatwaichong force-pushed the level_check branch 5 times, most recently from 23707c2 to 2f2059a Compare February 21, 2025 07:57
@tatwaichong tatwaichong marked this pull request as draft February 21, 2025 08:06
@tatwaichong tatwaichong force-pushed the level_check branch 3 times, most recently from 9672966 to fcd29d6 Compare February 24, 2025 21:36
@tatwaichong tatwaichong marked this pull request as ready for review February 24, 2025 22:16
@tatwaichong tatwaichong marked this pull request as draft February 24, 2025 22:27
@tatwaichong tatwaichong marked this pull request as ready for review February 24, 2025 22:44
Copy link
Contributor

@lhutton1 lhutton1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @tatwaichong, mostly had questions about conformance of these checks to the specification. Will other checks such as MAX_NESTING come in future changes?

@tatwaichong
Copy link
Contributor Author

@lhutton1 agree, I think it is worthwhile to implement MAX_NESTING check in future changes.

Copy link
Contributor

@lhutton1 lhutton1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the updates @tatwaichong, had a couple more questions otherwise LGTM

Copy link
Contributor

@lhutton1 lhutton1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the updates, apologies for the back and forth on this!

@tatwaichong
Copy link
Contributor Author

Improve the PR as suggested, and add tests.

Add the following types of level check to consolidate the level validity
- Complete rank level checks for operations.
- Add MAX_LOG2_SIZE level check: The maximum value is 63 when the
  level is set to "none" and 31 when the level is set to "8K".
- Add MAX_TENSOR_LIST_SIZE level check : The maximum value is 256
  when the level is set to "none" and 64 when the level is set to
  "8K".
- TOSA 1.0 spec does not allow operations with dynamic shapes, so
  an error should be raised instead.

Co-authored-by: TatWai Chong <[email protected]>
Change-Id: I797fafe504219e43950824c04839c7187065fe8e
Copy link
Contributor

@lhutton1 lhutton1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes @tatwaichong, LGTM!

@Jerry-Ge Jerry-Ge merged commit ccf1bfc into llvm:main Mar 3, 2025
11 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Mar 3, 2025

LLVM Buildbot has detected a new failure on builder openmp-offload-sles-build-only running on rocm-worker-hw-04-sles while building mlir at step 5 "compile-openmp".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/140/builds/18107

Here is the relevant piece of the build log for the reference
Step 5 (compile-openmp) failure: build (failure)
...
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/clang/include/clang/Basic/PointerAuthOptions.h:70:18: warning: ‘clang::PointerAuthSchema::TheKind’ is too small to hold all values of ‘enum class clang::PointerAuthSchema::Kind’
   Kind TheKind : 2;
                  ^
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/clang/include/clang/Basic/PointerAuthOptions.h:74:58: warning: ‘clang::PointerAuthSchema::SelectedAuthenticationMode’ is too small to hold all values of ‘enum class clang::PointerAuthenticationMode’
   PointerAuthenticationMode SelectedAuthenticationMode : 2;
                                                          ^
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/clang/include/clang/Basic/PointerAuthOptions.h:75:39: warning: ‘clang::PointerAuthSchema::DiscriminationKind’ is too small to hold all values of ‘enum class clang::PointerAuthSchema::Discrimination’
   Discrimination DiscriminationKind : 2;
                                       ^
19.378 [1750/32/5330] Building CXX object tools/mlir/lib/Dialect/Tosa/Transforms/CMakeFiles/obj.MLIRTosaTransforms.dir/TosaValidation.cpp.o
FAILED: tools/mlir/lib/Dialect/Tosa/Transforms/CMakeFiles/obj.MLIRTosaTransforms.dir/TosaValidation.cpp.o 
ccache /usr/bin/c++ -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Itools/mlir/lib/Dialect/Tosa/Transforms -I/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/mlir/lib/Dialect/Tosa/Transforms -Itools/mlir/include -I/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/mlir/include -Iinclude -I/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/llvm/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -fno-lifetime-dse -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -Wno-misleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -Wundef -Wno-unused-but-set-parameter -Wno-deprecated-copy -O3 -DNDEBUG  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -std=c++1z -MD -MT tools/mlir/lib/Dialect/Tosa/Transforms/CMakeFiles/obj.MLIRTosaTransforms.dir/TosaValidation.cpp.o -MF tools/mlir/lib/Dialect/Tosa/Transforms/CMakeFiles/obj.MLIRTosaTransforms.dir/TosaValidation.cpp.o.d -o tools/mlir/lib/Dialect/Tosa/Transforms/CMakeFiles/obj.MLIRTosaTransforms.dir/TosaValidation.cpp.o -c /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp:247:13: error: explicit specialization in non-namespace scope ‘struct {anonymous}::TosaValidation’
   template <>
             ^
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp:261:13: error: explicit specialization in non-namespace scope ‘struct {anonymous}::TosaValidation’
   template <>
             ^
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp:395:8: error: too many template-parameter-lists
   bool levelCheckPool(Operation *op) {
        ^~~~~~~~~~~~~~
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp:418:8: error: too many template-parameter-lists
   bool levelCheckConv(Operation *op) {
        ^~~~~~~~~~~~~~
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp:474:8: error: too many template-parameter-lists
   bool levelCheckFFT(Operation *op) {
        ^~~~~~~~~~~~~
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp: In member function ‘llvm::LogicalResult {anonymous}::TosaValidation::applyLevelCheck(mlir::Operation*)’:
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp:618:8: error: ‘levelCheckPool’ was not declared in this scope
   if (!levelCheckPool<tosa::AvgPool2dOp>(op) ||
        ^~~~~~~~~~~~~~
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp:618:8: note: suggested alternative: ‘levelCheckScale’
   if (!levelCheckPool<tosa::AvgPool2dOp>(op) ||
        ^~~~~~~~~~~~~~
        levelCheckScale
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp:618:40: error: expected primary-expression before ‘>’ token
   if (!levelCheckPool<tosa::AvgPool2dOp>(op) ||
                                        ^
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp:618:22: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses]
   if (!levelCheckPool<tosa::AvgPool2dOp>(op) ||
                      ^
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp:619:8: error: ‘levelCheckConv’ was not declared in this scope
       !levelCheckConv<tosa::Conv2DOp>(op) ||
        ^~~~~~~~~~~~~~
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp:619:8: note: suggested alternative: ‘levelCheckRank’
       !levelCheckConv<tosa::Conv2DOp>(op) ||
        ^~~~~~~~~~~~~~
        levelCheckRank
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp:619:37: error: expected primary-expression before ‘>’ token

@llvm-ci
Copy link
Collaborator

llvm-ci commented Mar 3, 2025

LLVM Buildbot has detected a new failure on builder amdgpu-offload-ubuntu-22-cmake-build-only running on rocm-docker-ubu-22 while building mlir at step 4 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/203/builds/3371

Here is the relevant piece of the build log for the reference
Step 4 (annotate) failure: '../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py --jobs=32' (failure)
...
[5656/7727] Linking CXX shared library lib/libMLIRBuiltinToLLVMIRTranslation.so.21.0git
[5657/7727] Creating library symlink lib/libMLIRArmSMEToLLVMIRTranslation.so
[5658/7727] Creating library symlink lib/libMLIRSPIRVToLLVMIRTranslation.so
[5659/7727] Creating library symlink lib/libMLIRBuiltinToLLVMIRTranslation.so
[5660/7727] Creating library symlink lib/libMLIRTestTransformDialect.so
[5661/7727] Linking CXX shared library lib/libMLIRAMXToLLVMIRTranslation.so.21.0git
[5662/7727] Creating library symlink lib/libclangLex.so
[5663/7727] Linking CXX shared library lib/libMLIRAMDGPUToROCDL.so.21.0git
[5664/7727] Creating library symlink lib/libMLIRAMXToLLVMIRTranslation.so
[5665/7727] Building CXX object tools/mlir/lib/Dialect/Tosa/Transforms/CMakeFiles/obj.MLIRTosaTransforms.dir/TosaValidation.cpp.o
FAILED: tools/mlir/lib/Dialect/Tosa/Transforms/CMakeFiles/obj.MLIRTosaTransforms.dir/TosaValidation.cpp.o 
ccache /usr/bin/c++ -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/tools/mlir/lib/Dialect/Tosa/Transforms -I/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/mlir/lib/Dialect/Tosa/Transforms -I/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/tools/mlir/include -I/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/mlir/include -I/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/include -I/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -fno-lifetime-dse -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Wundef -Wno-unused-but-set-parameter -Wno-deprecated-copy -O3 -DNDEBUG  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -std=c++17 -MD -MT tools/mlir/lib/Dialect/Tosa/Transforms/CMakeFiles/obj.MLIRTosaTransforms.dir/TosaValidation.cpp.o -MF tools/mlir/lib/Dialect/Tosa/Transforms/CMakeFiles/obj.MLIRTosaTransforms.dir/TosaValidation.cpp.o.d -o tools/mlir/lib/Dialect/Tosa/Transforms/CMakeFiles/obj.MLIRTosaTransforms.dir/TosaValidation.cpp.o -c /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp:247:13: error: explicit specialization in non-namespace scope ‘struct {anonymous}::TosaValidation’
  247 |   template <>
      |             ^
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp:261:13: error: explicit specialization in non-namespace scope ‘struct {anonymous}::TosaValidation’
  261 |   template <>
      |             ^
[5666/7727] Building CXX object tools/clang/lib/Analysis/FlowSensitive/CMakeFiles/obj.clangAnalysisFlowSensitive.dir/TypeErasedDataflowAnalysis.cpp.o
[5667/7727] Creating library symlink lib/libMLIRAMDGPUToROCDL.so
[5668/7727] Linking CXX shared library lib/libMLIRGPUToLLVMIRTranslation.so.21.0git
[5669/7727] Linking CXX shared library lib/libMLIRArithToAMDGPU.so.21.0git
[5670/7727] Building CXX object tools/clang/lib/Analysis/FlowSensitive/CMakeFiles/obj.clangAnalysisFlowSensitive.dir/Value.cpp.o
[5671/7727] Linking CXX shared library lib/libMLIRNVVMToLLVMIRTranslation.so.21.0git
[5672/7727] Linking CXX shared library lib/libMLIRLLVMToLLVMIRTranslation.so.21.0git
[5673/7727] Linking CXX shared library lib/libMLIROpenACCToLLVMIRTranslation.so.21.0git
[5674/7727] Linking CXX shared library lib/libMLIRX86VectorToLLVMIRTranslation.so.21.0git
[5675/7727] Building CXX object tools/lld/Common/CMakeFiles/lldCommon.dir/Version.cpp.o
[5676/7727] Linking CXX shared library lib/libMLIRVCIXToLLVMIRTranslation.so.21.0git
[5677/7727] Linking CXX shared library lib/libMLIRExecutionEngineUtils.so.21.0git
[5678/7727] Linking CXX shared library lib/libMLIRVectorToLLVM.so.21.0git
[5679/7727] Linking CXX shared library lib/libMLIRROCDLToLLVMIRTranslation.so.21.0git
[5680/7727] Building CXX object tools/clang/lib/Analysis/CMakeFiles/obj.clangAnalysis.dir/ReachableCode.cpp.o
[5681/7727] Linking CXX shared library lib/libLLVMGlobalISel.so.21.0git
[5682/7727] Linking CXX shared library lib/libMLIROpenMPToLLVMIRTranslation.so.21.0git
[5683/7727] Building CXX object tools/clang/lib/Analysis/plugins/CheckerDependencyHandling/CMakeFiles/CheckerDependencyHandlingAnalyzerPlugin.dir/CheckerDependencyHandling.cpp.o
[5684/7727] Building CXX object tools/clang/lib/Analysis/plugins/SampleAnalyzer/CMakeFiles/SampleAnalyzerPlugin.dir/MainCallChecker.cpp.o
[5685/7727] Building CXX object tools/clang/lib/Analysis/plugins/CheckerOptionHandling/CMakeFiles/CheckerOptionHandlingAnalyzerPlugin.dir/CheckerOptionHandling.cpp.o
[5686/7727] Linking CXX shared library lib/libLLVMOrcJIT.so.21.0git
[5687/7727] Building CXX object lib/CodeGen/AsmPrinter/CMakeFiles/LLVMAsmPrinter.dir/AsmPrinter.cpp.o
[5688/7727] Building CXX object tools/clang/lib/Analysis/CMakeFiles/obj.clangAnalysis.dir/UnsafeBufferUsage.cpp.o
[5689/7727] Linking CXX shared library lib/libMLIRTestDialect.so.21.0git
[5690/7727] Linking CXX shared library lib/libclangAST.so.21.0git
[5691/7727] Building CXX object lib/LTO/CMakeFiles/LLVMLTO.dir/LTO.cpp.o
[5692/7727] Building AMDGPUGenAsmWriter.inc...
[5693/7727] Building AMDGPUGenDAGISel.inc...
[5694/7727] Building AMDGPUGenAsmMatcher.inc...
[5695/7727] Building AMDGPUGenGlobalISel.inc...
[5696/7727] Building AMDGPUGenInstrInfo.inc...
Step 7 (build cmake config) failure: build cmake config (failure)
...
[5656/7727] Linking CXX shared library lib/libMLIRBuiltinToLLVMIRTranslation.so.21.0git
[5657/7727] Creating library symlink lib/libMLIRArmSMEToLLVMIRTranslation.so
[5658/7727] Creating library symlink lib/libMLIRSPIRVToLLVMIRTranslation.so
[5659/7727] Creating library symlink lib/libMLIRBuiltinToLLVMIRTranslation.so
[5660/7727] Creating library symlink lib/libMLIRTestTransformDialect.so
[5661/7727] Linking CXX shared library lib/libMLIRAMXToLLVMIRTranslation.so.21.0git
[5662/7727] Creating library symlink lib/libclangLex.so
[5663/7727] Linking CXX shared library lib/libMLIRAMDGPUToROCDL.so.21.0git
[5664/7727] Creating library symlink lib/libMLIRAMXToLLVMIRTranslation.so
[5665/7727] Building CXX object tools/mlir/lib/Dialect/Tosa/Transforms/CMakeFiles/obj.MLIRTosaTransforms.dir/TosaValidation.cpp.o
FAILED: tools/mlir/lib/Dialect/Tosa/Transforms/CMakeFiles/obj.MLIRTosaTransforms.dir/TosaValidation.cpp.o 
ccache /usr/bin/c++ -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/tools/mlir/lib/Dialect/Tosa/Transforms -I/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/mlir/lib/Dialect/Tosa/Transforms -I/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/tools/mlir/include -I/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/mlir/include -I/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/include -I/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -fno-lifetime-dse -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Wundef -Wno-unused-but-set-parameter -Wno-deprecated-copy -O3 -DNDEBUG  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -std=c++17 -MD -MT tools/mlir/lib/Dialect/Tosa/Transforms/CMakeFiles/obj.MLIRTosaTransforms.dir/TosaValidation.cpp.o -MF tools/mlir/lib/Dialect/Tosa/Transforms/CMakeFiles/obj.MLIRTosaTransforms.dir/TosaValidation.cpp.o.d -o tools/mlir/lib/Dialect/Tosa/Transforms/CMakeFiles/obj.MLIRTosaTransforms.dir/TosaValidation.cpp.o -c /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp:247:13: error: explicit specialization in non-namespace scope ‘struct {anonymous}::TosaValidation’
  247 |   template <>
      |             ^
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp:261:13: error: explicit specialization in non-namespace scope ‘struct {anonymous}::TosaValidation’
  261 |   template <>
      |             ^
[5666/7727] Building CXX object tools/clang/lib/Analysis/FlowSensitive/CMakeFiles/obj.clangAnalysisFlowSensitive.dir/TypeErasedDataflowAnalysis.cpp.o
[5667/7727] Creating library symlink lib/libMLIRAMDGPUToROCDL.so
[5668/7727] Linking CXX shared library lib/libMLIRGPUToLLVMIRTranslation.so.21.0git
[5669/7727] Linking CXX shared library lib/libMLIRArithToAMDGPU.so.21.0git
[5670/7727] Building CXX object tools/clang/lib/Analysis/FlowSensitive/CMakeFiles/obj.clangAnalysisFlowSensitive.dir/Value.cpp.o
[5671/7727] Linking CXX shared library lib/libMLIRNVVMToLLVMIRTranslation.so.21.0git
[5672/7727] Linking CXX shared library lib/libMLIRLLVMToLLVMIRTranslation.so.21.0git
[5673/7727] Linking CXX shared library lib/libMLIROpenACCToLLVMIRTranslation.so.21.0git
[5674/7727] Linking CXX shared library lib/libMLIRX86VectorToLLVMIRTranslation.so.21.0git
[5675/7727] Building CXX object tools/lld/Common/CMakeFiles/lldCommon.dir/Version.cpp.o
[5676/7727] Linking CXX shared library lib/libMLIRVCIXToLLVMIRTranslation.so.21.0git
[5677/7727] Linking CXX shared library lib/libMLIRExecutionEngineUtils.so.21.0git
[5678/7727] Linking CXX shared library lib/libMLIRVectorToLLVM.so.21.0git
[5679/7727] Linking CXX shared library lib/libMLIRROCDLToLLVMIRTranslation.so.21.0git
[5680/7727] Building CXX object tools/clang/lib/Analysis/CMakeFiles/obj.clangAnalysis.dir/ReachableCode.cpp.o
[5681/7727] Linking CXX shared library lib/libLLVMGlobalISel.so.21.0git
[5682/7727] Linking CXX shared library lib/libMLIROpenMPToLLVMIRTranslation.so.21.0git
[5683/7727] Building CXX object tools/clang/lib/Analysis/plugins/CheckerDependencyHandling/CMakeFiles/CheckerDependencyHandlingAnalyzerPlugin.dir/CheckerDependencyHandling.cpp.o
[5684/7727] Building CXX object tools/clang/lib/Analysis/plugins/SampleAnalyzer/CMakeFiles/SampleAnalyzerPlugin.dir/MainCallChecker.cpp.o
[5685/7727] Building CXX object tools/clang/lib/Analysis/plugins/CheckerOptionHandling/CMakeFiles/CheckerOptionHandlingAnalyzerPlugin.dir/CheckerOptionHandling.cpp.o
[5686/7727] Linking CXX shared library lib/libLLVMOrcJIT.so.21.0git
[5687/7727] Building CXX object lib/CodeGen/AsmPrinter/CMakeFiles/LLVMAsmPrinter.dir/AsmPrinter.cpp.o
[5688/7727] Building CXX object tools/clang/lib/Analysis/CMakeFiles/obj.clangAnalysis.dir/UnsafeBufferUsage.cpp.o
[5689/7727] Linking CXX shared library lib/libMLIRTestDialect.so.21.0git
[5690/7727] Linking CXX shared library lib/libclangAST.so.21.0git
[5691/7727] Building CXX object lib/LTO/CMakeFiles/LLVMLTO.dir/LTO.cpp.o
[5692/7727] Building AMDGPUGenAsmWriter.inc...
[5693/7727] Building AMDGPUGenDAGISel.inc...
[5694/7727] Building AMDGPUGenAsmMatcher.inc...
[5695/7727] Building AMDGPUGenGlobalISel.inc...
[5696/7727] Building AMDGPUGenInstrInfo.inc...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Mar 3, 2025

LLVM Buildbot has detected a new failure on builder amdgpu-offload-rhel-8-cmake-build-only running on rocm-docker-rhel-8 while building mlir at step 4 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/204/builds/2181

Here is the relevant piece of the build log for the reference
Step 4 (annotate) failure: '../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py --jobs=32' (failure)
...
     assert(IPVK_First <= ValueKind && ValueKind <= IPVK_Last &&
            ~~~~~~~~~~~^~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include/llvm/ProfileData/InstrProf.h: In member function ‘std::vector<llvm::InstrProfValueSiteRecord>& llvm::InstrProfRecord::getOrCreateValueSitesForKind(uint32_t)’:
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include/llvm/ProfileData/InstrProf.h:977:23: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
     assert(IPVK_First <= ValueKind && ValueKind <= IPVK_Last &&
            ~~~~~~~~~~~^~~~~~~~~~~~
[6689/7727] Linking CXX shared library lib/libLLVMLTO.so.21.0git
[6690/7727] Creating library symlink lib/libLLVMLTO.so
[6691/7727] Building AMDGPUGenGlobalISel.inc...
[6692/7727] Building CXX object tools/mlir/lib/Dialect/Tosa/Transforms/CMakeFiles/obj.MLIRTosaTransforms.dir/TosaValidation.cpp.o
FAILED: tools/mlir/lib/Dialect/Tosa/Transforms/CMakeFiles/obj.MLIRTosaTransforms.dir/TosaValidation.cpp.o 
ccache /usr/bin/c++ -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/build/tools/mlir/lib/Dialect/Tosa/Transforms -I/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/mlir/lib/Dialect/Tosa/Transforms -I/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/build/tools/mlir/include -I/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/mlir/include -I/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/build/include -I/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -fno-lifetime-dse -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -Wno-misleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -Wundef -Wno-unused-but-set-parameter -Wno-deprecated-copy -O3 -DNDEBUG -std=c++17  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -MD -MT tools/mlir/lib/Dialect/Tosa/Transforms/CMakeFiles/obj.MLIRTosaTransforms.dir/TosaValidation.cpp.o -MF tools/mlir/lib/Dialect/Tosa/Transforms/CMakeFiles/obj.MLIRTosaTransforms.dir/TosaValidation.cpp.o.d -o tools/mlir/lib/Dialect/Tosa/Transforms/CMakeFiles/obj.MLIRTosaTransforms.dir/TosaValidation.cpp.o -c /home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp:247:13: error: explicit specialization in non-namespace scope ‘struct {anonymous}::TosaValidation’
   template <>
             ^
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp:261:13: error: explicit specialization in non-namespace scope ‘struct {anonymous}::TosaValidation’
   template <>
             ^
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp:395:8: error: too many template-parameter-lists
   bool levelCheckPool(Operation *op) {
        ^~~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp:418:8: error: too many template-parameter-lists
   bool levelCheckConv(Operation *op) {
        ^~~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp:474:8: error: too many template-parameter-lists
   bool levelCheckFFT(Operation *op) {
        ^~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp: In member function ‘llvm::LogicalResult {anonymous}::TosaValidation::applyLevelCheck(mlir::Operation*)’:
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp:618:8: error: ‘levelCheckPool’ was not declared in this scope
   if (!levelCheckPool<tosa::AvgPool2dOp>(op) ||
        ^~~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp:618:8: note: suggested alternative: ‘levelCheckScale’
   if (!levelCheckPool<tosa::AvgPool2dOp>(op) ||
        ^~~~~~~~~~~~~~
        levelCheckScale
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp:618:40: error: expected primary-expression before ‘>’ token
   if (!levelCheckPool<tosa::AvgPool2dOp>(op) ||
                                        ^
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp:618:22: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses]
   if (!levelCheckPool<tosa::AvgPool2dOp>(op) ||
                      ^
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp:619:8: error: ‘levelCheckConv’ was not declared in this scope
       !levelCheckConv<tosa::Conv2DOp>(op) ||
        ^~~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp:619:8: note: suggested alternative: ‘levelCheckRank’
       !levelCheckConv<tosa::Conv2DOp>(op) ||
        ^~~~~~~~~~~~~~
        levelCheckRank
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp:619:37: error: expected primary-expression before ‘>’ token
Step 7 (build cmake config) failure: build cmake config (failure)
...
     assert(IPVK_First <= ValueKind && ValueKind <= IPVK_Last &&
            ~~~~~~~~~~~^~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include/llvm/ProfileData/InstrProf.h: In member function ‘std::vector<llvm::InstrProfValueSiteRecord>& llvm::InstrProfRecord::getOrCreateValueSitesForKind(uint32_t)’:
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include/llvm/ProfileData/InstrProf.h:977:23: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
     assert(IPVK_First <= ValueKind && ValueKind <= IPVK_Last &&
            ~~~~~~~~~~~^~~~~~~~~~~~
[6689/7727] Linking CXX shared library lib/libLLVMLTO.so.21.0git
[6690/7727] Creating library symlink lib/libLLVMLTO.so
[6691/7727] Building AMDGPUGenGlobalISel.inc...
[6692/7727] Building CXX object tools/mlir/lib/Dialect/Tosa/Transforms/CMakeFiles/obj.MLIRTosaTransforms.dir/TosaValidation.cpp.o
FAILED: tools/mlir/lib/Dialect/Tosa/Transforms/CMakeFiles/obj.MLIRTosaTransforms.dir/TosaValidation.cpp.o 
ccache /usr/bin/c++ -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/build/tools/mlir/lib/Dialect/Tosa/Transforms -I/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/mlir/lib/Dialect/Tosa/Transforms -I/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/build/tools/mlir/include -I/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/mlir/include -I/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/build/include -I/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -fno-lifetime-dse -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -Wno-misleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -Wundef -Wno-unused-but-set-parameter -Wno-deprecated-copy -O3 -DNDEBUG -std=c++17  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -MD -MT tools/mlir/lib/Dialect/Tosa/Transforms/CMakeFiles/obj.MLIRTosaTransforms.dir/TosaValidation.cpp.o -MF tools/mlir/lib/Dialect/Tosa/Transforms/CMakeFiles/obj.MLIRTosaTransforms.dir/TosaValidation.cpp.o.d -o tools/mlir/lib/Dialect/Tosa/Transforms/CMakeFiles/obj.MLIRTosaTransforms.dir/TosaValidation.cpp.o -c /home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp:247:13: error: explicit specialization in non-namespace scope ‘struct {anonymous}::TosaValidation’
   template <>
             ^
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp:261:13: error: explicit specialization in non-namespace scope ‘struct {anonymous}::TosaValidation’
   template <>
             ^
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp:395:8: error: too many template-parameter-lists
   bool levelCheckPool(Operation *op) {
        ^~~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp:418:8: error: too many template-parameter-lists
   bool levelCheckConv(Operation *op) {
        ^~~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp:474:8: error: too many template-parameter-lists
   bool levelCheckFFT(Operation *op) {
        ^~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp: In member function ‘llvm::LogicalResult {anonymous}::TosaValidation::applyLevelCheck(mlir::Operation*)’:
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp:618:8: error: ‘levelCheckPool’ was not declared in this scope
   if (!levelCheckPool<tosa::AvgPool2dOp>(op) ||
        ^~~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp:618:8: note: suggested alternative: ‘levelCheckScale’
   if (!levelCheckPool<tosa::AvgPool2dOp>(op) ||
        ^~~~~~~~~~~~~~
        levelCheckScale
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp:618:40: error: expected primary-expression before ‘>’ token
   if (!levelCheckPool<tosa::AvgPool2dOp>(op) ||
                                        ^
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp:618:22: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses]
   if (!levelCheckPool<tosa::AvgPool2dOp>(op) ||
                      ^
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp:619:8: error: ‘levelCheckConv’ was not declared in this scope
       !levelCheckConv<tosa::Conv2DOp>(op) ||
        ^~~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp:619:8: note: suggested alternative: ‘levelCheckRank’
       !levelCheckConv<tosa::Conv2DOp>(op) ||
        ^~~~~~~~~~~~~~
        levelCheckRank
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp:619:37: error: expected primary-expression before ‘>’ token

@llvm-ci
Copy link
Collaborator

llvm-ci commented Mar 3, 2025

LLVM Buildbot has detected a new failure on builder amdgpu-offload-rhel-9-cmake-build-only running on rocm-docker-rhel-9 while building mlir at step 4 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/205/builds/2162

Here is the relevant piece of the build log for the reference
Step 4 (annotate) failure: '../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py --jobs=32' (failure)
...
[5842/7727] Building CXX object tools/clang/lib/Driver/CMakeFiles/obj.clangDriver.dir/ToolChains/RISCVToolchain.cpp.o
[5843/7727] Building CXX object tools/clang/lib/Serialization/CMakeFiles/obj.clangSerialization.dir/ASTReaderStmt.cpp.o
[5844/7727] Building CXX object tools/clang/lib/Driver/CMakeFiles/obj.clangDriver.dir/ToolChains/Linux.cpp.o
[5845/7727] Building CXX object tools/clang/lib/Driver/CMakeFiles/obj.clangDriver.dir/ToolChains/Solaris.cpp.o
[5846/7727] Building CXX object tools/clang/lib/Driver/CMakeFiles/obj.clangDriver.dir/ToolChains/NaCl.cpp.o
[5847/7727] Building CXX object tools/clang/lib/Driver/CMakeFiles/obj.clangDriver.dir/ToolChains/OHOS.cpp.o
[5848/7727] Building CXX object tools/clang/lib/Driver/CMakeFiles/obj.clangDriver.dir/ToolChains/SPIRV.cpp.o
[5849/7727] Building CXX object tools/clang/lib/Driver/CMakeFiles/obj.clangDriver.dir/ToolChains/OpenBSD.cpp.o
[5850/7727] Building CXX object tools/clang/lib/Serialization/CMakeFiles/obj.clangSerialization.dir/ASTReaderDecl.cpp.o
[5851/7727] Building CXX object tools/mlir/lib/Dialect/Tosa/Transforms/CMakeFiles/obj.MLIRTosaTransforms.dir/TosaValidation.cpp.o
FAILED: tools/mlir/lib/Dialect/Tosa/Transforms/CMakeFiles/obj.MLIRTosaTransforms.dir/TosaValidation.cpp.o 
ccache /usr/bin/c++ -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/tools/mlir/lib/Dialect/Tosa/Transforms -I/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/mlir/lib/Dialect/Tosa/Transforms -I/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/tools/mlir/include -I/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/mlir/include -I/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/include -I/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/llvm/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -fno-lifetime-dse -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Wundef -Wno-unused-but-set-parameter -Wno-deprecated-copy -O3 -DNDEBUG -std=c++17  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -MD -MT tools/mlir/lib/Dialect/Tosa/Transforms/CMakeFiles/obj.MLIRTosaTransforms.dir/TosaValidation.cpp.o -MF tools/mlir/lib/Dialect/Tosa/Transforms/CMakeFiles/obj.MLIRTosaTransforms.dir/TosaValidation.cpp.o.d -o tools/mlir/lib/Dialect/Tosa/Transforms/CMakeFiles/obj.MLIRTosaTransforms.dir/TosaValidation.cpp.o -c /home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp
/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp:247:13: error: explicit specialization in non-namespace scope ‘struct {anonymous}::TosaValidation’
  247 |   template <>
      |             ^
/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp:261:13: error: explicit specialization in non-namespace scope ‘struct {anonymous}::TosaValidation’
  261 |   template <>
      |             ^
[5852/7727] Building CXX object tools/clang/lib/Driver/CMakeFiles/obj.clangDriver.dir/ToolChains/SPIRVOpenMP.cpp.o
[5853/7727] Linking CXX shared library lib/libclangAnalysisFlowSensitive.so.21.0git
[5854/7727] Building CXX object tools/clang/lib/Driver/CMakeFiles/obj.clangDriver.dir/ToolChains/SYCL.cpp.o
[5855/7727] Building CXX object tools/clang/lib/Driver/CMakeFiles/obj.clangDriver.dir/ToolChains/TCE.cpp.o
[5856/7727] Building CXX object tools/clang/lib/Serialization/CMakeFiles/obj.clangSerialization.dir/ASTWriterDecl.cpp.o
[5857/7727] Building CXX object tools/clang/lib/Serialization/CMakeFiles/obj.clangSerialization.dir/ASTWriterStmt.cpp.o
[5858/7727] Building CXX object tools/clang/lib/Serialization/CMakeFiles/obj.clangSerialization.dir/InMemoryModuleCache.cpp.o
[5859/7727] Building CXX object tools/clang/lib/Serialization/CMakeFiles/obj.clangSerialization.dir/GlobalModuleIndex.cpp.o
[5860/7727] Building CXX object tools/clang/lib/Serialization/CMakeFiles/obj.clangSerialization.dir/ModuleFile.cpp.o
[5861/7727] Building CXX object tools/clang/lib/Driver/CMakeFiles/obj.clangDriver.dir/ToolChains/VEToolchain.cpp.o
[5862/7727] Building CXX object tools/clang/lib/Driver/CMakeFiles/obj.clangDriver.dir/ToolChains/WebAssembly.cpp.o
[5863/7727] Building CXX object tools/clang/lib/Driver/CMakeFiles/obj.clangDriver.dir/ToolChains/PPCLinux.cpp.o
[5864/7727] Linking CXX shared library lib/libMLIRCAPIExecutionEngine.so.21.0git
[5865/7727] Building CXX object tools/clang/lib/Driver/CMakeFiles/obj.clangDriver.dir/ToolChains/XCore.cpp.o
[5866/7727] Building CXX object tools/clang/lib/Driver/CMakeFiles/obj.clangDriver.dir/ToolChains/PPCFreeBSD.cpp.o
[5867/7727] Building CXX object tools/clang/lib/Driver/CMakeFiles/obj.clangDriver.dir/ToolChains/InterfaceStubs.cpp.o
[5868/7727] Building CXX object tools/clang/lib/Driver/CMakeFiles/obj.clangDriver.dir/ToolChains/ZOS.cpp.o
[5869/7727] Building CXX object tools/clang/lib/Driver/CMakeFiles/obj.clangDriver.dir/ToolChains/UEFI.cpp.o
[5870/7727] Building CXX object tools/clang/lib/Driver/CMakeFiles/obj.clangDriver.dir/Types.cpp.o
[5871/7727] Building CXX object tools/clang/lib/Driver/CMakeFiles/obj.clangDriver.dir/XRayArgs.cpp.o
[5872/7727] Building AMDGPUGenAsmWriter.inc...
[5873/7727] Building CXX object tools/clang/lib/Serialization/CMakeFiles/obj.clangSerialization.dir/GeneratePCH.cpp.o
[5874/7727] Building CXX object tools/clang/lib/Serialization/CMakeFiles/obj.clangSerialization.dir/ASTWriter.cpp.o
[5875/7727] Building CXX object tools/clang/lib/Serialization/CMakeFiles/obj.clangSerialization.dir/ASTReader.cpp.o
[5876/7727] Linking CXX shared library lib/libclangSema.so.21.0git
[5877/7727] Building AMDGPUGenDAGISel.inc...
[5878/7727] Building AMDGPUGenAsmMatcher.inc...
[5879/7727] Building AMDGPUGenGlobalISel.inc...
[5880/7727] Building CXX object lib/LTO/CMakeFiles/LLVMLTO.dir/LTO.cpp.o
[5881/7727] Building AMDGPUGenInstrInfo.inc...
[5882/7727] Building CXX object tools/clang/lib/Driver/CMakeFiles/obj.clangDriver.dir/ToolChains/HIPUtility.cpp.o
Step 7 (build cmake config) failure: build cmake config (failure)
...
[5842/7727] Building CXX object tools/clang/lib/Driver/CMakeFiles/obj.clangDriver.dir/ToolChains/RISCVToolchain.cpp.o
[5843/7727] Building CXX object tools/clang/lib/Serialization/CMakeFiles/obj.clangSerialization.dir/ASTReaderStmt.cpp.o
[5844/7727] Building CXX object tools/clang/lib/Driver/CMakeFiles/obj.clangDriver.dir/ToolChains/Linux.cpp.o
[5845/7727] Building CXX object tools/clang/lib/Driver/CMakeFiles/obj.clangDriver.dir/ToolChains/Solaris.cpp.o
[5846/7727] Building CXX object tools/clang/lib/Driver/CMakeFiles/obj.clangDriver.dir/ToolChains/NaCl.cpp.o
[5847/7727] Building CXX object tools/clang/lib/Driver/CMakeFiles/obj.clangDriver.dir/ToolChains/OHOS.cpp.o
[5848/7727] Building CXX object tools/clang/lib/Driver/CMakeFiles/obj.clangDriver.dir/ToolChains/SPIRV.cpp.o
[5849/7727] Building CXX object tools/clang/lib/Driver/CMakeFiles/obj.clangDriver.dir/ToolChains/OpenBSD.cpp.o
[5850/7727] Building CXX object tools/clang/lib/Serialization/CMakeFiles/obj.clangSerialization.dir/ASTReaderDecl.cpp.o
[5851/7727] Building CXX object tools/mlir/lib/Dialect/Tosa/Transforms/CMakeFiles/obj.MLIRTosaTransforms.dir/TosaValidation.cpp.o
FAILED: tools/mlir/lib/Dialect/Tosa/Transforms/CMakeFiles/obj.MLIRTosaTransforms.dir/TosaValidation.cpp.o 
ccache /usr/bin/c++ -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/tools/mlir/lib/Dialect/Tosa/Transforms -I/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/mlir/lib/Dialect/Tosa/Transforms -I/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/tools/mlir/include -I/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/mlir/include -I/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/include -I/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/llvm/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -fno-lifetime-dse -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Wundef -Wno-unused-but-set-parameter -Wno-deprecated-copy -O3 -DNDEBUG -std=c++17  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -MD -MT tools/mlir/lib/Dialect/Tosa/Transforms/CMakeFiles/obj.MLIRTosaTransforms.dir/TosaValidation.cpp.o -MF tools/mlir/lib/Dialect/Tosa/Transforms/CMakeFiles/obj.MLIRTosaTransforms.dir/TosaValidation.cpp.o.d -o tools/mlir/lib/Dialect/Tosa/Transforms/CMakeFiles/obj.MLIRTosaTransforms.dir/TosaValidation.cpp.o -c /home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp
/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp:247:13: error: explicit specialization in non-namespace scope ‘struct {anonymous}::TosaValidation’
  247 |   template <>
      |             ^
/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp:261:13: error: explicit specialization in non-namespace scope ‘struct {anonymous}::TosaValidation’
  261 |   template <>
      |             ^
[5852/7727] Building CXX object tools/clang/lib/Driver/CMakeFiles/obj.clangDriver.dir/ToolChains/SPIRVOpenMP.cpp.o
[5853/7727] Linking CXX shared library lib/libclangAnalysisFlowSensitive.so.21.0git
[5854/7727] Building CXX object tools/clang/lib/Driver/CMakeFiles/obj.clangDriver.dir/ToolChains/SYCL.cpp.o
[5855/7727] Building CXX object tools/clang/lib/Driver/CMakeFiles/obj.clangDriver.dir/ToolChains/TCE.cpp.o
[5856/7727] Building CXX object tools/clang/lib/Serialization/CMakeFiles/obj.clangSerialization.dir/ASTWriterDecl.cpp.o
[5857/7727] Building CXX object tools/clang/lib/Serialization/CMakeFiles/obj.clangSerialization.dir/ASTWriterStmt.cpp.o
[5858/7727] Building CXX object tools/clang/lib/Serialization/CMakeFiles/obj.clangSerialization.dir/InMemoryModuleCache.cpp.o
[5859/7727] Building CXX object tools/clang/lib/Serialization/CMakeFiles/obj.clangSerialization.dir/GlobalModuleIndex.cpp.o
[5860/7727] Building CXX object tools/clang/lib/Serialization/CMakeFiles/obj.clangSerialization.dir/ModuleFile.cpp.o
[5861/7727] Building CXX object tools/clang/lib/Driver/CMakeFiles/obj.clangDriver.dir/ToolChains/VEToolchain.cpp.o
[5862/7727] Building CXX object tools/clang/lib/Driver/CMakeFiles/obj.clangDriver.dir/ToolChains/WebAssembly.cpp.o
[5863/7727] Building CXX object tools/clang/lib/Driver/CMakeFiles/obj.clangDriver.dir/ToolChains/PPCLinux.cpp.o
[5864/7727] Linking CXX shared library lib/libMLIRCAPIExecutionEngine.so.21.0git
[5865/7727] Building CXX object tools/clang/lib/Driver/CMakeFiles/obj.clangDriver.dir/ToolChains/XCore.cpp.o
[5866/7727] Building CXX object tools/clang/lib/Driver/CMakeFiles/obj.clangDriver.dir/ToolChains/PPCFreeBSD.cpp.o
[5867/7727] Building CXX object tools/clang/lib/Driver/CMakeFiles/obj.clangDriver.dir/ToolChains/InterfaceStubs.cpp.o
[5868/7727] Building CXX object tools/clang/lib/Driver/CMakeFiles/obj.clangDriver.dir/ToolChains/ZOS.cpp.o
[5869/7727] Building CXX object tools/clang/lib/Driver/CMakeFiles/obj.clangDriver.dir/ToolChains/UEFI.cpp.o
[5870/7727] Building CXX object tools/clang/lib/Driver/CMakeFiles/obj.clangDriver.dir/Types.cpp.o
[5871/7727] Building CXX object tools/clang/lib/Driver/CMakeFiles/obj.clangDriver.dir/XRayArgs.cpp.o
[5872/7727] Building AMDGPUGenAsmWriter.inc...
[5873/7727] Building CXX object tools/clang/lib/Serialization/CMakeFiles/obj.clangSerialization.dir/GeneratePCH.cpp.o
[5874/7727] Building CXX object tools/clang/lib/Serialization/CMakeFiles/obj.clangSerialization.dir/ASTWriter.cpp.o
[5875/7727] Building CXX object tools/clang/lib/Serialization/CMakeFiles/obj.clangSerialization.dir/ASTReader.cpp.o
[5876/7727] Linking CXX shared library lib/libclangSema.so.21.0git
[5877/7727] Building AMDGPUGenDAGISel.inc...
[5878/7727] Building AMDGPUGenAsmMatcher.inc...
[5879/7727] Building AMDGPUGenGlobalISel.inc...
[5880/7727] Building CXX object lib/LTO/CMakeFiles/LLVMLTO.dir/LTO.cpp.o
[5881/7727] Building AMDGPUGenInstrInfo.inc...
[5882/7727] Building CXX object tools/clang/lib/Driver/CMakeFiles/obj.clangDriver.dir/ToolChains/HIPUtility.cpp.o

@llvm-ci
Copy link
Collaborator

llvm-ci commented Mar 3, 2025

LLVM Buildbot has detected a new failure on builder flang-aarch64-latest-gcc running on linaro-flang-aarch64-latest-gcc while building mlir at step 5 "build-unified-tree".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/130/builds/10704

Here is the relevant piece of the build log for the reference
Step 5 (build-unified-tree) failure: build (failure)
...
83.379 [1985/7/5392] Linking CXX shared library lib/libMLIRArithToLLVM.so.21.0git
83.448 [1985/6/5393] Linking CXX shared library lib/libMLIRArmSVETransforms.so.21.0git
83.474 [1983/7/5394] Creating library symlink lib/libMLIRVectorToArmSME.so

83.488 [1979/10/5395] Creating library symlink lib/libMLIRArithToLLVM.so
83.491 [1979/9/5396] Creating library symlink lib/libMLIRArmSVETransforms.so
83.515 [1979/8/5397] Linking CXX shared library lib/libMLIRLinalgUtils.so.21.0git
83.519 [1979/7/5398] Linking CXX shared library lib/libMLIRSparseTensorUtils.so.21.0git
83.527 [1979/6/5399] Linking CXX shared library lib/libMLIRSPIRVModuleCombiner.so.21.0git
83.663 [1979/5/5400] Building CXX object tools/mlir/lib/Dialect/Tosa/Transforms/CMakeFiles/obj.MLIRTosaTransforms.dir/TosaValidation.cpp.o
FAILED: tools/mlir/lib/Dialect/Tosa/Transforms/CMakeFiles/obj.MLIRTosaTransforms.dir/TosaValidation.cpp.o 
/usr/local/bin/c++ -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/build/tools/mlir/lib/Dialect/Tosa/Transforms -I/home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/llvm-project/mlir/lib/Dialect/Tosa/Transforms -I/home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/build/tools/mlir/include -I/home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/llvm-project/mlir/include -I/home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/build/include -I/home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/llvm-project/llvm/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -fno-lifetime-dse -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Wundef -Wno-unused-but-set-parameter -O3 -DNDEBUG -std=c++17  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -MD -MT tools/mlir/lib/Dialect/Tosa/Transforms/CMakeFiles/obj.MLIRTosaTransforms.dir/TosaValidation.cpp.o -MF tools/mlir/lib/Dialect/Tosa/Transforms/CMakeFiles/obj.MLIRTosaTransforms.dir/TosaValidation.cpp.o.d -o tools/mlir/lib/Dialect/Tosa/Transforms/CMakeFiles/obj.MLIRTosaTransforms.dir/TosaValidation.cpp.o -c /home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/llvm-project/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp
../llvm-project/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp:247:13: error: explicit specialization in non-namespace scope ‘struct {anonymous}::TosaValidation’
  247 |   template <>
      |             ^
../llvm-project/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp:261:13: error: explicit specialization in non-namespace scope ‘struct {anonymous}::TosaValidation’
  261 |   template <>
      |             ^
83.758 [1979/4/5401] Linking CXX shared library lib/libMLIRMeshTransforms.so.21.0git
83.794 [1979/3/5402] Linking CXX shared library lib/libMLIRVectorUtils.so.21.0git
83.828 [1979/2/5403] Linking CXX shared library lib/libMLIRSPIRVUtils.so.21.0git
83.923 [1979/1/5404] Linking CXX shared library lib/libMLIRTransformDialect.so.21.0git
ninja: build stopped: subcommand failed.


@llvm-ci
Copy link
Collaborator

llvm-ci commented Mar 3, 2025

LLVM Buildbot has detected a new failure on builder mlir-nvidia-gcc7 running on mlir-nvidia while building mlir at step 6 "build-check-mlir-build-only".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/116/builds/11001

Here is the relevant piece of the build log for the reference
Step 6 (build-check-mlir-build-only) failure: build (failure)
...
27.983 [80/12/4614] Linking CXX static library lib/libMLIRMemRefTestPasses.a
27.983 [80/11/4615] Linking CXX static library lib/libMLIRDLTITestPasses.a
27.983 [80/10/4616] Linking CXX static library lib/libMLIRTestFuncToLLVM.a
27.996 [80/9/4617] Linking CXX static library lib/libMLIRAffineTransformsTestPasses.a
28.013 [80/8/4618] Linking CXX static library lib/libMLIRTestAnalysis.a
28.029 [80/7/4619] Linking CXX static library lib/libMLIRTestIR.a
28.041 [80/6/4620] Linking CXX static library lib/libMLIRTestTransforms.a
28.362 [80/5/4621] Linking CXX executable tools/mlir/unittests/TableGen/MLIRTableGenTests
28.407 [80/4/4622] Linking CXX executable tools/mlir/unittests/IR/MLIRIRTests
28.407 [80/3/4623] Building CXX object tools/mlir/lib/Dialect/Tosa/Transforms/CMakeFiles/obj.MLIRTosaTransforms.dir/TosaValidation.cpp.o
FAILED: tools/mlir/lib/Dialect/Tosa/Transforms/CMakeFiles/obj.MLIRTosaTransforms.dir/TosaValidation.cpp.o 
CCACHE_CPP2=yes CCACHE_HASHDIR=yes /usr/bin/ccache /usr/bin/g++-7 -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.obj/tools/mlir/lib/Dialect/Tosa/Transforms -I/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/mlir/lib/Dialect/Tosa/Transforms -I/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.obj/tools/mlir/include -I/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/mlir/include -I/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.obj/include -I/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/llvm/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -fno-lifetime-dse -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -Wno-misleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -Wundef -Wno-unused-but-set-parameter -Wno-deprecated-copy -O3 -DNDEBUG  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -std=c++1z -MD -MT tools/mlir/lib/Dialect/Tosa/Transforms/CMakeFiles/obj.MLIRTosaTransforms.dir/TosaValidation.cpp.o -MF tools/mlir/lib/Dialect/Tosa/Transforms/CMakeFiles/obj.MLIRTosaTransforms.dir/TosaValidation.cpp.o.d -o tools/mlir/lib/Dialect/Tosa/Transforms/CMakeFiles/obj.MLIRTosaTransforms.dir/TosaValidation.cpp.o -c /vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp
/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp:247:13: error: explicit specialization in non-namespace scope ‘struct {anonymous}::TosaValidation’
   template <>
             ^
/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp:261:13: error: explicit specialization in non-namespace scope ‘struct {anonymous}::TosaValidation’
   template <>
             ^
/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp:395:8: error: too many template-parameter-lists
   bool levelCheckPool(Operation *op) {
        ^~~~~~~~~~~~~~
/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp:418:8: error: too many template-parameter-lists
   bool levelCheckConv(Operation *op) {
        ^~~~~~~~~~~~~~
/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp:474:8: error: too many template-parameter-lists
   bool levelCheckFFT(Operation *op) {
        ^~~~~~~~~~~~~
/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp: In member function ‘llvm::LogicalResult {anonymous}::TosaValidation::applyLevelCheck(mlir::Operation*)’:
/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp:618:8: error: ‘levelCheckPool’ was not declared in this scope
   if (!levelCheckPool<tosa::AvgPool2dOp>(op) ||
        ^~~~~~~~~~~~~~
/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp:618:8: note: suggested alternative: ‘levelCheckScale’
   if (!levelCheckPool<tosa::AvgPool2dOp>(op) ||
        ^~~~~~~~~~~~~~
        levelCheckScale
/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp:618:40: error: expected primary-expression before ‘>’ token
   if (!levelCheckPool<tosa::AvgPool2dOp>(op) ||
                                        ^
/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp:618:22: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses]
   if (!levelCheckPool<tosa::AvgPool2dOp>(op) ||
                      ^
/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp:619:8: error: ‘levelCheckConv’ was not declared in this scope
       !levelCheckConv<tosa::Conv2DOp>(op) ||
        ^~~~~~~~~~~~~~
/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp:619:8: note: suggested alternative: ‘levelCheckRank’
       !levelCheckConv<tosa::Conv2DOp>(op) ||
        ^~~~~~~~~~~~~~
        levelCheckRank
/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp:619:37: error: expected primary-expression before ‘>’ token

@Jerry-Ge
Copy link
Member

Jerry-Ge commented Mar 3, 2025

Will revert this PR.

lhutton1 added a commit to lhutton1/llvm-project that referenced this pull request Mar 3, 2025
@jplehr
Copy link
Contributor

jplehr commented Mar 3, 2025

Can this please be reverted @Jerry-Ge ?

@Jerry-Ge
Copy link
Member

Jerry-Ge commented Mar 3, 2025

Can this please be reverted @Jerry-Ge ?

Yes. Revert PR here: #129549

Jerry-Ge pushed a commit that referenced this pull request Mar 3, 2025
@tatwaichong tatwaichong deleted the level_check branch March 4, 2025 08:31
jph-13 pushed a commit to jph-13/llvm-project that referenced this pull request Mar 21, 2025
Add the following types of level check to consolidate the level validity
- Complete rank level checks for operations.
- Add MAX_LOG2_SIZE level check: The maximum value is 63 when the
  level is set to "none" and 31 when the level is set to "8K".
- Add MAX_TENSOR_LIST_SIZE level check : The maximum value is 256
  when the level is set to "none" and 64 when the level is set to "8K".
- TOSA 1.0 spec does not allow operations with dynamic shapes, so
  an error should be raised instead

Co-authored-by: TatWai Chong <[email protected]>

Co-authored-by: Tai Ly <[email protected]>
jph-13 pushed a commit to jph-13/llvm-project that referenced this pull request Mar 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants