[llvm] [Offload] Cache symbols in program (PR #148209)

Ross Brunton via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 14 02:04:05 PDT 2025


================
@@ -714,6 +716,18 @@ Error olGetSymbol_impl(ol_program_handle_t Program, const char *Name,
                        ol_symbol_kind_t Kind, ol_symbol_handle_t *Symbol) {
   auto &Device = Program->Image->getDevice();
 
+  std::lock_guard<std::mutex> Lock{Program->SymbolListMutex};
+
+  // If it already exists, return an existing handle
+  auto Check = std::find_if(
----------------
RossBrunton wrote:

It's a vector, so sadly no "contains". Updated to use llvm::find_if though (which should be in the C++ standard library, IMO...).

I have updated it to use SmallVector rather than std::vector though.

https://github.com/llvm/llvm-project/pull/148209


More information about the llvm-commits mailing list