brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.7 KiB · a31bd5a Raw
56 lines · c
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-exception6//7//===----------------------------------------------------------------------===//8//9// This file implements classes required for offloading to CUDA devices.10//11//===----------------------------------------------------------------------===//12 13#ifndef LLVM_CLANG_LIB_INTERPRETER_DEVICE_OFFLOAD_H14#define LLVM_CLANG_LIB_INTERPRETER_DEVICE_OFFLOAD_H15 16#include "IncrementalParser.h"17#include "llvm/Support/FileSystem.h"18#include "llvm/Support/VirtualFileSystem.h"19 20namespace clang {21struct PartialTranslationUnit;22class CompilerInstance;23class CodeGenOptions;24class TargetOptions;25class IncrementalAction;26 27class IncrementalCUDADeviceParser : public IncrementalParser {28 29public:30  IncrementalCUDADeviceParser(31      CompilerInstance &DeviceInstance, CompilerInstance &HostInstance,32      IncrementalAction *DeviceAct,33      llvm::IntrusiveRefCntPtr<llvm::vfs::InMemoryFileSystem> VFS,34      llvm::Error &Err, std::list<PartialTranslationUnit> &PTUs);35 36  // Generate PTX for the last PTU.37  llvm::Expected<llvm::StringRef> GeneratePTX();38 39  // Generate fatbinary contents in memory40  llvm::Error GenerateFatbinary();41 42  ~IncrementalCUDADeviceParser();43 44protected:45  int SMVersion;46  llvm::SmallString<1024> PTXCode;47  llvm::SmallVector<char, 1024> FatbinContent;48  llvm::IntrusiveRefCntPtr<llvm::vfs::InMemoryFileSystem> VFS;49  CodeGenOptions &CodeGenOpts; // Intentionally a reference.50  const TargetOptions &TargetOpts;51};52 53} // namespace clang54 55#endif // LLVM_CLANG_LIB_INTERPRETER_DEVICE_OFFLOAD_H56