o-du/phy
Intel O-RAN/X-RAN Generated Doxygen Documentation
xran_compression.hpp
Go to the documentation of this file.
1 /******************************************************************************
2 *
3 * Copyright (c) 2019 Intel.
4 *
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
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
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.
16 *
17 *******************************************************************************/
18 
19 #pragma once
20 #include <stdint.h>
21 
22 // This configuration file sets global constants and macros which are
23 // of general use throughout the project.
24 
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;
29 
30 // Force the data to which this macro is applied to be aligned on a cache line.
31 // For example:
32 //
33 // CACHE_ALIGNED float data[64];
34 #define CACHE_ALIGNED alignas(k_cacheByteAlignment)
35 
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
39 // writes.
40 #define ASSUME_CACHE_ALIGNED(data) __assume_aligned(data, k_cacheByteAlignment);
41 
46 #pragma warning(disable:1418)
47 #pragma warning(disable:1419)
48 
49 
51 {
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;
59 
61  {
63  CACHE_ALIGNED uint8_t dataCompressedDataOut[k_numSampsCompressed];
66  int iqWidth;
67  };
68 
69  struct ExpandedData
70  {
72  CACHE_ALIGNED int16_t dataExpandedIn[k_numSampsExpanded];
74 
76  int iqWidth;
77  };
78 
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);
84 
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);
90 }
91 
93 {
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;
101 
103  {
105  CACHE_ALIGNED uint8_t dataCompressedDataOut[k_numSampsCompressed];
108  int iqWidth;
109  };
110 
112  {
114  CACHE_ALIGNED int16_t dataExpandedIn[k_numSampsExpanded];
116 
118  int iqWidth;
119  };
120 
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); */
126 
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);*/
132 }
133 
CACHE_ALIGNED uint8_t dataCompressedDataOut[k_numSampsCompressed]
Compressed data.
void BlockFloatCompress_12b_AVX512(const ExpandedData &dataIn, CompressedData *dataOut)
12 bit compression
int iqWidth
Size of mantissa including sign bit.
int iqWidth
Size of mantissa including sign bit.
int iqWidth
Size of mantissa including sign bit.
void BlockFloatCompress_9b_AVX512(const ExpandedData &dataIn, CompressedData *dataOut)
9 bit compression
void BlockFloatCompress_10b_AVX512(const ExpandedData &dataIn, CompressedData *dataOut)
10 bit compression
int iqWidth
Size of mantissa including sign bit.
void BlockFloatExpand_8b_AVX512(const CompressedData &dataIn, ExpandedData *dataOut)
8 bit expansion
void BlockFloatExpand_9b_AVX512(const CompressedData &dataIn, ExpandedData *dataOut)
9 bit expansion
constexpr unsigned k_cacheByteAlignment
#define CACHE_ALIGNED
void BlockFloatExpand_12b_AVX512(const CompressedData &dataIn, ExpandedData *dataOut)
12 bit expansion
CACHE_ALIGNED uint8_t * dataCompressed
void BlockFloatExpand_10b_AVX512(const CompressedData &dataIn, ExpandedData *dataOut)
10 bit expansion
void BlockFloatCompress_8b_AVX512(const ExpandedData &dataIn, CompressedData *dataOut)
8 bit compression
CACHE_ALIGNED int16_t * dataExpanded
void BlockFloatCompress_Basic(const ExpandedData &dataIn, CompressedData *dataOut)
Reference compression.
void BlockFloatExpand_Basic(const CompressedData &dataIn, ExpandedData *dataOut)
Reference expansion.