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

Sang Ik Lee via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 17 13:34:43 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>();
----------------
silee2 wrote:

There is no translation but dialect registration is still required as spirv.target_env is attached and appears in input.
Other option is to register SPIR-V dialect directly here: mlir/include/mlir/Target/LLVMIR/Dialect/All.h
@joker-eph Any thoughts? Or better option?





https://github.com/llvm/llvm-project/pull/71430


More information about the cfe-commits mailing list