-
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
Allocating local mem in device functions is not explictly forbidden by the SPIR-V OpenCL Env #1221
Comments
The easiest thing to do here would be to add text similar to that in the OpenCL C spec, something like:
However, there are two real-world problems with this proposed resolution:
Should we document the global scope requirement in the OpenCL SPIR-V environment spec, since this is what the usual SPIR-V generation toolchains is generating? |
I think yes, and perhaps explicitly allow defining locals in device functions even for OpenCL C since it practically likely ("accidentally") works for every driver anyhow. |
Actually, maybe we don't need to do anything. The SPIR-V spec already says:
This means that the transformation Clang is doing is the only valid way to use local memory in SPIR-V. |
OK, so the main question that remains is that should we lift the OpenCL C restriction as well assuming all/most are using the Clang's implementation for locals. |
Discussed in the August 20th teleconference. There is some interest in lifting the OpenCL C restriction (probably as an extension?), which should be a pretty light lift for most implementors that are using Clang. I've moved this back to "To do" until somebody is able to pick this up, since there is (currently) nothing more to discuss in the working group. |
Currently it's possible to create a SPIR-V that allocates local mem in non-kernel functions although this is explicitly forbidden in OpenCL C spec for obvious implementation challenges. It is even accepted by various drivers (which likely just inline everything anyhow, effectively making the allocation happen inside the kernel).
Shall we add a check to the SPIR-V OpenCL Env for this case?
The text was updated successfully, but these errors were encountered: