Skip to content

Conversation

@kr-2003
Copy link
Contributor

@kr-2003 kr-2003 commented Aug 24, 2025

This is a refactoring PR. It sinks RemoteJITUtils into Interpreter and IncrementalExecutor classes.

Comment on lines 334 to 337
if (::OffloadArch.empty()) {
::OffloadArch = "sm_35";
}
CB.SetOffloadArch(OffloadArch);
CB.SetOffloadArch(::OffloadArch);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these changes relevant to the current PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes. if not done, it gives following error:

error: reference to 'OffloadArch' is ambiguous

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which compiler is this? Why it works upstream?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ping.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(base) llvm-project-test % clang --version       
Homebrew clang version 20.1.6
Target: arm64-apple-darwin24.5.0
Thread model: posix
InstalledDir: /opt/homebrew/Cellar/llvm/20.1.6/bin
Configuration file: /opt/homebrew/etc/clang/arm64-apple-darwin24.cfg'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what's the problem but if that does not fail upstream please remove it. What are the other declarations that make OffloadArch ambiguous?

@vgvassilev vgvassilev requested a review from lhames August 25, 2025 12:07
@github-actions
Copy link

github-actions bot commented Aug 25, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

@kr-2003 kr-2003 requested a review from vgvassilev August 26, 2025 15:12
@kr-2003 kr-2003 changed the title [Clang-Repl] Add Lambda Support, PID Retrieval, and Dynamic liborc_rt Path in Clang-Repl [Clang-Repl] Sinking RemoteJITUtils into Interpreter class(Refactoring) Aug 31, 2025
@kr-2003 kr-2003 requested a review from vgvassilev August 31, 2025 18:18
@kr-2003 kr-2003 requested a review from vgvassilev September 6, 2025 06:25
Comment on lines 334 to 337
if (::OffloadArch.empty()) {
::OffloadArch = "sm_35";
}
CB.SetOffloadArch(OffloadArch);
CB.SetOffloadArch(::OffloadArch);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what's the problem but if that does not fail upstream please remove it. What are the other declarations that make OffloadArch ambiguous?

@kr-2003
Copy link
Contributor Author

kr-2003 commented Sep 7, 2025

Not sure what's the problem but if that does not fail upstream please remove it. What are the other declarations that make OffloadArch ambiguous?

Sorry, it was mistake from my side. I included using namespace clang; in the ClangRepl.cpp. So, it was getting confused by the enum declared by the same name in clang's ns.

@kr-2003 kr-2003 changed the title [Clang-Repl] Sinking RemoteJITUtils into Interpreter class(Refactoring) [clang-repl] Sink RemoteJITUtils into Interpreter class (NFC) Sep 7, 2025
@kr-2003 kr-2003 requested a review from vgvassilev September 7, 2025 07:20
Copy link
Contributor

@vgvassilev vgvassilev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you for the patience.

@vgvassilev vgvassilev merged commit 645dd32 into llvm:main Sep 7, 2025
9 checks passed
Comment on lines +123 to +144
public:
struct JITConfig {
/// Indicates whether out-of-process JIT execution is enabled.
bool IsOutOfProcess = false;
/// Path to the out-of-process JIT executor.
std::string OOPExecutor = "";
std::string OOPExecutorConnect = "";
/// Indicates whether to use shared memory for communication.
bool UseSharedMemory = false;
/// Representing the slab allocation size for memory management in kb.
unsigned SlabAllocateSize = 0;
/// Path to the ORC runtime library.
std::string OrcRuntimePath = "";
/// PID of the out-of-process JIT executor.
uint32_t ExecutorPID = 0;

JITConfig()
: IsOutOfProcess(false), OOPExecutor(""), OOPExecutorConnect(""),
UseSharedMemory(false), SlabAllocateSize(0), OrcRuntimePath(""),
ExecutorPID(0) {}
};

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From discussion with @vgvassilev it sounds like the motivation here was to defer creation of the LLJITBuilder until you can ask the driver for the runtime path?

This solves that problem, but eliminates the ability to configure the builder.

What if you added a new member and callback along the lines of:

  std::optional<std::string> OrcRuntimePath;
  llvm::unique_function<LLJITBuilder(&JITConfig)> MakeJITBuilder = makeDefaultJITBuilder;

then in the setup path you'd have something like:

  if (!Cfg.OrcRuntimePath) {
    if (OrcRTPath = getOrcRuntimePath(TC))
      CfgOrcRuntimePath = std::move(*OrcRTPath);
    else
      return OrcRTPath.takeError();
  }
  auto JITBuilder = MakeJITBuilder(Cfg);
  if (auto JOrErr = JITBuilder.create())
    J = std::move(*JOrErr);
  else
    return JOrErr.takeError();
  ...

The extra indirection gives you the opportunity to ask the driver for the path (if one isn't provided) while still giving the client the opportunity to configure the LLJITBuilder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants