Skip to content

Commit 085d07e

Browse files
authored
[SYCL][Test] Replace multi-device kernel_bundle e2e tests with unit test (#17691)
Replace the following e2e tests with unit test: ``` ProgramManager/multi_device_bundle/device_libs_and_caching.cpp ProgramManager/multi_device_bundle/build_twice.cpp KernelAndProgram/persistent-cache-multi-device.cpp ``` The reason is that the checks performed in those e2e tests (number of UR calls, etc.) can be done more effificently using unit tests, such checks in e2e tests are expensive. Another reason is that e2e tests use NEO-specific `CreateMultipleRootDevices=[num]` environment variable which is not guaranteed to work, in unit tests we can emulate as many devices as we want.
1 parent 8a5462d commit 085d07e

File tree

7 files changed

+624
-307
lines changed

7 files changed

+624
-307
lines changed

sycl/test-e2e/KernelAndProgram/persistent-cache-multi-device.cpp

Lines changed: 0 additions & 46 deletions
This file was deleted.

sycl/test-e2e/ProgramManager/multi_device_bundle/build_twice.cpp

Lines changed: 0 additions & 62 deletions
This file was deleted.

sycl/test-e2e/ProgramManager/multi_device_bundle/device_libs_and_caching.cpp

Lines changed: 0 additions & 164 deletions
This file was deleted.

sycl/unittests/helpers/MockDeviceImage.hpp

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ template <typename T> LifetimeExtender(std::vector<T>) -> LifetimeExtender<T>;
161161
/// Convenience wrapper for sycl_device_binary_property_set.
162162
class MockPropertySet {
163163
public:
164-
MockPropertySet() {
164+
MockPropertySet(const std::vector<DeviceLibExt> &DeviceLibExts = {}) {
165165
// Most of unit-tests are statically linked with SYCL RT. On Linux and Mac
166166
// systems that causes incorrect RT installation directory detection, which
167167
// prevents proper loading of fallback libraries. See intel/llvm#6945
@@ -170,11 +170,23 @@ class MockPropertySet {
170170
// unless there is a special property attached to it or special env variable
171171
// is set which forces RT to skip fallback libraries.
172172
//
173-
// Setting this property here so unit-tests can be launched under any
174-
// environment.
173+
// By default, property is set to empty mask here so that unit-tests can be
174+
// launched under any environment. Some unit tests might create dummy
175+
// fallback libaries and require fallback libraries to be loaded, in such
176+
// case input vector will be non-empty.
175177

176-
std::vector<char> Data(/* eight elements */ 8,
178+
std::vector<char> Data(/* four elements */ 4,
177179
/* each element is zero */ 0);
180+
if (!DeviceLibExts.empty()) {
181+
uint32_t DeviceLibReqMask = 0;
182+
for (auto Ext : DeviceLibExts) {
183+
DeviceLibReqMask |= 0x1
184+
<< (static_cast<uint32_t>(Ext) -
185+
static_cast<uint32_t>(
186+
DeviceLibExt::cl_intel_devicelib_assert));
187+
}
188+
std::memcpy(Data.data(), &DeviceLibReqMask, sizeof(DeviceLibReqMask));
189+
}
178190
// Name doesn't matter here, it is not used by RT
179191
// Value must be an all-zero 32-bit mask, which would mean that no fallback
180192
// libraries are needed to be loaded.

sycl/unittests/program_manager/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ add_sycl_unittest(ProgramManagerTests OBJECT
66
SubDevices.cpp
77
passing_link_and_compile_options.cpp
88
Cleanup.cpp
9+
MultipleDevsKernelBundle.cpp
910
)
1011

1112
add_subdirectory(arg_mask)

0 commit comments

Comments
 (0)