[PATCH] D146389: [clang-repl][CUDA] Initial interactive CUDA support for clang-repl

Jonas Hahnfeld via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 9 01:21:40 PDT 2023


Hahnfeld added a comment.

Some comments, but otherwise LGTM



================
Comment at: clang/include/clang/Interpreter/Interpreter.h:43
 public:
+  IncrementalCompilerBuilder(){};
+
----------------
and this should probably be run through `clang-format`...


================
Comment at: clang/include/clang/Interpreter/Interpreter.h:45
+
+  void SetCompilerArgs(const std::vector<const char *> Args) {
+    UserArgs = Args;
----------------



================
Comment at: clang/lib/CodeGen/CodeGenModule.cpp:6257
+  // Device code should not be at top level.
+  if (LangOpts.CUDA && LangOpts.CUDAIsDevice)
+    return;
----------------
tra wrote:
> Could you give me an example of what exactly we'll be skipping here?
> Will it affect `__device__` variables? 
> 
This concerns statements at the global scope that only concern the REPL; see https://reviews.llvm.org/D127284 for the original revision. Global variables on the other hand are passed via `EmitTopLevelDecl` -> `EmitGlobal`.


================
Comment at: clang/lib/Interpreter/Interpreter.cpp:143
   // FIXME: Print proper driver diagnostics if the driver flags are wrong.
   // We do C++ by default; append right after argv[0] if no "-x" given
   ClangArgv.insert(ClangArgv.end(), "-Xclang");
----------------
This comment should move as well


================
Comment at: clang/lib/Interpreter/Interpreter.cpp:144-146
   ClangArgv.insert(ClangArgv.end(), "-Xclang");
   ClangArgv.insert(ClangArgv.end(), "-fincremental-extensions");
   ClangArgv.insert(ClangArgv.end(), "-c");
----------------
This doesn't do what the comments claim - it appends at the end, not prepends. For that it would need to be `ClangArgv.insert(ClangArgv.begin(), "-c")`. @v.g.vassilev what do we want here? (probably doesn't block this revision, but it's odd nevertheless)


================
Comment at: clang/lib/Interpreter/Offload.h:36-37
+
+  // Write last PTX to the fatbinary file
+  // llvm::Error WriteFatbinary() const;
+
----------------
unused


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146389/new/

https://reviews.llvm.org/D146389



More information about the cfe-commits mailing list