Skip to content

[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

Merged
merged 10 commits into from
Apr 10, 2025
Merged

Conversation

isaacault
Copy link
Contributor

Fixes #17504 .

Copy link
Contributor

@steffenlarsen steffenlarsen left a 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! 🚀

Copy link
Contributor

@hvdijk hvdijk left a 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.

@isaacault
Copy link
Contributor Author

@intel/unified-runtime-reviewers-level-zero Friendly ping.

@isaacault
Copy link
Contributor Author

@intel/llvm-gatekeepers Please merge.

@martygrant martygrant merged commit 99277f6 into intel:sycl Apr 10, 2025
32 checks passed
igchor added a commit to igchor/compute-benchmarks that referenced this pull request Apr 11, 2025
After API change: intel/llvm#17876

Signed-off-by: Igor Chorazewicz <[email protected]>
VPG-SWE-Github pushed a commit to intel/compute-benchmarks that referenced this pull request Apr 11, 2025
urPlatformGet API changed in intel/llvm#17876

Signed-off-by: Piotr Balcer <[email protected]>
pbalcer added a commit to pbalcer/llvm that referenced this pull request Apr 14, 2025
martygrant pushed a commit that referenced this pull request Apr 14, 2025
Comment on lines +72 to +80
platforms.reserve(platformCount + adapterPlatformCount);
urPlatformGet(adapter, adapterPlatformCount, &platforms[platformCount],
&adapterPlatformCount);
platformCount += adapterPlatformCount;
}
if (!platformCount) {
throw std::runtime_error("No platforms available.");
}
platforms.resize(platformCount);
Copy link
Contributor

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

RossBrunton added a commit to RossBrunton/intel-llvm that referenced this pull request Apr 15, 2025
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
kbenzie pushed a commit that referenced this pull request Apr 15, 2025
Change #17876 introduced a regression due to how platforms were
generated
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 #18032
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.

[UR] Assess the need for urPlatformGet to take a list of adapters
8 participants