Skip to content

Commit a68f595

Browse files
[SYCL][NFC] Fix typo and double-negative in SYCL_RT_ZSTD_NOT_AVAIABLE macro (#18922)
1 parent e6f2254 commit a68f595

File tree

7 files changed

+12
-11
lines changed

7 files changed

+12
-11
lines changed

sycl/source/CMakeLists.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,8 @@ function(add_sycl_rt_library LIB_NAME LIB_OBJ_NAME)
142142
target_link_libraries(${LIB_NAME} PRIVATE ${ARG_XPTI_LIB})
143143
endif()
144144

145-
if (NOT LLVM_ENABLE_ZSTD)
146-
target_compile_definitions(${LIB_OBJ_NAME} PRIVATE SYCL_RT_ZSTD_NOT_AVAIABLE)
147-
else()
145+
if (LLVM_ENABLE_ZSTD)
146+
target_compile_definitions(${LIB_OBJ_NAME} PRIVATE SYCL_RT_ZSTD_AVAILABLE)
148147
target_link_libraries(${LIB_NAME} PRIVATE ${zstd_STATIC_LIBRARY})
149148
target_include_directories(${LIB_OBJ_NAME} PRIVATE ${zstd_INCLUDE_DIR})
150149
endif()

sycl/source/detail/compression.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//===----------------------------------------------------------------------===//
88
#pragma once
99

10-
#ifndef SYCL_RT_ZSTD_NOT_AVAIABLE
10+
#ifdef SYCL_RT_ZSTD_AVAILABLE
1111

1212
#include <sycl/exception.hpp>
1313

@@ -150,4 +150,4 @@ class ZSTDCompressor {
150150
} // namespace _V1
151151
} // namespace sycl
152152

153-
#endif // SYCL_RT_ZSTD_NOT_AVAIABLE
153+
#endif // SYCL_RT_ZSTD_AVAILABLE

sycl/source/detail/device_binary_image.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ DynRTDeviceBinaryImage::DynRTDeviceBinaryImage(
672672
}
673673
}
674674

675-
#ifndef SYCL_RT_ZSTD_NOT_AVAIABLE
675+
#ifdef SYCL_RT_ZSTD_AVAILABLE
676676
CompressedRTDeviceBinaryImage::CompressedRTDeviceBinaryImage(
677677
sycl_device_binary CompressedBin)
678678
: RTDeviceBinaryImage() {
@@ -712,7 +712,7 @@ CompressedRTDeviceBinaryImage::~CompressedRTDeviceBinaryImage() {
712712
delete Bin;
713713
Bin = nullptr;
714714
}
715-
#endif // SYCL_RT_ZSTD_NOT_AVAIABLE
715+
#endif // SYCL_RT_ZSTD_AVAILABLE
716716

717717
} // namespace detail
718718
} // namespace _V1

sycl/source/detail/device_binary_image.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ class DynRTDeviceBinaryImage : public RTDeviceBinaryImage {
304304
std::unique_ptr<char[], std::function<void(void *)>> Data;
305305
};
306306

307-
#ifndef SYCL_RT_ZSTD_NOT_AVAIABLE
307+
#ifdef SYCL_RT_ZSTD_AVAILABLE
308308
// Compressed device binary image. Decompression happens when the image is
309309
// actually used to build a program.
310310
// Also, frees the decompressed data in destructor.
@@ -331,7 +331,7 @@ class CompressedRTDeviceBinaryImage : public RTDeviceBinaryImage {
331331
std::unique_ptr<char[]> m_DecompressedData;
332332
size_t m_ImageSize;
333333
};
334-
#endif // SYCL_RT_ZSTD_NOT_AVAIABLE
334+
#endif // SYCL_RT_ZSTD_AVAILABLE
335335

336336
} // namespace detail
337337
} // namespace _V1

sycl/source/detail/program_manager/program_manager.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ ProgramManager::collectDeviceImageDeps(const RTDeviceBinaryImage &Img,
689689

690690
static inline void
691691
CheckAndDecompressImage([[maybe_unused]] RTDeviceBinaryImage *Img) {
692-
#ifndef SYCL_RT_ZSTD_NOT_AVAIABLE
692+
#ifdef SYCL_RT_ZSTD_AVAILABLE
693693
if (auto CompImg = dynamic_cast<CompressedRTDeviceBinaryImage *>(Img))
694694
if (CompImg->IsCompressed())
695695
CompImg->Decompress();
@@ -1945,7 +1945,7 @@ void ProgramManager::addImage(sycl_device_binary RawImg,
19451945

19461946
std::unique_ptr<RTDeviceBinaryImage> Img;
19471947
if (IsDeviceImageCompressed) {
1948-
#ifndef SYCL_RT_ZSTD_NOT_AVAIABLE
1948+
#ifdef SYCL_RT_ZSTD_AVAILABLE
19491949
Img = std::make_unique<CompressedRTDeviceBinaryImage>(RawImg);
19501950
#else
19511951
throw sycl::exception(sycl::make_error_code(sycl::errc::runtime),
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
add_sycl_unittest(CompressionTests OBJECT
22
CompressionTests.cpp
33
)
4+
target_compile_definitions(CompressionTests PRIVATE SYCL_RT_ZSTD_AVAILABLE)

sycl/unittests/compression/CompressionTests.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
//===----------------------------------------------------------------------===//
88

99
#include <detail/compression.hpp>
10+
#include <sycl/sycl.hpp>
1011

1112
#include <string>
1213

0 commit comments

Comments
 (0)