Skip to content

[UR] fix: Make NODE_MASK and LUID queries return correct status in CUDA and Level Zero - #22574

Open
mianowski wants to merge 24 commits into
intel:syclfrom
mianowski:fix/URT-1194-node-mask-luid-unsupported
Open

[UR] fix: Make NODE_MASK and LUID queries return correct status in CUDA and Level Zero#22574
mianowski wants to merge 24 commits into
intel:syclfrom
mianowski:fix/URT-1194-node-mask-luid-unsupported

Conversation

@mianowski

@mianowski mianowski commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

The NODE_MASK and LUID queries return an incorrect status in CUDA - they return UNSUPORTED_FEATURE instead of UR_RESULT_ERROR_UNSUPORTED_ENUMERATION. This issue was not detected by any tests.

@mianowski
mianowski requested review from a team as code owners July 8, 2026 18:00
@mianowski mianowski changed the title fix: URT-1194: node mask luid unsupported WIP: fix: URT-1194: node mask luid unsupported Jul 8, 2026
@mianowski
mianowski marked this pull request as draft July 8, 2026 18:06
@mianowski
mianowski force-pushed the fix/URT-1194-node-mask-luid-unsupported branch from e7da01e to 0c77468 Compare July 9, 2026 08:50
@mianowski
mianowski marked this pull request as ready for review July 9, 2026 08:51
@mianowski mianowski changed the title WIP: fix: URT-1194: node mask luid unsupported fix: URT-1194: node mask luid unsupported Jul 9, 2026
@bratpiorka
bratpiorka marked this pull request as draft July 9, 2026 09:38
@mianowski mianowski changed the title fix: URT-1194: node mask luid unsupported fix: node mask luid unsupported Jul 9, 2026
@mianowski mianowski changed the title fix: node mask luid unsupported fix: Make NODE_MASK and LUID queries return correct status in CUDA and Level Zero Jul 9, 2026
Comment thread unified-runtime/source/adapters/cuda/device.cpp
@mianowski
mianowski requested review from a team as code owners July 22, 2026 08:08
@mianowski
mianowski marked this pull request as draft July 22, 2026 08:11
@mianowski
mianowski marked this pull request as ready for review July 22, 2026 10:07
@mianowski
mianowski requested a review from bader as a code owner July 22, 2026 10:07
@mianowski
mianowski requested a review from kekaczma July 22, 2026 10:08
@bader
bader removed their request for review July 23, 2026 21:40
@bratpiorka
bratpiorka requested a review from Copilot July 24, 2026 13:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes Unified Runtime urDeviceGetInfo behavior for UR_DEVICE_INFO_LUID and UR_DEVICE_INFO_NODE_MASK so that unsupported backends/platforms return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION (as expected for optional queries), and adds conformance coverage to prevent regressions.

Changes:

  • Add conformance tests for UR_DEVICE_INFO_LUID and UR_DEVICE_INFO_NODE_MASK that enforce the correct “optional query” status behavior.
  • Update CUDA and Level Zero adapters to return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION (including when the underlying API reports “unsupported” or returns unusable zero values).
  • Fix OpenCL node mask query type/size usage (cl_uint instead of cl_int) to match the OpenCL property type.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
unified-runtime/test/conformance/device/urDeviceGetInfo.cpp Adds optional-query conformance tests for LUID and node mask (and validates non-zero LUID when supported).
unified-runtime/source/adapters/opencl/device.cpp Corrects node mask storage type and queried size to cl_uint.
unified-runtime/source/adapters/native_cpu/device.cpp Explicitly marks LUID and node mask as unsupported enumerations for this adapter.
unified-runtime/source/adapters/level_zero/device.cpp Maps unsupported/unusable LUID + node mask to UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION with explicit ZE error handling.
unified-runtime/source/adapters/cuda/device.cpp Maps CUDA “not supported” and unusable zero LUID/node mask cases to UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION.

ASSERT_EQ(property_size, sizeof(uint32_t));

uint32_t property_value = 0;
ASSERT_QUERY_RETURNS_VALUE(urDeviceGetInfo(device, property_name,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is there a need to verify that a second call to urDeviceGetInfo results in the same value stored in the 'property_value' variable?
Perhaps it would be a good idea to put more emphasis on checking the validity of the value stored in the 'property_value' variable? Is there a valid range of values that the variable may contain?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed. (It was here for conventional purposes of checking stability between calls but it seems not needed for static hardware properties of NODE_MASK and LUID)

property_name);
ASSERT_EQ(property_size, sizeof(std::array<unsigned char, 8>));

std::array<unsigned char, 8> property_value{};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Consider using a descriptive name, rather than a magic number (8), especially since it is used more than once (see line 2694).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

Comment thread unified-runtime/source/adapters/cuda/device.cpp
@sys-ce-bb

Copy link
Copy Markdown
Contributor

@intel/llvm-gatekeepers please consider merging

@sarnex

sarnex commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

can the PR title be updated to match LLVM guidelines?

@sys-ce-bb

Copy link
Copy Markdown
Contributor

@intel/llvm-gatekeepers please consider merging

@sarnex

sarnex commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Needs to be rebased and PR title seems not updated

@mianowski
mianowski marked this pull request as draft August 3, 2026 10:42
@mianowski mianowski changed the title fix: Make NODE_MASK and LUID queries return correct status in CUDA and Level Zero [UR] fix: Make NODE_MASK and LUID queries return correct status in CUDA and Level Zero Aug 3, 2026
@mianowski mianowski self-assigned this Aug 3, 2026
@mianowski
mianowski marked this pull request as ready for review August 3, 2026 14:03

uint64_t luid_as_uint64 = 0;
std::memcpy(&luid_as_uint64, property_value.data(), sizeof(luid_as_uint64));
const bool is_power_of_two =

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This validation is incorrect. LUID (Locally Unique Identifier) is not required to be a power of 2. LUID is an 8-byte device identifier that can be any non-zero value. LUID should only be checked for all-zeros (which indicates an error).

uint32_t property_value = 0;
ASSERT_SUCCESS(urDeviceGetInfo(device, property_name, property_size,
&property_value, nullptr));
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The test doesn't validate the nodeMask value. nodeMask == 0 means unsupported (should return UNSUPPORTED_ENUMERATION).

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.

8 participants