-
Notifications
You must be signed in to change notification settings - Fork 787
[UR] urPlatformGet() takes only 1 adapter. #17876
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
Conversation
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.
Seems reasonable to me! 🚀
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.
The NativeCPU part looks fine.
@intel/unified-runtime-reviewers-level-zero Friendly ping. |
@intel/llvm-gatekeepers Please merge. |
After API change: intel/llvm#17876 Signed-off-by: Igor Chorazewicz <[email protected]>
urPlatformGet API changed in intel/llvm#17876 Signed-off-by: Piotr Balcer <[email protected]>
This fixes a regression after intel#17876
This fixes a regression after #17876
platforms.reserve(platformCount + adapterPlatformCount); | ||
urPlatformGet(adapter, adapterPlatformCount, &platforms[platformCount], | ||
&adapterPlatformCount); | ||
platformCount += adapterPlatformCount; | ||
} | ||
if (!platformCount) { | ||
throw std::runtime_error("No platforms available."); | ||
} | ||
platforms.resize(platformCount); |
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.
This is UB, the access to platforms[platformCount]
is out of bounds, because platforms.size()
is always 0 here. This should be using resize()
and not reserve()
.
In practice the later .resize()
will reset all platforms to nullptr
and make the example crash. See #18032
Change intel#17876 introduced a regression due to how platforms were generated in examples and tests. This fixes those issues. A fix for the no_platforms test is also included; which was failing due to `UR_ADAPTERS_FORCE_LOAD=""` being treated as absent. Closes intel#18032
Fixes #17504 .