-
Notifications
You must be signed in to change notification settings - Fork 760
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[UR] Add device info query for native assert. (#15929)
- Loading branch information
1 parent
f870412
commit c07039e
Showing
14 changed files
with
118 additions
and
15 deletions.
There are no files selected for viewing
This file contains 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 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 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,4 +1,5 @@ | ||
add_sycl_unittest(AssertTests OBJECT | ||
assert.cpp | ||
support_native.cpp | ||
) | ||
|
This file contains 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,51 @@ | ||
//==---------- support_native.cpp --- Check support is correctly reported --==// | ||
// | ||
// 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 "ur_mock_helpers.hpp" | ||
|
||
#include <sycl/sycl.hpp> | ||
|
||
#include <helpers/UrMock.hpp> | ||
|
||
#include <gtest/gtest.h> | ||
|
||
template <bool Support> | ||
static ur_result_t redefinedDeviceGetInfoAfter(void *pParams) { | ||
auto &Params = *reinterpret_cast<ur_device_get_info_params_t *>(pParams); | ||
if (*Params.ppropName == UR_DEVICE_INFO_USE_NATIVE_ASSERT) { | ||
if (*Params.ppPropValue) | ||
*reinterpret_cast<ur_bool_t *>(*Params.ppPropValue) = Support; | ||
if (*Params.ppPropSizeRet) | ||
**Params.ppPropSizeRet = sizeof(ur_bool_t); | ||
} | ||
return UR_RESULT_SUCCESS; | ||
} | ||
|
||
TEST(SupportNativeAssert, True) { | ||
mock::getCallbacks().set_after_callback("urDeviceGetInfo", | ||
&redefinedDeviceGetInfoAfter<true>); | ||
|
||
sycl::unittest::UrMock<> Mock; | ||
sycl::platform Plt = sycl::platform(); | ||
|
||
const sycl::device Dev = Plt.get_devices()[0]; | ||
|
||
ASSERT_TRUE(Dev.has(sycl::aspect::ext_oneapi_native_assert)); | ||
} | ||
|
||
TEST(SupportNativeAssert, False) { | ||
mock::getCallbacks().set_after_callback("urDeviceGetInfo", | ||
&redefinedDeviceGetInfoAfter<false>); | ||
|
||
sycl::unittest::UrMock<> Mock; | ||
sycl::platform Plt = sycl::platform(); | ||
|
||
const sycl::device Dev = Plt.get_devices()[0]; | ||
|
||
ASSERT_FALSE(Dev.has(sycl::aspect::ext_oneapi_native_assert)); | ||
} |
This file contains 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 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 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 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 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 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 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 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 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 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