[llvm-dev] ORC JIT Weekly #41 -- JITLinkMemoryManager refactor update

Lang Hames via llvm-dev llvm-dev at lists.llvm.org
Sun Oct 10 23:02:03 PDT 2021

Hi All,

I was hoping to land the refactor on the mainline this weekend, but no such
luck: I've still got one outstanding remote-JIT test failure that I need to
work through tomorrow. In the meantime I've posted the very-nearly-complete
patch at [1].

Two preliminary patches that aim to support the refactor did land today:

"[ORC] Add TaskDispatch API and thread it through ExecutorProcessControl"

TaskDispatcher provides an interface for dispatching orc::Tasks that
includes a shutdown operation to wait for dispatched work to complete (in
this sense it is a generalization of
ExecutionSession::DispatchTaskFunction, which only dispatches). In the
future it will replace DispatchTaskFunction in ExecutionSession, but in
this patch the goal was to add a TaskDispatcher to ExecutorProcessControl.
The memory manager refactor makes heavy use of asynchronous functions, so
we want a way to dispatch handlers rather than running them in-place where
(e.g. in SimpleRemoteEPC) they might block a listener thread (potentially
causing a deadlock).

[ORC] Add optional RunPolicy to ExecutorProcessControl::callWrapperAsync.

The patch above fixes the (potential) deadlock issue by allowing us to
dispatch handlers, but we don't want to dispatch all of them: dispatch
involves heap allocation, and may require inter-thread communication.
That's all wasted for short handlers, like the ones that set promise values
in the synchronous convenience functions. The RunPolicy utility allows us
to specify, on a per-handler basis, whether handlers should be run
in-place, dispatched, or executed some other way.

Once the memory manager refactor lands the next big task will be updating
the Platforms and ORC runtime to use it.

-- Lang.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20211010/55f5bb54/attachment.html>

More information about the llvm-dev mailing list