-
Notifications
You must be signed in to change notification settings - Fork 112
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
Clarify behavior of adapter handles when being reinitialized #781
Comments
Sounds good to me. Not being able to reinitialize adapter state would be surprising. If we were to rename init/teardown APIs, should they become loader-only? I think they should. We could also make them optional. |
Making them loader-only sounds good to me. What would it mean if they were optional? That the adapter libraries could be used directly without the loader, or that it would be possible to use the loader without initializing it? |
I meant that we could just initialize loader on first use. There's already an indirection on every ur entry point, so we could do this with no performance cost. But I'm not sure if slightly simplifying this API is worth the complication. |
That makes sense, I've started making the changes without making it optional for now to keep things simpler. I've run into a problem with the validation layer - if |
Resolved by #793 The layer now reports leaked stats when all adapters are unloaded, or when the layer is destroyed, so the problems referenced in the previous comment have been addressed |
A potential problem has come up where the UR conformance tests release the adapter(s), dropping their refcount to 0, and then reinitialize them with
urAdapterGet
in the next test.The spec is not clear whether this is allowed or not, but it currently works for the existing implementations.
I'm in favor of allowing this behavior as it supports use cases where there are multiple language runtimes using UR, but not simultaneously, so when one finishes and unloads the adapters the other can still safely initialize UR and use it. I'm not sure if there are any cases where we would have global adapter state that's not safe to reinitialize after being released. The entry points should already be thread safe.
A related issue is that the spec descriptions for
urInit
andurTearDown
are out-of-date as they still refer to adapter state. In reality these are only now useful for loader state, so this needs updated. I don't think this really needs discussion so I can make that change shortly. We could also rename themurLoaderInit
andurLoaderTearDown
if that would help clarify their purpose.The text was updated successfully, but these errors were encountered: