clang 24.0.0git
DeviceOffload.h
Go to the documentation of this file.
1//===----------- DeviceOffload.h - Device Offloading ------------*- 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// This file defines the classes required for offloading to devices.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_CLANG_LIB_INTERPRETER_DEVICE_OFFLOAD_H
14#define LLVM_CLANG_LIB_INTERPRETER_DEVICE_OFFLOAD_H
15
16#include "IncrementalParser.h"
17#include "llvm/Support/Error.h"
18#include "llvm/Support/FileSystem.h"
19#include "llvm/Support/VirtualFileSystem.h"
20
21namespace clang {
24class CodeGenOptions;
25class TargetOptions;
27
29
30public:
32 CompilerInstance &DeviceInstance, CompilerInstance &HostInstance,
33 IncrementalAction *DeviceAct,
35 llvm::Error &Err, std::list<PartialTranslationUnit> &PTUs);
36
37 virtual llvm::Error GenerateOffloadBinary() = 0;
38
39 ~IncrementalDeviceParser() override;
40
41protected:
45};
46
48 CompilerInstance &DeviceCI;
49 llvm::SmallVector<char, 0> ObjectContent;
50
51 // Generate the AMDGPU object file for the last PTU.
52 llvm::Expected<llvm::StringRef> GenerateDeviceObject();
53
54public:
56 CompilerInstance &DeviceInstance, CompilerInstance &HostInstance,
57 IncrementalAction *DeviceAct,
59 llvm::Error &Err, std::list<PartialTranslationUnit> &PTUs);
60
61 llvm::Error GenerateOffloadBinary() override;
62
64};
65
67 // Generate PTX for the last PTU.
69
70 // Generate fatbinary contents in memory
71 llvm::Error GenerateFatbinary();
72
73 int SMVersion;
76
77public:
79 CompilerInstance &DeviceInstance, CompilerInstance &HostInstance,
80 IncrementalAction *DeviceAct,
82 llvm::Error &Err, std::list<PartialTranslationUnit> &PTUs);
83
84 llvm::Error GenerateOffloadBinary() override;
85
87};
88
89} // namespace clang
90
91#endif // LLVM_CLANG_LIB_INTERPRETER_DEVICE_OFFLOAD_H
CodeGenOptions - Track various options which control how the code is optimized and passed to the back...
CompilerInstance - Helper class for managing a single instance of the Clang compiler.
A custom action enabling the incremental processing functionality.
IncrementalCUDADeviceParser(CompilerInstance &DeviceInstance, CompilerInstance &HostInstance, IncrementalAction *DeviceAct, llvm::IntrusiveRefCntPtr< llvm::vfs::InMemoryFileSystem > VFS, llvm::Error &Err, std::list< PartialTranslationUnit > &PTUs)
llvm::Error GenerateOffloadBinary() override
IncrementalDeviceParser(CompilerInstance &DeviceInstance, CompilerInstance &HostInstance, IncrementalAction *DeviceAct, llvm::IntrusiveRefCntPtr< llvm::vfs::InMemoryFileSystem > VFS, llvm::Error &Err, std::list< PartialTranslationUnit > &PTUs)
virtual llvm::Error GenerateOffloadBinary()=0
llvm::IntrusiveRefCntPtr< llvm::vfs::InMemoryFileSystem > VFS
const TargetOptions & TargetOpts
IncrementalHIPDeviceParser(CompilerInstance &DeviceInstance, CompilerInstance &HostInstance, IncrementalAction *DeviceAct, llvm::IntrusiveRefCntPtr< llvm::vfs::InMemoryFileSystem > VFS, llvm::Error &Err, std::list< PartialTranslationUnit > &PTUs)
llvm::Error GenerateOffloadBinary() override
IncrementalParser(CompilerInstance &Instance, IncrementalAction *Act, llvm::Error &Err, std::list< PartialTranslationUnit > &PTUs)
std::list< PartialTranslationUnit > & PTUs
Options for controlling the target.
Top level wrappers for InstallAPI frontend operations.
The class keeps track of various objects created as part of processing incremental inputs.