Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:43:55

0001 //===- OffloadWrapper.h --r-------------------------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLVM_FRONTEND_OFFLOADING_OFFLOADWRAPPER_H
0010 #define LLVM_FRONTEND_OFFLOADING_OFFLOADWRAPPER_H
0011 
0012 #include "llvm/ADT/ArrayRef.h"
0013 #include "llvm/IR/Module.h"
0014 
0015 namespace llvm {
0016 namespace offloading {
0017 using EntryArrayTy = std::pair<GlobalVariable *, GlobalVariable *>;
0018 /// Wraps the input device images into the module \p M as global symbols and
0019 /// registers the images with the OpenMP Offloading runtime libomptarget.
0020 /// \param EntryArray Optional pair pointing to the `__start` and `__stop`
0021 /// symbols holding the `__tgt_offload_entry` array.
0022 /// \param Suffix An optional suffix appended to the emitted symbols.
0023 /// \param Relocatable Indicate if we need to change the offloading section to
0024 /// create a relocatable object.
0025 llvm::Error wrapOpenMPBinaries(llvm::Module &M,
0026                                llvm::ArrayRef<llvm::ArrayRef<char>> Images,
0027                                EntryArrayTy EntryArray,
0028                                llvm::StringRef Suffix = "",
0029                                bool Relocatable = false);
0030 
0031 /// Wraps the input fatbinary image into the module \p M as global symbols and
0032 /// registers the images with the CUDA runtime.
0033 /// \param EntryArray Optional pair pointing to the `__start` and `__stop`
0034 /// symbols holding the `__tgt_offload_entry` array.
0035 /// \param Suffix An optional suffix appended to the emitted symbols.
0036 /// \param EmitSurfacesAndTextures Whether to emit surface and textures
0037 /// registration code. It defaults to false.
0038 llvm::Error wrapCudaBinary(llvm::Module &M, llvm::ArrayRef<char> Images,
0039                            EntryArrayTy EntryArray, llvm::StringRef Suffix = "",
0040                            bool EmitSurfacesAndTextures = true);
0041 
0042 /// Wraps the input bundled image into the module \p M as global symbols and
0043 /// registers the images with the HIP runtime.
0044 /// \param EntryArray Optional pair pointing to the `__start` and `__stop`
0045 /// symbols holding the `__tgt_offload_entry` array.
0046 /// \param Suffix An optional suffix appended to the emitted symbols.
0047 /// \param EmitSurfacesAndTextures Whether to emit surface and textures
0048 /// registration code. It defaults to false.
0049 llvm::Error wrapHIPBinary(llvm::Module &M, llvm::ArrayRef<char> Images,
0050                           EntryArrayTy EntryArray, llvm::StringRef Suffix = "",
0051                           bool EmitSurfacesAndTextures = true);
0052 } // namespace offloading
0053 } // namespace llvm
0054 
0055 #endif // LLVM_FRONTEND_OFFLOADING_OFFLOADWRAPPER_H