-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Testing] Improve "program" testing to better match the DPC++ e2e tests
This adds a number of conformance tests to test things that are required for the "program" DPC++ e2e tests. Note that these tests don't all pass. Adapter testing infrastructure for level zero has been added, and a single test has been added to check their specific handling of linker errors (they write it to the build log of the output program). Other than that, test additions are as follows: * A few specialization constant tests to test usage of a kernel with multiple specialization constants defined. * Testing of the default specialization values. * KernelGetInfo outputs the correct kernel name and context pointer. * Compiling an (valid or invalid) program produces a valid (though unspecified) build log. * The "num devices" program info is sensible.
- Loading branch information
1 parent
a6cdcf4
commit 722f6c0
Showing
25 changed files
with
416 additions
and
2 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Copyright (C) 2024 Intel Corporation | ||
# Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions. | ||
# See LICENSE.TXT | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
||
if(NOT UR_DPCXX) | ||
# Tests that require kernels can't be used if we aren't generating | ||
# device binaries | ||
message(WARNING | ||
"UR_DPCXX is not defined, skipping adapter tests for level_zero") | ||
else() | ||
add_adapter_test(level_zero | ||
FIXTURE KERNELS | ||
SOURCES | ||
urProgramLink.cpp | ||
ENVIRONMENT | ||
"UR_ADAPTERS_FORCE_LOAD=\"$<TARGET_FILE:ur_adapter_level_zero>\"" | ||
) | ||
|
||
target_include_directories(test-adapter-level_zero PRIVATE | ||
${PROJECT_SOURCE_DIR}/source | ||
${PROJECT_SOURCE_DIR}/source/adapters/level_zero | ||
) | ||
|
||
add_dependencies(test-adapter-level_zero | ||
generate_device_binaries kernel_names_header) | ||
endif() |
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,31 @@ | ||
// Copyright (C) 2024 Intel Corporation | ||
// Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See LICENSE.TXT | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
||
#include <uur/fixtures.h> | ||
|
||
using urLevelZeroProgramLinkTest = uur::urProgramTest; | ||
UUR_INSTANTIATE_DEVICE_TEST_SUITE_P(urLevelZeroProgramLinkTest); | ||
|
||
TEST_P(urLevelZeroProgramLinkTest, InvalidLinkOptionsPrintedInLog) { | ||
ur_program_handle_t linked_program = nullptr; | ||
ASSERT_SUCCESS(urProgramCompile(context, program, "-foo")); | ||
ASSERT_EQ_RESULT( | ||
UR_RESULT_ERROR_PROGRAM_LINK_FAILURE, | ||
urProgramLink(context, 1, &program, "-foo", &linked_program)); | ||
|
||
size_t logSize; | ||
std::vector<char> log; | ||
|
||
ASSERT_SUCCESS(urProgramGetBuildInfo(linked_program, device, | ||
UR_PROGRAM_BUILD_INFO_LOG, 0, nullptr, | ||
&logSize)); | ||
log.resize(logSize); | ||
log[logSize - 1] = 'x'; | ||
ASSERT_SUCCESS(urProgramGetBuildInfo(linked_program, device, | ||
UR_PROGRAM_BUILD_INFO_LOG, logSize, | ||
log.data(), nullptr)); | ||
ASSERT_EQ(log[logSize - 1], '\0'); | ||
ASSERT_NE(std::string{log.data()}.find("-foo"), std::string::npos); | ||
} |
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright (C) 2024 Intel Corporation | ||
// Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See LICENSE.TXT | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
||
#include <sycl/sycl.hpp> | ||
|
||
int main() { | ||
sycl::queue deviceQueue; | ||
|
||
auto Kernel = []() { | ||
#ifdef __SYCL_DEVICE_ONLY__ | ||
asm volatile("undefined\n"); | ||
#endif // __SYCL_DEVICE_ONLY__ | ||
}; | ||
|
||
deviceQueue.submit( | ||
[&](sycl::handler &cgh) { cgh.single_task<class Foo>(Kernel); }); | ||
|
||
return 0; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Copyright (C) 2024 Intel Corporation | ||
// Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See LICENSE.TXT | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
||
#include <cstdint> | ||
#include <sycl/sycl.hpp> | ||
|
||
using namespace sycl; | ||
|
||
constexpr specialization_id<uint32_t> a_spec; | ||
constexpr specialization_id<uint64_t> b_spec; | ||
constexpr specialization_id<bool> c_spec; | ||
|
||
int main() { | ||
queue myQueue; | ||
uint64_t out_val = 0; | ||
buffer<uint64_t, 1> out(&out_val, sycl::range<1>{1}); | ||
|
||
myQueue.submit([&](handler &cgh) { | ||
accessor out_acc{out, cgh, write_only}; | ||
|
||
cgh.set_specialization_constant<a_spec>(0); | ||
cgh.set_specialization_constant<b_spec>(0); | ||
cgh.set_specialization_constant<c_spec>(false); | ||
|
||
cgh.parallel_for<class SpecConstant>( | ||
out.get_range(), [=](item<1> item_id, kernel_handler h) { | ||
uint32_t a = h.get_specialization_constant<a_spec>(); | ||
uint64_t b = h.get_specialization_constant<b_spec>(); | ||
bool c = h.get_specialization_constant<c_spec>(); | ||
if (c) { | ||
out_acc[0] = b - a; | ||
} else { | ||
out_acc[0] = b + a; | ||
} | ||
}); | ||
}); | ||
|
||
myQueue.wait(); | ||
|
||
return 0; | ||
} |
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
Oops, something went wrong.