1 /******************************************************************************
\r
3 * Copyright (c) 2019 Intel.
\r
5 * Licensed under the Apache License, Version 2.0 (the "License");
\r
6 * you may not use this file except in compliance with the License.
\r
7 * You may obtain a copy of the License at
\r
9 * http://www.apache.org/licenses/LICENSE-2.0
\r
11 * Unless required by applicable law or agreed to in writing, software
\r
12 * distributed under the License is distributed on an "AS IS" BASIS,
\r
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
14 * See the License for the specific language governing permissions and
\r
15 * limitations under the License.
\r
17 *******************************************************************************/
\r
22 // This configuration file sets global constants and macros which are
\r
23 // of general use throughout the project.
\r
25 // All current IA processors of interest align their cache lines on
\r
26 // this boundary. If the cache alignment for future processors changes
\r
27 // then the most restrictive alignment should be set.
\r
28 constexpr unsigned k_cacheByteAlignment = 64;
\r
30 // Force the data to which this macro is applied to be aligned on a cache line.
\r
33 // CACHE_ALIGNED float data[64];
\r
34 #define CACHE_ALIGNED alignas(k_cacheByteAlignment)
\r
36 // Hint to the compiler that the data to which this macro is applied
\r
37 // can be assumed to be aligned to a cache line. This allows the
\r
38 // compiler to generate improved code by using aligned reads and
\r
40 #define ASSUME_CACHE_ALIGNED(data) __assume_aligned(data, k_cacheByteAlignment);
\r
42 /// Intel compiler frequently complains about templates not being declared in an external
\r
43 /// header. Templates are used throughout this project's source files to define local type-specific
\r
44 /// versions of functions. Defining every one of these in a header is unnecessary, so the warnings
\r
45 /// about this are turned off globally.
\r
46 #pragma warning(disable:1418)
\r
47 #pragma warning(disable:1419)
\r
50 namespace BlockFloatCompander
\r
52 /// Compute 32 RB at a time
\r
53 static constexpr int k_numBitsIQ = 16;
\r
54 static constexpr int k_numRB = 16;
\r
55 static constexpr int k_numRE = 12;
\r
56 static constexpr int k_numREReal = k_numRE * 2;
\r
57 static constexpr int k_numSampsExpanded = k_numRB * k_numREReal;
\r
58 static constexpr int k_numSampsCompressed = (k_numSampsExpanded * 2) + k_numRB;
\r
60 struct CompressedData
\r
63 CACHE_ALIGNED uint8_t dataCompressedDataOut[k_numSampsCompressed];
\r
64 CACHE_ALIGNED uint8_t *dataCompressed;
\r
65 /// Size of mantissa including sign bit
\r
71 /// Expanded data or input data to compressor
\r
72 CACHE_ALIGNED int16_t dataExpandedIn[k_numSampsExpanded];
\r
73 CACHE_ALIGNED int16_t *dataExpanded;
\r
75 /// Size of mantissa including sign bit
\r
79 void BlockFloatCompress_Basic(const ExpandedData& dataIn, CompressedData* dataOut);
\r
80 void BlockFloatCompress_8b_AVX512(const ExpandedData& dataIn, CompressedData* dataOut);
\r
81 void BlockFloatCompress_9b_AVX512(const ExpandedData& dataIn, CompressedData* dataOut);
\r
82 void BlockFloatCompress_10b_AVX512(const ExpandedData& dataIn, CompressedData* dataOut);
\r
83 void BlockFloatCompress_12b_AVX512(const ExpandedData& dataIn, CompressedData* dataOut);
\r
85 void BlockFloatExpand_Basic(const CompressedData& dataIn, ExpandedData* dataOut);
\r
86 void BlockFloatExpand_8b_AVX512(const CompressedData& dataIn, ExpandedData* dataOut);
\r
87 void BlockFloatExpand_9b_AVX512(const CompressedData& dataIn, ExpandedData* dataOut);
\r
88 void BlockFloatExpand_10b_AVX512(const CompressedData& dataIn, ExpandedData* dataOut);
\r
89 void BlockFloatExpand_12b_AVX512(const CompressedData& dataIn, ExpandedData* dataOut);
\r
92 namespace BlockFloatCompanderBFW
\r
94 /// Compute 32 RB at a time
\r
95 static constexpr int k_numBitsIQ = 16;
\r
96 static constexpr int k_numRB = 1;
\r
97 static constexpr int k_numRE = 32;
\r
98 static constexpr int k_numREReal = k_numRE * 2;
\r
99 static constexpr int k_numSampsExpanded = k_numRB * k_numREReal;
\r
100 static constexpr int k_numSampsCompressed = (k_numSampsExpanded * 2) + k_numRB;
\r
102 struct CompressedData
\r
104 /// Compressed data
\r
105 CACHE_ALIGNED uint8_t dataCompressedDataOut[k_numSampsCompressed];
\r
106 CACHE_ALIGNED uint8_t *dataCompressed;
\r
107 /// Size of mantissa including sign bit
\r
111 struct ExpandedData
\r
113 /// Expanded data or input data to compressor
\r
114 CACHE_ALIGNED int16_t dataExpandedIn[k_numSampsExpanded];
\r
115 CACHE_ALIGNED int16_t *dataExpanded;
\r
117 /// Size of mantissa including sign bit
\r
121 void BlockFloatCompress_Basic(const ExpandedData& dataIn, CompressedData* dataOut);
\r
122 /* void BlockFloatCompress_8b_AVX512(const ExpandedData& dataIn, CompressedData* dataOut);
\r
123 void BlockFloatCompress_9b_AVX512(const ExpandedData& dataIn, CompressedData* dataOut);
\r
124 void BlockFloatCompress_10b_AVX512(const ExpandedData& dataIn, CompressedData* dataOut);
\r
125 void BlockFloatCompress_12b_AVX512(const ExpandedData& dataIn, CompressedData* dataOut); */
\r
127 void BlockFloatExpand_Basic(const CompressedData& dataIn, ExpandedData* dataOut);
\r
128 /* void BlockFloatExpand_8b_AVX512(const CompressedData& dataIn, ExpandedData* dataOut);
\r
129 void BlockFloatExpand_9b_AVX512(const CompressedData& dataIn, ExpandedData* dataOut);
\r
130 void BlockFloatExpand_10b_AVX512(const CompressedData& dataIn, ExpandedData* dataOut);
\r
131 void BlockFloatExpand_12b_AVX512(const CompressedData& dataIn, ExpandedData* dataOut);*/
\r