[clang] [clang-repl] Implement IncrementalHIPDeviceParser for HIP device compilation (PR #218337)
Aditya Sinha via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 18 04:09:21 PDT 2026
================
@@ -6,24 +6,55 @@
//
//===----------------------------------------------------------------------===//
//
-// This file implements classes required for offloading to CUDA devices.
+// This file implements classes required for offloading to HIP and CUDA devices.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_CLANG_LIB_INTERPRETER_DEVICE_OFFLOAD_H
#define LLVM_CLANG_LIB_INTERPRETER_DEVICE_OFFLOAD_H
#include "IncrementalParser.h"
-#include "llvm/Support/FileSystem.h"
+#include "llvm/Support/Error.h"
#include "llvm/Support/VirtualFileSystem.h"
+#include <memory>
+
+namespace llvm {
+class TargetMachine;
+} // namespace llvm
+
namespace clang {
struct PartialTranslationUnit;
class CompilerInstance;
class CodeGenOptions;
class TargetOptions;
class IncrementalAction;
+class IncrementalHIPDeviceParser : public IncrementalParser {
+
+public:
+ IncrementalHIPDeviceParser(
+ CompilerInstance &DeviceInstance, CompilerInstance &HostInstance,
+ IncrementalAction *DeviceAct,
+ llvm::IntrusiveRefCntPtr<llvm::vfs::InMemoryFileSystem> VFS,
+ llvm::Error &Err, std::list<PartialTranslationUnit> &PTUs);
+
+ llvm::Expected<TranslationUnitDecl *> Parse(llvm::StringRef Input) override;
+
+ llvm::Expected<llvm::StringRef> GenerateHSACO();
----------------
AdityaSinha149 wrote:
Added an interface called `IncrementalDeviceParser` and both the CUDA and HIP device parsers now implement it.
https://github.com/llvm/llvm-project/pull/218337
More information about the cfe-commits
mailing list