-
Notifications
You must be signed in to change notification settings - Fork 769
[SYCL] Adds support for device UUID as a SYCL extension. #3696
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
22 commits
Select commit
Hold shift + click to select a range
ac2df19
[SYCL] Adds support for device UUID as a SYCL extension.
rbegam 2408ff3
changed pi interface.
rbegam 8fbefa8
clang formatted.
rbegam 6f8510a
modified the doc.
rbegam 08cfa31
adds macro name.
rbegam d75028c
remove typo.
rbegam d4874cf
minor modifications.
rbegam 36ebffb
change sycl return type and add a test case.
rbegam ffe610c
modify the test.
rbegam 99248b0
minor modifications.
rbegam 71b6a85
moved uuid_type under sycl::detail.
rbegam 4ad6361
clang formatted.
rbegam 1468a29
fix has aspect.
rbegam 7256444
add guard with C++17 check.
rbegam a7de8de
remove unnecessary code from the test.
rbegam 4160272
changes uuid type and adds a unittest.
rbegam 2d1d711
clang formatted.
rbegam 244a082
remove old code.
rbegam b344f6d
modified the unittest.
rbegam bddc7bc
minor corrections.
rbegam 22fa8f6
rearranged ext.
rbegam 8ed9861
Merge branch 'sycl' into uuid
rbegam 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
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
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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
add_sycl_unittest(KernelAndProgramTests OBJECT | ||
KernelRelease.cpp | ||
KernelInfo.cpp | ||
DeviceInfo.cpp | ||
PersistentDeviceCodeCache.cpp | ||
) | ||
add_subdirectory(device) |
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,87 @@ | ||
//==-------------- DeviceInfo.cpp --- device info unit test ----------------==// | ||
// | ||
// 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 <detail/context_impl.hpp> | ||
#include <gtest/gtest.h> | ||
#include <helpers/PiMock.hpp> | ||
|
||
using namespace sycl; | ||
|
||
namespace { | ||
struct TestCtx { | ||
TestCtx(context &Ctx) : Ctx{Ctx} {} | ||
|
||
context &Ctx; | ||
bool UUIDInfoCalled = false; | ||
}; | ||
} // namespace | ||
|
||
static std::unique_ptr<TestCtx> TestContext; | ||
|
||
static pi_result redefinedDeviceGetInfo(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_UUID) { | ||
TestContext->UUIDInfoCalled = true; | ||
} | ||
|
||
return PI_SUCCESS; | ||
rbegam marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
class DeviceInfoTest : public ::testing::Test { | ||
public: | ||
DeviceInfoTest() : Plt{default_selector()} {} | ||
|
||
protected: | ||
void SetUp() override { | ||
if (Plt.is_host()) { | ||
std::clog << "This test is only supported on non-host platforms.\n"; | ||
std::clog << "Current platform is " | ||
<< Plt.get_info<info::platform::name>() << "\n"; | ||
return; | ||
} | ||
|
||
Mock = std::make_unique<unittest::PiMock>(Plt); | ||
|
||
Mock->redefine<detail::PiApiKind::piDeviceGetInfo>(redefinedDeviceGetInfo); | ||
} | ||
|
||
protected: | ||
platform Plt; | ||
std::unique_ptr<unittest::PiMock> Mock; | ||
}; | ||
|
||
TEST_F(DeviceInfoTest, GetDeviceUUID) { | ||
if (Plt.is_host()) { | ||
return; | ||
} | ||
|
||
context Ctx{Plt}; | ||
TestContext.reset(new TestCtx(Ctx)); | ||
|
||
device Dev = Ctx.get_devices()[0]; | ||
|
||
if (!Dev.has(aspect::ext_intel_device_info_uuid)) { | ||
std::clog | ||
<< "This test is only for the devices with UUID extension support.\n"; | ||
return; | ||
} | ||
|
||
auto UUID = Dev.get_info<info::device::ext_intel_device_info_uuid>(); | ||
|
||
EXPECT_EQ(TestContext->UUIDInfoCalled, true) | ||
<< "Expect piDeviceGetInfo to be " | ||
<< "called with PI_DEVICE_INFO_UUID"; | ||
|
||
EXPECT_EQ(sizeof(UUID), 16 * sizeof(unsigned char)) | ||
<< "Expect device UUID to be " | ||
<< "of 16 bytes"; | ||
} |
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.