[llvm] [offload] lazily load liboffload (PR #221731)
Alex Duran via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 21 06:31:34 PDT 2026
adurang wrote:
The issue trying to be solved in this PR is that there's a chicken-and-egg problem with how libomptarget needs to interact with liboffload.
We need to pass a list of backends to olInit to avoid initialazing all of them. But to know which backends to use, we need to know which backends are compatible with the images in the binary with olIsValidBinary. But that requires olInit to be called first, ....
The approach taken here is only to create the backend structures but not actually initialize them (and their devices) until an offload operation actually requires it. This allows olInit to proceed as usual, and only initialize backend compatible with the image afterwards.
Another possible solution might be to refactor liboffload to allow to check compatibility either before olInit, or have a new version of olInit that would accept a set of binaries and only initialize those backends that are comptible.
https://github.com/llvm/llvm-project/pull/221731
More information about the llvm-commits
mailing list