Skip to content

Commit

Permalink
[UR] Handle INVALID_VALUE in OCL urPlatformGet (intel#15779)
Browse files Browse the repository at this point in the history
Pre-commit MR for:
oneapi-src/unified-runtime#2227

As there is a spec change in UR, adapter handling code has been updated
-
it no longer tries to populate the platform list if it would be empty
(otherwise both "destination" pointers could be null, which is now
illegal).

This fixes a bug Intel tracks internally as URT-831

Co-authored-by: Aaron Greig <[email protected]>
  • Loading branch information
RossBrunton and aarongreig authored Oct 31, 2024
1 parent 4950917 commit b7bb745
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions sycl/source/detail/adapter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,10 @@ class Adapter {
uint32_t platformCount = 0;
call<UrApiKind::urPlatformGet>(&MAdapter, 1, 0, nullptr, &platformCount);
UrPlatforms.resize(platformCount);
call<UrApiKind::urPlatformGet>(&MAdapter, 1, platformCount,
UrPlatforms.data(), nullptr);
if (platformCount) {
call<UrApiKind::urPlatformGet>(&MAdapter, 1, platformCount,
UrPlatforms.data(), nullptr);
}
// We need one entry in this per platform
LastDeviceIds.resize(platformCount);
});
Expand Down

0 comments on commit b7bb745

Please sign in to comment.