Skip to content

Commit 05bd241

Browse files
committed
Revert "[rANS] Fix Compiler Warnings"
This reverts commit 354fbb1.
1 parent 0965337 commit 05bd241

21 files changed

+43
-27
lines changed

DataFormats/Detectors/Common/include/DetectorsCommonDataFormats/EncodedBlocks.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -835,7 +835,7 @@ auto EncodedBlocks<H, N, W>::getImage(const void* newHead)
835835
// we don't modify newHead, but still need to remove constness for relocation interface
836836
relocate(image.mRegistry.head, const_cast<char*>(reinterpret_cast<const char*>(newHead)), reinterpret_cast<char*>(&image));
837837

838-
return image;
838+
return std::move(image);
839839
}
840840

841841
///_____________________________________________________________________________
@@ -945,6 +945,7 @@ CTFIOSize EncodedBlocks<H, N, W>::decodeCompatImpl(dst_IT dstBegin, int slot, co
945945
{
946946

947947
// get references to the right data
948+
const auto& ansVersion = getANSHeader();
948949
const auto& block = mBlocks[slot];
949950
const auto& md = mMetadata[slot];
950951

@@ -983,6 +984,7 @@ CTFIOSize EncodedBlocks<H, N, W>::decodeRansV1Impl(dst_IT dstBegin, int slot, co
983984
{
984985

985986
// get references to the right data
987+
const auto& ansVersion = getANSHeader();
986988
const auto& block = mBlocks[slot];
987989
const auto& md = mMetadata[slot];
988990

DataFormats/Detectors/Common/include/DetectorsCommonDataFormats/internal/ExternalEntropyCoder.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ template <typename dst_T>
7979
constexpr size_t Overhead = 10 * rans::utils::pow2(10); // 10KB overhead safety margin
8080
const double_t RelativeSafetyFactor = 2.0 * safetyFactor;
8181
const size_t messageSizeB = nElements * sizeof(source_type);
82-
return rans::utils::nBytesTo<dst_T>(std::ceil(RelativeSafetyFactor * messageSizeB) + Overhead);
82+
return rans::utils::nBytesTo<dst_T>(std::ceil(safetyFactor * messageSizeB) + Overhead);
8383
}
8484

8585
template <typename source_T>

DataFormats/Detectors/Common/include/DetectorsCommonDataFormats/internal/InplaceEntropyCoder.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ void InplaceEntropyCoder<source_T>::makeEncoder()
166166
}
167167

168168
const size_t rangeBits = rans::utils::getRangeBits(*mMetrics.getCoderProperties().min, *mMetrics.getCoderProperties().max);
169+
const size_t nSamples = mMetrics.getDatasetProperties().numSamples;
169170
const size_t nUsedAlphabetSymbols = mMetrics.getDatasetProperties().nUsedAlphabetSymbols;
170171

171172
if (rangeBits <= 18) {

DataFormats/Detectors/Common/test/testCTFEntropyCoder.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ void encodeInplace(source_IT begin, source_IT end)
126126
std::vector<buffer_type> dictBuffer(sizeEstimate.getCompressedDictionarySize<buffer_type>(), 0);
127127

128128
auto encoderEnd = entropyCoder.encode(begin, end, encodeBuffer.data(), encodeBuffer.data() + encodeBuffer.size());
129-
[[maybe_unused]] auto literalsEnd = entropyCoder.writeIncompressible(literalSymbolsBuffer.data(), literalSymbolsBuffer.data() + literalSymbolsBuffer.size());
129+
auto literalsEnd = entropyCoder.writeIncompressible(literalSymbolsBuffer.data(), literalSymbolsBuffer.data() + literalSymbolsBuffer.size());
130130
auto dictEnd = entropyCoder.writeDictionary(dictBuffer.data(), dictBuffer.data() + dictBuffer.size());
131131
// decode
132132
const auto& coderProperties = metrics.getCoderProperties();
@@ -303,7 +303,7 @@ void encodeExternal(source_IT begin, source_IT end)
303303
auto encoderEnd = entropyCoder.encode(begin, end, encodeBuffer.data(), encodeBuffer.data() + encodeBuffer.size());
304304

305305
std::vector<buffer_type> literalSymbolsBuffer(entropyCoder.template computePackedIncompressibleSize<buffer_type>(), 0);
306-
[[maybe_unused]] auto literalsEnd = entropyCoder.writeIncompressible(literalSymbolsBuffer.data(), literalSymbolsBuffer.data() + literalSymbolsBuffer.size());
306+
auto literalsEnd = entropyCoder.writeIncompressible(literalSymbolsBuffer.data(), literalSymbolsBuffer.data() + literalSymbolsBuffer.size());
307307

308308
// decode
309309
auto decoder = ExternalEncoders.getDecoder<source_type>();

Utilities/rANS/benchmarks/bench_ransHistogram.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ void ransMakeHistogramBenchmark(benchmark::State& st, Args&&... args)
137137
histogram_type hist{};
138138
hist.addSamples(gsl::span<const source_type>(inputData));
139139

140-
for (std::ptrdiff_t symbol = histogram.getOffset(); symbol != histogram.getOffset() + static_cast<std::ptrdiff_t>(histogram.size()); ++symbol) {
140+
for (std::ptrdiff_t symbol = histogram.getOffset(); symbol != histogram.getOffset() + histogram.size(); ++symbol) {
141141
if (histogram[symbol] > 0) {
142142
LOG_IF(info, histogram[symbol] != hist[symbol]) << fmt::format("[{}]: {} != {}", symbol, hist[symbol], histogram[symbol]);
143143
isSame = isSame && (histogram[symbol] == hist[symbol]);
@@ -190,7 +190,7 @@ void ransAccessHistogramBenchmark(benchmark::State& st, Args&&... args)
190190
#endif
191191

192192
bool isSame = true;
193-
for (std::ptrdiff_t symbol = histogram.getOffset(); symbol != histogram.getOffset() + static_cast<std::ptrdiff_t>(histogram.size()); ++symbol) {
193+
for (std::ptrdiff_t symbol = histogram.getOffset(); symbol != histogram.getOffset() + histogram.size(); ++symbol) {
194194
if (histogram[symbol] > 0) {
195195
LOG_IF(info, histogram[symbol] != hist[symbol]) << fmt::format("[{}]: {} != {}", symbol, hist[symbol], histogram[symbol]);
196196
isSame = isSame && (histogram[symbol] == hist[symbol]);

Utilities/rANS/include/rANS/internal/containers/DenseHistogram.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ inline bool DenseHistogram<source_T, std::enable_if_t<sizeof(source_T) == 4>>::i
184184
ret = false;
185185
}
186186
}
187-
if (max - min > static_cast<difference_type>(this->MaxSize)) {
187+
if (max - min > this->MaxSize) {
188188
LOGP(warning, "DenseHistogram exceeds {} elements threshold", this->MaxSize);
189189
ret = false;
190190
}
@@ -233,6 +233,8 @@ inline auto DenseHistogram<source_T, std::enable_if_t<sizeof(source_T) == 4>>::a
233233
constexpr size_t nUnroll = 4 * ElemsPerQWord;
234234
auto iter = begin;
235235

236+
const source_type offset = this->getOffset();
237+
236238
if (getRangeBits(min, max) <= 17) {
237239
container_type histogram{this->mContainer.size(), this->mContainer.getOffset()};
238240

Utilities/rANS/include/rANS/internal/containers/ReverseSymbolLookupTable.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ class ReverseSymbolLookupTable
7171
return mLut[cumul];
7272
};
7373

74-
inline iterator_type begin() const noexcept { return mLut.data(); };
75-
inline iterator_type end() const noexcept { return mLut.data() + size(); };
74+
inline const iterator_type begin() const noexcept { return mLut.data(); };
75+
inline const iterator_type end() const noexcept { return mLut.data() + size(); };
7676

7777
container_type mLut{};
7878
};

Utilities/rANS/include/rANS/internal/containers/Symbol.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,11 @@ class Symbol
3737

3838
// TODO(milettri): fix once ROOT cling respects the standard http://wg21.link/p1286r2
3939
constexpr Symbol() noexcept {}; // NOLINT
40-
constexpr Symbol(value_type frequency, value_type cumulative, [[maybe_unused]] size_t symbolTablePrecision = 0)
41-
: mSymbol{frequency, cumulative} {};
40+
constexpr Symbol(value_type frequency, value_type cumulative, size_t symbolTablePrecision = 0)
41+
: mSymbol{frequency, cumulative}
42+
{
43+
(void)symbolTablePrecision; // silence compiler warnings
44+
};
4245
[[nodiscard]] inline constexpr value_type getFrequency() const noexcept { return mSymbol[0]; };
4346
[[nodiscard]] inline constexpr value_type getCumulative() const noexcept { return mSymbol[1]; };
4447
[[nodiscard]] inline constexpr const value_type* data() const noexcept { return mSymbol.data(); };

Utilities/rANS/include/rANS/internal/encode/Encoder.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,7 @@ decltype(auto) Encoder<encoder_T, symbolTable_T, nStreams_V>::process(source_IT
143143
EncoderSymbolMapper<symbolTable_type, coder_type, literals_IT> symbolMapper{this->mSymbolTable, literalsBegin};
144144
typename coder_type::symbol_type encoderSymbols[2]{};
145145

146-
// one past the end. Will not be dereferenced, thus safe.
147-
#pragma GCC diagnostic push
148-
#pragma GCC diagnostic ignored "-Warray-bounds"
149146
coder_type* codersREnd = advanceIter(coders.data(), -1);
150-
#pragma GCC diagnostic pop
151147
coder_type* activeCoder = codersREnd + nPartialCoderIterations;
152148

153149
// we are encoding backwards!

Utilities/rANS/include/rANS/internal/encode/EncoderSymbolMapper.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,8 @@ class EncoderSymbolMapper<symbolTable_T,
254254
{
255255
using namespace internal::simd;
256256

257+
const size_type nStreams = coder_type::getNstreams();
258+
257259
difference_type currentStream = nActiveStreams;
258260

259261
epi32_t<SIMDWidth::SSE, 2> frequencies;
@@ -328,6 +330,8 @@ class EncoderSymbolMapper<symbolTable_T,
328330
{
329331
using namespace internal::simd;
330332

333+
const size_type nStreams = coder_type::getNstreams();
334+
331335
difference_type currentStream = nActiveStreams;
332336

333337
epi32_t<SIMDWidth::SSE, 2> frequencies;

0 commit comments

Comments
 (0)