-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shared Arena Env Allocator Usage Across Modules #20027
Comments
CreateEnv should only be called once per process. |
Is there a way I can query if it's already been created so the two modules can cooperate? |
I'm sorry. No, there isn't such a function. |
Ah ok, and when you say "should", is it undefined behavior to call it more than once? Same question as for calling CreateAndRegisterAllocatorV2. I'm also all ears for alternative solutions if anyone has one, although I understand that's not really onnx's problem. |
This issue has been automatically marked as stale due to inactivity and will be closed in 30 days if no further activity occurs. If further support is needed, please provide an update and/or more details. |
Describe the issue
This is a precursor to #19795, I've created a full demo for this one, and will have a full demo for the first issue soon. I'd like to verify that the error code I'm receiving is 1. expected, and 2. safe to ignore.
When an executable (
demo.exe
) dynamically loads two DLLs (a.dll
andb.dll
) that separately create a session through usage of a shared static library (lib
) the following code causes a ORT_INVALID_ARGUMENT status -Normally to ensure the allocator is only created once in the process, I could for instance use thread local storage indices with
TlsAlloc
,TlsGetValue
, etc, but each module has it's own thread local state. So it seems like the best I can do (without pulling out some of the library to it's own shared DLL which I don't want to do) is ignore the error, which from the logs seems benign as no extra allocations occur.To reproduce
I've attached a complete example, model and onnxruntime (1.17) -
demo.zip
A few things of note -
CreateEnvWithGlobalThreadPools
), but it seems that as long as I don't call ReleaseEnv until the very end onnx will hand back the first env createdAddSessionConfigEntry(m_session_options, kOrtSessionOptionsConfigUseEnvAllocators, "1")
DisableCpuMemArena(m_session_options)
) for the session as without doing so it recreates the BFCArena according to the logs, but then ends up using the one in the env anyway, so this seems undesiredTo see the error, uncomment the
ORT_ABORT_ON_ERROR
macro -Urgency
No response
Platform
Windows
OS Version
10
ONNX Runtime Installation
Released Package
ONNX Runtime Version or Commit ID
1.17
ONNX Runtime API
C
Architecture
X64
Execution Provider
Default CPU
Execution Provider Library Version
No response
The text was updated successfully, but these errors were encountered: