[all-commits] [llvm/llvm-project] e0b3f4: [ORC] Automatically suspend and resume lookups tha...

lhames via All-commits all-commits at lists.llvm.org
Mon Jul 31 12:17:33 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e0b3f45d87a6677efb59d8a4f0e6deac9c346c76
      https://github.com/llvm/llvm-project/commit/e0b3f45d87a6677efb59d8a4f0e6deac9c346c76
  Author: Lang Hames <lhames at gmail.com>
  Date:   2023-07-31 (Mon, 31 Jul 2023)

  Changed paths:
    M llvm/include/llvm/ExecutionEngine/Orc/Core.h
    M llvm/lib/ExecutionEngine/Orc/Core.cpp
    M llvm/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp

  Log Message:
  -----------
  [ORC] Automatically suspend and resume lookups that depend on in-use generators.

Access to individual DefinitionGenerators is serialized in order to make
generators easier to implement: serializing access means that tryToGenerate
methods don't have to handle concurrent, potentially overlapping, requests.

Prior to this patch serialization was achieved by having each lookup acquire a
lock on each generator, however this causes the lookup thread to block if the
generator is in use. In the common case where many objects reference some
common library symbol that is provided by a generator this may cause many
threads to block concurrently preventing progress on other work.

This patch changes the model so that lookups are automatically suspended if
they need to use a generator that is already in use, and then automatically
resumed once the generator is free. This is achieved by reusing the lookup
suspension machinery that was introduced in 069919c9ba3 for optionally
asynchronous generators.




More information about the All-commits mailing list