1 //===- ConvertSPIRVToLLVMPass.h - SPIR-V dialect to LLVM pass ---*- C++ -*-===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 // 9 // Provides a pass to lower from SPIR-V dialect to LLVM dialect. 10 // 11 //===----------------------------------------------------------------------===// 12 13 #ifndef MLIR_CONVERSION_SPIRVTOLLVM_CONVERTSPIRVTOLLVMPASS_H 14 #define MLIR_CONVERSION_SPIRVTOLLVM_CONVERTSPIRVTOLLVMPASS_H 15 16 #include <memory> 17 18 namespace mlir { 19 class ModuleOp; 20 template <typename T> 21 class OperationPass; 22 23 /// Creates a pass to emulate `gpu.launch_func` call in LLVM dialect and lower 24 /// the host module code to LLVM. 25 /// 26 /// This transformation creates a sequence of global variables that are later 27 /// linked to the varables in the kernel module, and a series of copies to/from 28 /// them to emulate the memory transfer from the host or to the device sides. It 29 /// also converts the remaining Standard dialect into LLVM dialect, emitting C 30 /// wrappers. 31 std::unique_ptr<OperationPass<ModuleOp>> createLowerHostCodeToLLVMPass(); 32 33 /// Creates a pass to convert SPIR-V operations to the LLVMIR dialect. 34 std::unique_ptr<OperationPass<ModuleOp>> createConvertSPIRVToLLVMPass(); 35 36 } // namespace mlir 37 38 #endif // MLIR_CONVERSION_SPIRVTOLLVM_CONVERTSPIRVTOLLVMPASS_H_ 39