Skip to content

Commit

Permalink
Add macro definitions to toggle between AVX2/AVX512
Browse files Browse the repository at this point in the history
  • Loading branch information
lin-toto committed Jun 22, 2023
1 parent 7344a71 commit 21d1d76
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
11 changes: 9 additions & 2 deletions include/recoil/split/rans_split_decoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@
#include "recoil/rans_coded_data.h"
#include "recoil/rans_decoder.h"
#include "recoil/simd/rans_decoder_avx2_32x32.h"
//#include "recoil/simd/rans_decoder_avx512_32x32.h"
#include <span>

#ifdef AVX512
#include "recoil/simd/rans_decoder_avx512_32x32.h"
#endif

namespace Recoil {
template<std::unsigned_integral CdfType, std::unsigned_integral ValueType,
std::unsigned_integral RansStateType, std::unsigned_integral RansBitstreamType,
Expand All @@ -24,8 +27,12 @@ namespace Recoil {
// TODO: allow any class derived from RansDecoder, from a template parameter
//using MyRansDecoder = RansDecoder<
// CdfType, ValueType, RansStateType, RansBitstreamType, ProbBits, RenormLowerBound, WriteBits, LutGranularity, NInterleaved>;
#ifdef AVX512
using MyRansDecoder = RansDecoder_AVX512_32x32<ValueType, ProbBits, RenormLowerBound, LutGranularity>;
#else
using MyRansDecoder = RansDecoder_AVX2_32x32<ValueType, ProbBits, RenormLowerBound, LutGranularity>;
//using MyRansDecoder = RansDecoder_AVX512_32x32<ValueType, ProbBits, RenormLowerBound, LutGranularity>;
#endif

public:
std::vector<ValueType> result;

Expand Down
10 changes: 8 additions & 2 deletions include/recoil/split/rans_symbol_split_decoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@
#include "recoil/rans_coded_data.h"
#include "recoil/rans_decoder.h"
#include "recoil/simd/rans_decoder_avx2_32x32.h"
//#include "recoil/simd/rans_decoder_avx512_32x32.h"
#include <span>
#include <numeric>

#ifdef AVX512
#include "recoil/simd/rans_decoder_avx512_32x32.h"
#endif

namespace Recoil {
template<std::unsigned_integral CdfType, std::unsigned_integral ValueType,
std::unsigned_integral RansStateType, std::unsigned_integral RansBitstreamType,
Expand All @@ -24,8 +27,11 @@ namespace Recoil {
// TODO: allow any class derived from RansDecoder, from a template parameter
//using MyRansDecoder = RansDecoder<
// CdfType, ValueType, RansStateType, RansBitstreamType, ProbBits, RenormLowerBound, WriteBits, LutGranularity, NInterleaved>;
#ifdef AVX512
using MyRansDecoder = RansDecoder_AVX512_32x32<ValueType, ProbBits, RenormLowerBound, LutGranularity>;
#else
using MyRansDecoder = RansDecoder_AVX2_32x32<ValueType, ProbBits, RenormLowerBound, LutGranularity>;
//using MyRansDecoder = RansDecoder_AVX512_32x32<ValueType, ProbBits, RenormLowerBound, LutGranularity>;
#endif
public:
std::vector<ValueType> result;

Expand Down

0 comments on commit 21d1d76

Please sign in to comment.