-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Fixed parser of OpenCL 3.0 for NVIDIA GPU #2001
base: main
Are you sure you want to change the base?
Conversation
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.
Can you please elaborate on the reasoning behind this PR?
Adding 3.0 to the list of OpenCL version makes sense. We are still looking for your comments on the rationale for remaining changes. |
@vpirogov @densamoilov Because this code successfully detect version of OpenCL library, but this one with CMAKE_CHECK_SYMBOLS cannot, even with defined variables to include dirs and link libraries: ...
function(_FIND_OPENCL_VERSION)
include(CheckSymbolExists)
include(CMakePushCheckState)
set(CMAKE_REQUIRED_QUIET ${OpenCL_FIND_QUIETLY})
set(CMAKE_REQUIRED_INCLUDES ${OpenCL_INCLUDE_DIR})
set(CMAKE_REQUIRED_LIBRARIES ${OpenCL_LIBRARY})
CMAKE_PUSH_CHECK_STATE()
foreach(VERSION "3_0" "2_2" "2_1" "2_0" "1_2" "1_1" "1_0")
if(APPLE)
CHECK_SYMBOL_EXISTS(
CL_VERSION_${VERSION}
"${OpenCL_INCLUDE_DIR}/Headers/cl.h"
OPENCL_VERSION_${VERSION})
else()
CHECK_SYMBOL_EXISTS(
CL_VERSION_${VERSION}
"${OpenCL_INCLUDE_DIR}/CL/cl.h"
OPENCL_VERSION_${VERSION})
endif()
message(STATUS "OPENCL_VERSION_${VERSION} = ${OPENCL_VERSION_${VERSION}}")
if(OPENCL_VERSION_${VERSION})
string(REPLACE "_" "." VERSION "${VERSION}")
set(OpenCL_VERSION_STRING ${VERSION} PARENT_SCOPE)
string(REGEX MATCHALL "[0-9]+" version_components "${VERSION}")
list(GET version_components 0 major_version)
list(GET version_components 1 minor_version)
set(OpenCL_VERSION_MAJOR ${major_version} PARENT_SCOPE)
set(OpenCL_VERSION_MINOR ${minor_version} PARENT_SCOPE)
break()
endif()
endforeach()
CMAKE_POP_CHECK_STATE()
endfunction()
... For |
CL_VERSION_${VERSION} | ||
"${OpenCL_INCLUDE_DIR}/Headers/cl.h" | ||
OPENCL_VERSION_${VERSION}) | ||
foreach(VERSION "3_0" "2_2" "2_1" "2_0" "1_2" "1_1" "1_0") |
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.
(random place)
There are a few things that look suspicious to me:
- We didn't implement FindOpenCL.cmake module, we've taken it from CMake (see here) and it still uses
CHECK_SYMBOL_EXISTS
and the community seems to be fine with it - The version macros are standardized by the OpenCL specification so if the macros are missing then it likely means that there is something wrong with the OpenCL implementation you use
- It should be fine to check
cl.h
header as it includescl_version.h
header andCHECK_SYMBOL_EXISTS
does perform a preprocessing
Given all this, I think the issue you encounter is somewhere on your end.
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.
@densamoilov Here is my OpenCL files for NVIDIA GPU:
cl_files.zip
It looks fine for me
Considering the discussion the best way forward is updating FindOpenCL.cmake from upstream. |
No description provided.