[Mlir-commits] [mlir] [mlir][tosa][spirv] Add TOSA to SPIR-V TOSA pass plumbing (PR #196539)
Davide Grohmann
llvmlistbot at llvm.org
Wed May 13 01:04:10 PDT 2026
================
@@ -0,0 +1,182 @@
+//===- TosaToSPIRVTosa.cpp - TOSA to SPIR-V Graph/TOSA patterns -----------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This file implements patterns to convert TOSA IR to SPIR-V Graph/TOSA.
+//
+//===----------------------------------------------------------------------===//
+
+#include "mlir/Conversion/TosaToSPIRVTosa/TosaToSPIRVTosa.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
+#include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
+#include "mlir/Dialect/SPIRV/IR/SPIRVOps.h"
+#include "mlir/Transforms/DialectConversion.h"
+#include "llvm/ADT/STLExtras.h"
+
+#define DEBUG_TYPE "tosa-to-spirv-tosa-pattern"
+
+namespace mlir::tosa {
+namespace {
+
+constexpr StringLiteral graphARMInterfaceVarABIAttrName =
+ "spv.grapharm.interface_var_abi";
----------------
davidegrohmann wrote:
Using `spirv.grapharm.interface_var_abi` makes the SPIR-V dialect verifier reject the input attributes as unknown before the conversion pattern runs. The issue is that `spirv.*` argument/result attributes are treated as SPIR-V dialect attributes. See:
https://github.com/llvm/llvm-project/blob/main/mlir/lib/Dialect/SPIRV/IR/SPIRVDialect.cpp#L1095
That is why I used the `spv.grapharm.interface_var_abi` spelling for the source-side annotation and normalize it to `spirv.interface_var_abi` on the generated `spirv.ARM.Graph`.
Would you prefer dropping the `spv.` prefix and spelling this as `grapharm.interface_var_abi` instead?
https://github.com/llvm/llvm-project/pull/196539
More information about the Mlir-commits
mailing list