-
Notifications
You must be signed in to change notification settings - Fork 788
[UR][L0] urDevice when numdevices is not zero #19103
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
base: sycl
Are you sure you want to change the base?
Conversation
When NumDevices is not zero and when phDevice is null, the user cannot query the number of devices. This addresses that issue. Signed-off-by: Zhang, Winston <winston.zhang@intel.com>
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.
Pull Request Overview
This pull request addresses an issue where a non-zero NumDevices value and a null phDevice prevent users from querying the number of devices. The change ensures that when the output devices pointer is null or when fewer output entries than available devices are requested, the function returns the correct device count.
- Added an enhanced condition in urDeviceGet to cover the case when Devices is null and fewer entries are provided.
- The condition now checks if (*NumDevices == 0) or if (NumEntries < ZeDeviceCount && !Devices) to set *NumDevices accordingly.
Comments suppressed due to low confidence (1)
unified-runtime/source/adapters/level_zero/device.cpp:170
- [nitpick] Consider adding an inline comment to explain the rationale behind checking (NumEntries < ZeDeviceCount && !Devices) to make the logic clearer for future maintenance.
if (*NumDevices == 0 || (NumEntries < ZeDeviceCount && !Devices))
potential uninitialized as it is an output variable. Signed-off-by: Zhang, Winston <winston.zhang@intel.com>
Signed-off-by: Zhang, Winston <winston.zhang@intel.com>
When NumDevices is not zero and when phDevice is null, the user cannot query the number of devices. This addresses that issue.