Detect OpenCL 3.0 __opencl_c_subgroups in CLAccelerator and guard cl_khr_subgroups pragma

Open
#312 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
cpp
Domain
backend

Research direction

Start with src/opencl/cl_accelerator.cpp and inspect how CLAccelerator::set_device detects OpenCL C versions and subgroup support, keeping the stated OpenCL C++ 1.2 compatibility in mind. Then review the three named .cl files and their generated headers under src/opencl/generated/auto_*.hpp. Done means the OpenCL 3.0 subgroup feature is detected, the extension pragmas are guarded, and the named tests compile and pass on an OpenCL 3.0 device.

Written by the indexing model from the issue text.

Description

task

Problem: CLAccelerator::set_device in src/opencl/cl_accelerator.cpp only checks CL_DEVICE_OPENCL_C_VERSION (>= 2.0) and cl_khr_subgroups in CL_DEVICE_EXTENSIONS, which fails on OpenCL 3.0 devices like Intel UHD Graphics (NEO) where CL_DEVICE_OPENCL_C_VERSION reports OpenCL C 1.2 and subgroups are exposed as the OpenCL 3.0 feature __opencl_c_subgroups (CL_DEVICE_OPENCL_C_ALL_VERSIONS / CL_DEVICE_OPENCL_C_FEATURES / CL_DEVICE_MAX_NUM_SUB_GROUPS), leaving SPLA_HAS_SUBGROUPS == 0 everywhere including tests. Update CLAccelerator::set_device (compatible with CL_HPP_TARGET_OPENCL_VERSION 120) to detect OpenCL 3.0 C support and __opencl_c_subgroups alongside the OpenCL 2.x cl_khr_subgroups check, guard #pragma OPENCL EXTENSION cl_khr_subgroups : enable with #ifdef cl_khr_subgroups in block_scan.cl, mxm_compute_spgemm_part.cl, and sort_and_combine_device.cl (regenerating src/opencl/generated/auto_*.hpp), and verify in tests/test_opencl_block_scan.cpp / test_opencl_sort_and_combine.cpp / test_opencl_compute_spgemm_part.cpp that SPLA_HAS_SUBGROUPS == 1 compiles and passes on OpenCL 3.0 devices.

Dominant language
C++
Stars
37
Forks
21
Avg merge
11h 3m
Merged PRs (30d)
13

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from SparseLinearAlgebra/spla

All issues in SparseLinearAlgebra/spla

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.