Skip to content
28 changes: 28 additions & 0 deletions sycl/source/detail/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,34 @@ template <ConfigID Config> class SYCLConfig {
}
};

template <> class SYCLConfig<SYCL_DEVICELIB_NO_FALLBACK> {
using BaseT = SYCLConfigBase<SYCL_DEVICELIB_NO_FALLBACK>;

public:
static const char *get() { return getCachedValue(); }

static void reset() {
(void)getCachedValue(/*ResetCache=*/true, /*UnsetCache=*/false);
}

static const char *getName() { return BaseT::MConfigName; }

static void unset() {
(void)getCachedValue(/*ResetCache=*/false, /*UnsetCache=*/true);
}

private:
static const char *getCachedValue(bool ResetCache = false,
bool UnsetCache = false) {
static const char *ValStr = BaseT::getRawValue();
if (UnsetCache)
ValStr = nullptr;
if (ResetCache)
ValStr = BaseT::getRawValue();
return ValStr;
}
};

template <> class SYCLConfig<SYCL_UR_TRACE> {
using BaseT = SYCLConfigBase<SYCL_UR_TRACE>;

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

20 changes: 16 additions & 4 deletions sycl/unittests/helpers/MockDeviceImage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ template <typename T> LifetimeExtender(std::vector<T>) -> LifetimeExtender<T>;
/// Convenience wrapper for sycl_device_binary_property_set.
class MockPropertySet {
public:
MockPropertySet() {
MockPropertySet(const std::vector<DeviceLibExt> &DeviceLibExts = {}) {
// Most of unit-tests are statically linked with SYCL RT. On Linux and Mac
// systems that causes incorrect RT installation directory detection, which
// prevents proper loading of fallback libraries. See intel/llvm#6945
Expand All @@ -170,11 +170,23 @@ class MockPropertySet {
// unless there is a special property attached to it or special env variable
// is set which forces RT to skip fallback libraries.
//
// Setting this property here so unit-tests can be launched under any
// environment.
// By default, property is set to empty mask here so that unit-tests can be
// launched under any environment. Some unit tests might create dummy
// fallback libaries and require fallback libraries to be loaded, in such
// case input vector will be non-empty.

std::vector<char> Data(/* eight elements */ 8,
std::vector<char> Data(/* four elements */ 4,
/* each element is zero */ 0);
if (!DeviceLibExts.empty()) {
uint32_t DeviceLibReqMask = 0;
for (auto Ext : DeviceLibExts) {
DeviceLibReqMask |= 0x1
<< (static_cast<uint32_t>(Ext) -
static_cast<uint32_t>(
DeviceLibExt::cl_intel_devicelib_assert));
}
std::memcpy(Data.data(), &DeviceLibReqMask, sizeof(DeviceLibReqMask));
}
// Name doesn't matter here, it is not used by RT
// Value must be an all-zero 32-bit mask, which would mean that no fallback
// libraries are needed to be loaded.
Expand Down
1 change: 1 addition & 0 deletions sycl/unittests/program_manager/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ add_sycl_unittest(ProgramManagerTests OBJECT
SubDevices.cpp
passing_link_and_compile_options.cpp
Cleanup.cpp
MultipleDevsKernelBundle.cpp
)

add_subdirectory(arg_mask)
Expand Down
Loading