Skip to content

[SYCL][UR] Move max_global_work_groups query to UR#21840

Open
uditagarwal97 wants to merge 8 commits intosyclfrom
private/udit/max_qg_query
Open

[SYCL][UR] Move max_global_work_groups query to UR#21840
uditagarwal97 wants to merge 8 commits intosyclfrom
private/udit/max_qg_query

Conversation

@uditagarwal97
Copy link
Copy Markdown
Contributor

@uditagarwal97 uditagarwal97 commented Apr 22, 2026

This PR makes the following changes:

  1. Moves implementation of max_global_work_groups to UR. This query has been implemented in SYCL RT because there's no backend support for max_global_work_groups query. However, it was recently decided that OpenCL will add a corresponding query. See CMPLRLLVM-73572 for more info.
  2. Changes max_global_work_groups from INT_MAX to SIZE_MAX for all backends. For CUDA, HIP, OFFLOAD, and L0 adapter, we calculate the value of max_global_work_groups by taking minimum of SIZE_MAX and multiplication of per-dimension max group size.
  3. Changed max_work_groups<3> so that max_global_work_groups no longer limits per-dimension max work group size.

@uditagarwal97 uditagarwal97 self-assigned this Apr 22, 2026
@uditagarwal97 uditagarwal97 requested a review from Copilot April 22, 2026 09:37
@uditagarwal97 uditagarwal97 changed the title [SYCL][UR] Move max_work_group_global query to UR [SYCL][UR] Move max_global_work_groups query to UR Apr 22, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR moves SYCL’s ext::oneapi::experimental::info::device::max_global_work_groups query from being handled in the SYCL runtime to being surfaced as a Unified Runtime (UR) urDeviceGetInfo property (UR_DEVICE_INFO_MAX_GLOBAL_WORK_GROUPS) and wires it through adapters, printing utilities, and conformance tooling.

Changes:

  • Adds UR_DEVICE_INFO_MAX_GLOBAL_WORK_GROUPS to UR API surface (YAML + generated header) and to UR printing / urinfo output.
  • Implements UR_DEVICE_INFO_MAX_GLOBAL_WORK_GROUPS handling across multiple UR adapters (OpenCL, CUDA, HIP, Level Zero, Offload; NativeCPU reports unsupported).
  • Updates SYCL device trait mapping + return type mapping and switches SYCL device_impl to query UR for max_global_work_groups.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
unified-runtime/tools/urinfo/urinfo.hpp Adds printing of UR_DEVICE_INFO_MAX_GLOBAL_WORK_GROUPS in urinfo.
unified-runtime/test/conformance/device/urDeviceGetInfo.cpp Adds conformance test coverage for the new device info query.
unified-runtime/source/adapters/opencl/device.cpp Adds adapter support for UR_DEVICE_INFO_MAX_GLOBAL_WORK_GROUPS.
unified-runtime/source/adapters/offload/device.cpp Adds adapter support for UR_DEVICE_INFO_MAX_GLOBAL_WORK_GROUPS and includes <limits>.
unified-runtime/source/adapters/native_cpu/device.cpp Marks UR_DEVICE_INFO_MAX_GLOBAL_WORK_GROUPS as unsupported.
unified-runtime/source/adapters/level_zero/device.cpp Adds adapter support for UR_DEVICE_INFO_MAX_GLOBAL_WORK_GROUPS.
unified-runtime/source/adapters/hip/device.cpp Adds adapter support for UR_DEVICE_INFO_MAX_GLOBAL_WORK_GROUPS.
unified-runtime/source/adapters/cuda/device.cpp Adds adapter support for UR_DEVICE_INFO_MAX_GLOBAL_WORK_GROUPS.
unified-runtime/scripts/core/device.yml Adds the new device info enumerator to the UR spec YAML.
unified-runtime/include/unified-runtime/ur_print.hpp Adds enum-to-string and tagged printing support for the new device info.
unified-runtime/include/unified-runtime/ur_api.h Adds UR_DEVICE_INFO_MAX_GLOBAL_WORK_GROUPS to ur_device_info_t.
sycl/source/detail/ur_device_info_ret_types.inc Maps the new UR device info to size_t for SYCL’s UR return-type machinery.
sycl/source/detail/device_impl.hpp Switches SYCL to query UR for max_global_work_groups and adjusts max_work_groups<3> behavior.
sycl/include/sycl/info/ext_oneapi_device_traits.def Maps max_global_work_groups to the new UR device info enumerator.

Comment thread unified-runtime/include/unified-runtime/ur_print.hpp
Comment thread unified-runtime/source/adapters/level_zero/device.cpp Outdated
Comment thread sycl/source/detail/device_impl.hpp
uditagarwal97 and others added 2 commits April 22, 2026 03:30
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@uditagarwal97 uditagarwal97 requested a review from gmlueck April 22, 2026 10:38
@uditagarwal97 uditagarwal97 marked this pull request as ready for review April 22, 2026 10:38
@uditagarwal97 uditagarwal97 requested review from a team as code owners April 22, 2026 10:38
Comment thread unified-runtime/source/adapters/opencl/device.cpp Outdated
Comment thread unified-runtime/scripts/core/device.yml Outdated
Comment thread unified-runtime/source/adapters/level_zero/device.cpp Outdated
Copy link
Copy Markdown
Collaborator

@iclsrc iclsrc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR moves the max_global_work_groups device query out of the SYCL RT into UR adapters, which is a nice cleanup. The approach is sound, but there is one compilation-breaking typo in the offload adapter that must be fixed before merging. A few smaller issues noted below.

Comment thread unified-runtime/source/adapters/offload/device.cpp Outdated
Comment thread unified-runtime/source/common/ur_util.hpp Outdated
Comment thread unified-runtime/source/common/ur_util.hpp Outdated
Comment thread unified-runtime/source/adapters/opencl/device.cpp
Co-authored-by: iclsrc <iclsrc@intel.com>
Comment thread unified-runtime/source/common/ur_util.hpp
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 this pull request may close these issues.

5 participants