Add ComputeManager; add SmoHooks for getting ClDevices, buffers
We added a new centralized OpenCL Compute manager. This can later be extended to support CUDA, SyCL, etc. SMO can be configured at build time to choose which API it will use for compute. Moreover, the ComputeMgr allows us to register buffers which are available to all cl_contexts.
This commit is contained in:
@@ -116,6 +116,50 @@ find_package(PkgConfig REQUIRED)
|
||||
find_package(FLEX REQUIRED)
|
||||
find_package(BISON REQUIRED)
|
||||
|
||||
# Find OpenCL 1.2 or higher: try find_package first, fall back to pkg-config
|
||||
find_package(OpenCL 1.2 QUIET)
|
||||
if(OpenCL_FOUND)
|
||||
# Normalize find_package variables to match pkg_check_modules naming
|
||||
set(OPENCL_FOUND TRUE)
|
||||
set(OPENCL_INCLUDE_DIRS ${OpenCL_INCLUDE_DIRS})
|
||||
# Handle both OpenCL_LIBRARY (singular) and OpenCL_LIBRARIES (plural)
|
||||
if(OpenCL_LIBRARIES)
|
||||
set(OPENCL_LIBRARIES ${OpenCL_LIBRARIES})
|
||||
else()
|
||||
set(OPENCL_LIBRARIES ${OpenCL_LIBRARY})
|
||||
endif()
|
||||
set(OPENCL_LIBRARY_DIRS "")
|
||||
message(STATUS "Found OpenCL using find_package")
|
||||
|
||||
# Check if version is available and validate
|
||||
if(OpenCL_VERSION)
|
||||
if(OpenCL_VERSION VERSION_LESS "1.2")
|
||||
message(FATAL_ERROR
|
||||
"OpenCL version ${OpenCL_VERSION} found, but 1.2 or higher is required")
|
||||
endif()
|
||||
message(STATUS "OpenCL version: ${OpenCL_VERSION}")
|
||||
else()
|
||||
message(WARNING
|
||||
"OpenCL version could not be determined. "
|
||||
"Version 1.2+ is required at runtime.")
|
||||
endif()
|
||||
else()
|
||||
# Fall back to pkg-config
|
||||
pkg_check_modules(OPENCL OpenCL)
|
||||
if(NOT OPENCL_FOUND)
|
||||
message(FATAL_ERROR
|
||||
"Failed to find OpenCL: both find_package and "
|
||||
"pkg_check_modules failed. Try installing the "
|
||||
"'ocl-icd-opencl-dev' package (or the appropriate "
|
||||
"OpenCL development package for your system)."
|
||||
)
|
||||
endif()
|
||||
message(STATUS "Found OpenCL using pkg-config")
|
||||
message(WARNING
|
||||
"OpenCL version could not be determined via pkg-config. "
|
||||
"Version 1.2+ is required at runtime.")
|
||||
endif()
|
||||
|
||||
# Need dlopen() and dlsym()
|
||||
find_library(DL_LIBRARY NAMES dl ldl)
|
||||
if(NOT DL_LIBRARY)
|
||||
|
||||
Reference in New Issue
Block a user