[libc] Switch to using the generic `<gpuintrin.h>` implementations (#121810)
[llvm-project.git] / clang / lib / Interpreter / DeviceOffload.h
blobb9a1acab004c3c4858d5ee96d8bd7d3fa9897d6a
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 implements classes required for offloading to CUDA devices.
11 //===----------------------------------------------------------------------===//
13 #ifndef LLVM_CLANG_LIB_INTERPRETER_DEVICE_OFFLOAD_H
14 #define LLVM_CLANG_LIB_INTERPRETER_DEVICE_OFFLOAD_H
16 #include "IncrementalParser.h"
17 #include "llvm/Support/FileSystem.h"
18 #include "llvm/Support/VirtualFileSystem.h"
20 namespace clang {
21 struct PartialTranslationUnit;
22 class CompilerInstance;
23 class CodeGenOptions;
24 class TargetOptions;
26 class IncrementalCUDADeviceParser : public IncrementalParser {
27 const std::list<PartialTranslationUnit> &PTUs;
29 public:
30 IncrementalCUDADeviceParser(
31 std::unique_ptr<CompilerInstance> DeviceInstance,
32 CompilerInstance &HostInstance,
33 llvm::IntrusiveRefCntPtr<llvm::vfs::InMemoryFileSystem> VFS,
34 llvm::Error &Err, const std::list<PartialTranslationUnit> &PTUs);
36 llvm::Expected<TranslationUnitDecl *> Parse(llvm::StringRef Input) override;
38 // Generate PTX for the last PTU.
39 llvm::Expected<llvm::StringRef> GeneratePTX();
41 // Generate fatbinary contents in memory
42 llvm::Error GenerateFatbinary();
44 ~IncrementalCUDADeviceParser();
46 protected:
47 std::unique_ptr<CompilerInstance> DeviceCI;
48 int SMVersion;
49 llvm::SmallString<1024> PTXCode;
50 llvm::SmallVector<char, 1024> FatbinContent;
51 llvm::IntrusiveRefCntPtr<llvm::vfs::InMemoryFileSystem> VFS;
52 CodeGenOptions &CodeGenOpts; // Intentionally a reference.
53 const TargetOptions &TargetOpts;
56 } // namespace clang
58 #endif // LLVM_CLANG_LIB_INTERPRETER_DEVICE_OFFLOAD_H