-
Notifications
You must be signed in to change notification settings - Fork 68
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
Allow platforms to be empty #468
Conversation
One of the changes we have discussed for the next version of the SYCL specification is to add the concept of a platform "default context" and provide a guarantee that This PR interacts with that proposed addition because it would provide a way for the user to get a Therefore, if we decide to allow platforms to have no devices, I think we also need to clarify the semantics of a context that has no devices. It's also not clear to me what requirements this PR imposes on an implementation. Must an implementation expose platforms with no devices if they could theoretically support some platform? It's not clear to me what this would even mean. Just for the sake of argument, let's suppose a vendor has a SYCL implementation that can support backend B, but that support must be enabled when the SYCL compiler itself is compiled (e.g. via a build option when building the compiler). Must this implementation expose an empty platform for backend B when it is built without that support? As another scenario, let's suppose a SYCL implementation could potentially support the OpenCL backend, but only when the OpenCL runtime is installed. If that runtime is not installed, must the implementation expose an empty platform for OpenCL? The motivation listed above for this PR is the |
I think the implementation is free to decide whether it wants to show an empty platform.
Can't it just |
It's a bit difficult to discuss the impact on a change that so far has only been vaguely discussed. I don't recall that any actual API or presentation on details was made on the topic of default context. We also have had default-context semantics in our implementation since the very beginning (and indeed, the
The PR makes no such requirements. It just says that an implementation is allowed to return empty platforms. When that happens - if at all - is up to the implementation. It gives implementations more freedom.
Again, this PR makes no such requirements. It just gives implementations the freedom to return empty platforms if they wish to do so.
No, this PR would not require any change to your implementation. Implementations can continue to choose to not return empty platforms. It just allows an alternative behavior. |
The changes looks good to me, I have suggested some minor edits for consistency. I also noticed that there are some references to the requirement that a platform always contain at least on device is also described in the architecture section of the specification, so I think we need to change the wording there too. §3.5. The SYCL platform model
§3.6.1. Platform mixed version support
§3.7.1.1. SYCL backend resources managed by the SYCL application
We may also want to drop the "based on the OpenCL platform model" wording.
I think we could handle this by having the |
Co-authored-by: Gordon Brown <gordon@codeplay.com>
@AerialMantis I've changed the places you have highlighted to make clear that empty platforms are allowed too. I've also removed the reference to the OpenCL platform model. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks!
Allow platforms to be empty (cherry picked from commit 35c52d6)
Allow platforms to be empty (cherry picked from commit 35c52d6)
As discussed, this PR allows platforms to be empty. The motivating example was that of a CUDA backend where
CUDA_VISIBILE_DEVICES
has been set to expose no devices.Most info queries like
platform::vendor
orplatform::name
can still be answered in this case. For the list of supported extensions, this PR assumes that an empty platform will not advertise any extension.Another option might be to say that if an empty platform chooses to still advertise some extensions, they must be supported for all devices potentially supported by the platform, even if those devices are unavailable at the moment. In the example of the CUDA backend, we would e.g. know that any device that could be exposed once
CUDA_VISIBLE_DEVICES
is unset would also support USM.I don't have a strong opinion on whether this additional rule is worth the effort.