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 + k_numRB;
59 static constexpr int k_iqWidth = 8;
65 CACHE_ALIGNED int8_t dataCompressed[k_numSampsCompressed];
70 /// Expanded data or input data to compressor
71 CACHE_ALIGNED int16_t dataExpanded[k_numSampsExpanded];
74 void BlockFloatCompress_AVX512(const ExpandedData& dataIn, CompressedData* dataOut);
76 void BlockFloatExpand_AVX512(const CompressedData& dataIn, ExpandedData* dataOut);
78 void BlockFloatCompress_Basic(const ExpandedData& dataIn, CompressedData* dataOut);
80 void BlockFloatExpand_Basic(const CompressedData& dataIn, ExpandedData* dataOut);