Skip to content
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

error: ‘getContextPlatformVersion’ is not a member of ‘cl::detail’ in some cases #108

Closed
TSlivede opened this issue Jul 29, 2020 · 6 comments · Fixed by #245
Closed
Assignees

Comments

@TSlivede
Copy link
Contributor

TSlivede commented Jul 29, 2020

I got the error error: ‘getContextPlatformVersion’ is not a member of ‘cl::detail’ when building my project:

It seems that on line 7078 (and 7144, 7209, 7276, 7327 and 7378) getContextPlatformVersion is used in a #if-block that is enabled if CL_HPP_MINIMUM_OPENCL_VERSION is less than 200:

#if CL_HPP_TARGET_OPENCL_VERSION >= 200 && CL_HPP_MINIMUM_OPENCL_VERSION < 200
            // Run-time decision based on the actual platform
            {
                cl_uint version = detail::getContextPlatformVersion(context());

However, the (only) definition of getContextPlatformVersion (on line 1738) is only active if CL_HPP_MINIMUM_OPENCL_VERSION is less than 120 (checked at line 1700):

#if CL_HPP_TARGET_OPENCL_VERSION >= 120 && CL_HPP_MINIMUM_OPENCL_VERSION < 120

The error should therefore always ocure if CL_HPP_TARGET_OPENCL_VERSION is 200 and CL_HPP_MINIMUM_OPENCL_VERSION is 120.

I could complile my project by changing that line (1700) to this:

#if CL_HPP_TARGET_OPENCL_VERSION >= 120 && CL_HPP_MINIMUM_OPENCL_VERSION < 200

But I don't know if that is the proper solution or if that would have other side effects, therefore I didn't create a pull request and instead created this issue...

@bashbaug
Copy link
Contributor

I think your proposed fix is fine, but I wonder if the checks around getContextPlatformVersion could be removed outright vs. expanded since it doesn't look like it uses any newer OpenCL functionality.

@jrprice , do you have any input? It looks like you were involved in the PR that added these checks: #14 (comment). Thanks!

@sudden6
Copy link

sudden6 commented Feb 15, 2021

Hi, I'm hitting the same problem, is there a fix already in master?

@bashbaug
Copy link
Contributor

It doesn't look like this has been fixed yet.

@jrprice do you have a preferred fix? It looks like we could:

  • Change the guards around the definitions of these functions to CL_HPP_MINIMUM_OPENCL_VERSION < 200, as described above, which will work for the current usage.
  • Remove the guards entirely so these functions are available regardless of the target and minimum versions, just in case additional usages are added in the future.

@jrprice
Copy link
Contributor

jrprice commented Apr 9, 2021

Sorry for taking so long to look at this.

Remove the guards entirely so these functions are available regardless of the target and minimum versions

I can't think of a reason to keep them, so I'd vote for this fix.

@sudden6
Copy link

sudden6 commented Mar 22, 2022

Although the header file has been moved, this is still not fixed.

sudden6 added a commit to sudden6/m-queens that referenced this issue Mar 22, 2022
sudden6 added a commit to sudden6/m-queens that referenced this issue Mar 27, 2022
@bashbaug
Copy link
Contributor

bashbaug commented Jun 5, 2023

Looking through old issues I thought this might have been fixed, but it looks like we still have a problem.

The guard for getContextPlatformVersion is still:

#if CL_HPP_TARGET_OPENCL_VERSION >= 120 && CL_HPP_MINIMUM_OPENCL_VERSION < 120

But some of the places where it is used is guarded by:

#if CL_HPP_TARGET_OPENCL_VERSION >= 200 && CL_HPP_MINIMUM_OPENCL_VERSION < 200

This means we'll generate an error when CL_HPP_TARGET_OPENCL_VERSION is >= 200 and CL_HPP_MINIMUM_OPENCL_VERSION is < 200 and >= 120.... which is super unfortunate since I think a common build configuration will be to target OpenCL 3.0 but support OpenCL 1.2.

We should fix this. If we don't want to remove the guards around getContextPlatformVersion entirely, I think we could change the guard for it to be < 200 also and it'd work:

#if CL_HPP_TARGET_OPENCL_VERSION >= 120 && CL_HPP_MINIMUM_OPENCL_VERSION < 120

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants