LLVM 22.0.0git
OffloadWrapper.h
Go to the documentation of this file.
1//===- OffloadWrapper.h --r-------------------------------------*- 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#ifndef LLVM_FRONTEND_OFFLOADING_OFFLOADWRAPPER_H
10#define LLVM_FRONTEND_OFFLOADING_OFFLOADWRAPPER_H
11
12#include "llvm/ADT/ArrayRef.h"
13#include "llvm/IR/Module.h"
15
16#include <string>
17
18namespace llvm {
19namespace offloading {
20using EntryArrayTy = std::pair<GlobalVariable *, GlobalVariable *>;
21/// Wraps the input device images into the module \p M as global symbols and
22/// registers the images with the OpenMP Offloading runtime libomptarget.
23/// \param EntryArray Optional pair pointing to the `__start` and `__stop`
24/// symbols holding the `__tgt_offload_entry` array.
25/// \param Suffix An optional suffix appended to the emitted symbols.
26/// \param Relocatable Indicate if we need to change the offloading section to
27/// create a relocatable object.
30 EntryArrayTy EntryArray, llvm::StringRef Suffix = "",
31 bool Relocatable = false);
32
33/// Wraps the input fatbinary image into the module \p M as global symbols and
34/// registers the images with the CUDA runtime.
35/// \param EntryArray Optional pair pointing to the `__start` and `__stop`
36/// symbols holding the `__tgt_offload_entry` array.
37/// \param Suffix An optional suffix appended to the emitted symbols.
38/// \param EmitSurfacesAndTextures Whether to emit surface and textures
39/// registration code. It defaults to false.
42 EntryArrayTy EntryArray,
43 llvm::StringRef Suffix = "",
44 bool EmitSurfacesAndTextures = true);
45
46/// Wraps the input bundled image into the module \p M as global symbols and
47/// registers the images with the HIP runtime.
48/// \param EntryArray Optional pair pointing to the `__start` and `__stop`
49/// symbols holding the `__tgt_offload_entry` array.
50/// \param Suffix An optional suffix appended to the emitted symbols.
51/// \param EmitSurfacesAndTextures Whether to emit surface and textures
52/// registration code. It defaults to false.
54 EntryArrayTy EntryArray,
55 llvm::StringRef Suffix = "",
56 bool EmitSurfacesAndTextures = true);
57
59 // Target/compiler specific options that are suggested to use to "compile"
60 // program at runtime.
61 std::string CompileOptions;
62 // Target/compiler specific options that are suggested to use to "link"
63 // program at runtime.
64 std::string LinkOptions;
65};
66
67/// Wraps OffloadBinaries in the given \p Buffers into the module \p M
68/// as global symbols and registers the images with the SYCL Runtime.
69/// \param Options Compiler and linker options to be encoded for the later
70/// use by a runtime for JIT compilation.
74
75} // namespace offloading
76} // namespace llvm
77
78#endif // LLVM_FRONTEND_OFFLOADING_OFFLOADWRAPPER_H
#define LLVM_ABI
Definition Compiler.h:213
Module.h This file contains the declarations for the Module class.
static LVOptions Options
Definition LVOptions.cpp:25
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:41
Lightweight error class with error context and mandatory checking.
Definition Error.h:159
A Module instance is used to store all the information related to an LLVM module.
Definition Module.h:67
StringRef - Represent a constant reference to a string, i.e.
Definition StringRef.h:55
LLVM_ABI llvm::Error wrapSYCLBinaries(llvm::Module &M, llvm::ArrayRef< char > Buffer, SYCLJITOptions Options=SYCLJITOptions())
Wraps OffloadBinaries in the given Buffers into the module M as global symbols and registers the imag...
LLVM_ABI llvm::Error wrapOpenMPBinaries(llvm::Module &M, llvm::ArrayRef< llvm::ArrayRef< char > > Images, EntryArrayTy EntryArray, llvm::StringRef Suffix="", bool Relocatable=false)
Wraps the input device images into the module M as global symbols and registers the images with the O...
std::pair< GlobalVariable *, GlobalVariable * > EntryArrayTy
LLVM_ABI llvm::Error wrapHIPBinary(llvm::Module &M, llvm::ArrayRef< char > Images, EntryArrayTy EntryArray, llvm::StringRef Suffix="", bool EmitSurfacesAndTextures=true)
Wraps the input bundled image into the module M as global symbols and registers the images with the H...
LLVM_ABI llvm::Error wrapCudaBinary(llvm::Module &M, llvm::ArrayRef< char > Images, EntryArrayTy EntryArray, llvm::StringRef Suffix="", bool EmitSurfacesAndTextures=true)
Wraps the input fatbinary image into the module M as global symbols and registers the images with the...
This is an optimization pass for GlobalISel generic memory operations.