clCreateContextFromType with properties != NULL and unspecified or invalid platform
- The documentation does not specify what error code should be returned by
clCreateContextFromTypeif all of the following conditions are met:
properties != NULL;propertiesdidn't specify a platform;- no platform could be selected.
I guess it should specify that CL_INVALID_PLATFORM is returned in this case (the same as if properties == NULL).
- The documentation is ambigous on which error code should be returned by
clCreateContextFromTypeifpropertiesspecify an invalid platform:
- CL_INVALID_PLATFORM ... if platform value specified in properties is not a valid platform.
- CL_INVALID_PROPERTY ..., if the value specified for a supported property name is not valid ...
For (1) we could modify the error description to cover this scenario if you'd like. I agree CL_INVALID_PLATFORM makes the most sense. Maybe something like:
CL_INVALID_PLATFORM if ~~properties is NULL~~ no platform value is specified and no platform could be selected or if the platform value specified in properties is not a valid platform.
For (2), I think either error code would be valid, and I don't believe we currently test for this case. If it's helpful though, I recommend chosing the more descriptive error, so CL_INVALID_PLATFORM.
Note, if you are implementing an ICD then this checking will happen in the OpenCL ICD loader: link.
@bashbaug Thank you for your reply.
For (1) we could modify the error description to cover this scenario if you'd like. I agree
CL_INVALID_PLATFORMmakes the most sense. Maybe something like:
This is exactly what I had in mind.
I recommend chosing the more descriptive error, so
CL_INVALID_PLATFORM.
Thanks, I'll follow your suggestion. This would also be closer to how other interfaces handle invalid platforms.
Note, if you are implementing an ICD then this checking will happen in the OpenCL ICD loader:
Ah, right, I always forget about this. Thanks for reminding. I'm implementing both ICD and non-ICD modes (controlled by a preprocessor define), so I would need to handle it myself in the non-ICD mode anyway. I'll use the link as a reference.
I think this issue was fixed by #1063 so I'm going to close this issue. If anything more is needed please feel free to re-open it or file another issue - thanks!