[Mlir-commits] [mlir] [mlir][Tosa] Include generated interface declarations outside of namespaces (PR #236103)

Markus Böck llvmlistbot at llvm.org
Tue Oct 27 05:58:37 PDT 2026


https://github.com/zero9178 created https://github.com/llvm/llvm-project/pull/236103

`TosaInterfaces.h.inc` was included from within `namespace mlir::tosa`, relying on the interfaces in `TosaInterfaces.td` having an empty `cppNamespace`. The interfaces now specify `cppNamespace = "::mlir::tosa"` and the generated header is included at global scope.



>From b6b56e1e032bcebace9b5599b3255e46fd3cb509 Mon Sep 17 00:00:00 2001
From: Markus Boeck <mboeck at nvidia.com>
Date: Tue, 27 Oct 2026 10:10:07 +0000
Subject: [PATCH] [mlir][Tosa] Include generated interface declarations outside
 of namespaces

`TosaInterfaces.h.inc` was included from within `namespace mlir::tosa`,
relying on the interfaces in `TosaInterfaces.td` having an empty
`cppNamespace`. The interfaces now specify `cppNamespace = "::mlir::tosa"`
and the generated header is included at global scope.
---
 mlir/include/mlir/Dialect/Tosa/IR/TosaInterfaces.td | 1 +
 mlir/include/mlir/Dialect/Tosa/IR/TosaOps.h         | 5 +++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/mlir/include/mlir/Dialect/Tosa/IR/TosaInterfaces.td b/mlir/include/mlir/Dialect/Tosa/IR/TosaInterfaces.td
index 5dfa1e681161d9..4078aae1f917a1 100644
--- a/mlir/include/mlir/Dialect/Tosa/IR/TosaInterfaces.td
+++ b/mlir/include/mlir/Dialect/Tosa/IR/TosaInterfaces.td
@@ -19,6 +19,7 @@ def TosaOpInterface : OpInterface<"TosaOp"> {
   let description = [{
     Implemented by ops that correspond to the Tosa specification.
   }];
+  let cppNamespace = "::mlir::tosa";
 }
 
 #endif
diff --git a/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.h b/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.h
index db16c74e659cc0..c2177f5e225acf 100644
--- a/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.h
+++ b/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.h
@@ -48,11 +48,12 @@ void printVariableOpTypeOrInitialValue(OpAsmPrinter &p, Operation *op,
                                        DenseElementsAttr varShapeAttr,
                                        TypeAttr typeAttr,
                                        Attribute initialValueAttr);
+} // namespace tosa
+} // namespace mlir
 
 #include "mlir/Dialect/Tosa/IR/TosaInterfaces.h.inc"
 
-} // namespace tosa
-
+namespace mlir {
 namespace OpTrait {
 namespace tosa {
 



More information about the Mlir-commits mailing list