-
Notifications
You must be signed in to change notification settings - Fork 788
[SYCL] Implement atomic_memory_scope_capabilities device query for OpenCL and Level Zero #8595
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
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
40e5bc2
Implements atomic memory scope capabilities device queries for OpenCL…
maarquitos14 db64e3c
Adds test for atomic memory scope capabilities device queries.
maarquitos14 43b0bf7
Merge remote-tracking branch 'intel/origin/sycl' into maronas/atomic-…
maarquitos14 56badc0
SYCL should always return memory_scope::work_item.
maarquitos14 41b5cc1
Addressing code review concerns.
maarquitos14 8392d5b
Fixing compilation error.
maarquitos14 8bacef1
Addresses code review comments.
maarquitos14 3c05a25
Reverting unrelated change.
maarquitos14 69d901b
Clarifies comment using new reference.
maarquitos14 1005e80
Extends comment.
maarquitos14 f7aa8ee
Addresses code review comments.
maarquitos14 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
//==-------- AtomicMemoryScopeCapabilities.cpp --- queue unit tests --------==// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#include <CL/sycl.hpp> | ||
#include <gtest/gtest.h> | ||
#include <helpers/PiMock.hpp> | ||
|
||
using namespace sycl; | ||
|
||
namespace { | ||
|
||
thread_local bool deviceGetInfoCalled; | ||
|
||
pi_platform PiPlatform = nullptr; | ||
|
||
pi_result redefinedDeviceGetInfoAfter(pi_device device, | ||
pi_device_info param_name, | ||
size_t param_value_size, | ||
void *param_value, | ||
size_t *param_value_size_ret) { | ||
if (param_name == PI_DEVICE_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES) { | ||
deviceGetInfoCalled = true; | ||
if (param_value) { | ||
auto *Result = | ||
reinterpret_cast<pi_memory_scope_capabilities *>(param_value); | ||
*Result = PI_MEMORY_SCOPE_WORK_ITEM | PI_MEMORY_SCOPE_SUB_GROUP | | ||
PI_MEMORY_SCOPE_WORK_GROUP | PI_MEMORY_SCOPE_DEVICE | | ||
PI_MEMORY_SCOPE_SYSTEM; | ||
} | ||
} | ||
return PI_SUCCESS; | ||
} | ||
|
||
TEST(AtomicMemoryScopeCapabilitiesCheck, CheckAtomicMemoryScopeCapabilities) { | ||
sycl::unittest::PiMock Mock; | ||
sycl::platform Plt = Mock.getPlatform(); | ||
|
||
PiPlatform = detail::getSyclObjImpl(Plt)->getHandleRef(); | ||
context DefaultCtx = Plt.ext_oneapi_get_default_context(); | ||
device Dev = DefaultCtx.get_devices()[0]; | ||
|
||
deviceGetInfoCalled = false; | ||
|
||
Mock.redefineAfter<detail::PiApiKind::piDeviceGetInfo>( | ||
redefinedDeviceGetInfoAfter); | ||
auto scope_capabilities = | ||
Dev.get_info<sycl::info::device::atomic_memory_scope_capabilities>(); | ||
EXPECT_TRUE(deviceGetInfoCalled); | ||
size_t expectedSize = 5; | ||
EXPECT_EQ(scope_capabilities.size(), expectedSize); | ||
|
||
auto res = std::find(scope_capabilities.begin(), scope_capabilities.end(), | ||
sycl::memory_scope::work_item); | ||
EXPECT_FALSE(res == scope_capabilities.end()); | ||
res = std::find(scope_capabilities.begin(), scope_capabilities.end(), | ||
sycl::memory_scope::sub_group); | ||
EXPECT_FALSE(res == scope_capabilities.end()); | ||
res = std::find(scope_capabilities.begin(), scope_capabilities.end(), | ||
sycl::memory_scope::work_group); | ||
EXPECT_FALSE(res == scope_capabilities.end()); | ||
res = std::find(scope_capabilities.begin(), scope_capabilities.end(), | ||
sycl::memory_scope::device); | ||
EXPECT_FALSE(res == scope_capabilities.end()); | ||
res = std::find(scope_capabilities.begin(), scope_capabilities.end(), | ||
sycl::memory_scope::system); | ||
EXPECT_FALSE(res == scope_capabilities.end()); | ||
} | ||
} // anonymous namespace |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.