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