[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"
[2].

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.
[3]

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.

[1]
https://github.com/lhames/llvm-project/commit/4be3e7a00bbbc41308c8eadb40c234198b17fb71
[2]
https://github.com/llvm/llvm-project/commit/f34116168964be7886622e6f9b574f5c2d460ac9
[3]
https://github.com/llvm/llvm-project/commit/4d7cea3d2e833209d06e201a273f97342035c196
-------------- 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