Skip to content

[SYCL] Make the mock plugin report cl_khr_il_program as supported #6823

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 2 commits into from
Sep 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion sycl/unittests/helpers/PiMockPlugin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ inline pi_result mock_piDeviceGetInfo(pi_device device,
size_t param_value_size,
void *param_value,
size_t *param_value_size_ret) {
constexpr char MockSupportedExtensions[] = "cl_khr_fp64 cl_khr_fp16";
constexpr char MockDeviceName[] = "Mock device";
constexpr char MockSupportedExtensions[] =
"cl_khr_fp64 cl_khr_fp16 cl_khr_il_program";
switch (param_name) {
case PI_DEVICE_INFO_TYPE: {
// Act like any device is a GPU.
Expand All @@ -102,6 +104,15 @@ inline pi_result mock_piDeviceGetInfo(pi_device device,
*param_value_size_ret = sizeof(PI_DEVICE_TYPE_GPU);
return PI_SUCCESS;
}
case PI_DEVICE_INFO_NAME: {
if (param_value) {
assert(param_value_size == sizeof(MockDeviceName));
std::memcpy(param_value, MockDeviceName, sizeof(MockDeviceName));
}
if (param_value_size_ret)
*param_value_size_ret = sizeof(MockDeviceName);
return PI_SUCCESS;
}
case PI_DEVICE_INFO_PARENT_DEVICE: {
if (param_value)
*static_cast<pi_device **>(param_value) = nullptr;
Expand Down
28 changes: 0 additions & 28 deletions sycl/unittests/program_manager/BuildLog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,37 +47,9 @@ static pi_result redefinedProgramGetBuildInfo(
return PI_SUCCESS;
}

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_NAME) {
const std::string name = "Test Device";
if (param_value_size_ret) {
*param_value_size_ret = name.size();
}
if (param_value) {
auto *val = static_cast<char *>(param_value);
strcpy(val, name.data());
}
}
if (param_name == PI_DEVICE_INFO_COMPILER_AVAILABLE) {
if (param_value_size_ret) {
*param_value_size_ret = sizeof(cl_bool);
}
if (param_value) {
auto *val = static_cast<cl_bool *>(param_value);
*val = 1;
}
}
return PI_SUCCESS;
}

static void setupCommonTestAPIs(sycl::unittest::PiMock &Mock) {
using namespace sycl::detail;
Mock.redefine<PiApiKind::piProgramGetBuildInfo>(redefinedProgramGetBuildInfo);
Mock.redefine<PiApiKind::piDeviceGetInfo>(redefinedDeviceGetInfo);
}

TEST(BuildLog, OutputNothingOnLevel1) {
Expand Down