[Openmp-commits] [libcxx] [mlir] [clang-tools-extra] [lld] [libc] [openmp] [flang] [compiler-rt] [llvm] [clang] [lldb] [MLIR] Enable GPU Dialect to SYCL runtime integration (PR #71430)

Fabian Mora via Openmp-commits openmp-commits at lists.llvm.org
Wed Dec 6 11:36:58 PST 2023

@@ -0,0 +1,31 @@
+//===- SPIRVToLLVMIRTranslation.cpp - Translate SPIRV to LLVM IR ----------===//
+// 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 a translation between the MLIR SPIRV dialect and
+// LLVM IR.
+#include "mlir/Target/LLVMIR/Dialect/SPIRV/SPIRVToLLVMIRTranslation.h"
+#include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
+#include "mlir/IR/BuiltinAttributes.h"
+#include "mlir/IR/Operation.h"
+#include "mlir/Target/LLVMIR/ModuleTranslation.h"
+using namespace mlir;
+using namespace mlir::LLVM;
+void mlir::registerSPIRVDialectTranslation(DialectRegistry &registry) {
+  registry.insert<spirv::SPIRVDialect>();
fabianmcg wrote:

I'm sorry I missed these. I had the same concern, the alternative was adding an inline registration call. However, I then realized that adding `#include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"` to `mlir/Target/LLVMIR/Dialect/All.h` was needed , which seemed even more undesirable thus I changed my mind and agreed on the current scheme. 
One way to clean it, is removing inline function from `mlir/Target/LLVMIR/Dialect/All.h` and creating a `MLIRToLLVMIR` library.


More information about the Openmp-commits mailing list