mirror of
https://gitlab.eurecom.fr/oai/openairinterface5g.git
synced 2026-07-13 04:30:28 +00:00
Merge remote-tracking branch 'origin/issue1076' into integration_2026_w22 (!4076)
Fix imscope and tracy build Make headers required in imscope includable in C++ sources by removing direct and indirect inclusions of VLAs. Closes: #1076 Reviewed-By: Robert Schmidt <robert.schmidt@openairinterface.org>
This commit is contained in:
37
ci-scripts/docker/Dockerfile.build.optional.ubuntu
Normal file
37
ci-scripts/docker/Dockerfile.build.optional.ubuntu
Normal file
@@ -0,0 +1,37 @@
|
||||
# SPDX-License-Identifier: LicenseRef-CSSL-1.0
|
||||
|
||||
FROM ran-base:latest AS optional-base
|
||||
|
||||
RUN DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
RUN apt update && \
|
||||
apt upgrade --yes && \
|
||||
apt install --yes \
|
||||
libglfw3-dev
|
||||
|
||||
WORKDIR /oai-src
|
||||
COPY . .
|
||||
|
||||
FROM optional-base AS build-imscope
|
||||
|
||||
RUN \
|
||||
# Mount CCache cache directory
|
||||
--mount=type=cache,target=/root/.cache/ccache/,id=ccache_imscope \
|
||||
# Mount CPM package cache
|
||||
--mount=type=cache,target=/root/.cache/cpm/,id=cpmcache_imscope \
|
||||
mkdir -p /build-imscope && \
|
||||
cd /build-imscope && \
|
||||
cmake /oai-src/ -DENABLE_IMSCOPE=ON -GNinja && \
|
||||
ninja imscope nr-softmodem nr-uesoftmodem
|
||||
|
||||
FROM optional-base AS build-tracy
|
||||
|
||||
RUN \
|
||||
# Mount CCache cache directory
|
||||
--mount=type=cache,target=/root/.cache/ccache/,id=ccache_tracy \
|
||||
# Mount CPM package cache
|
||||
--mount=type=cache,target=/root/.cache/cpm/,id=cpmcache_tracy \
|
||||
mkdir -p /build-tracy && \
|
||||
cd /build-tracy && \
|
||||
cmake /oai-src/ -DTRACY_ENABLE=ON -GNinja && \
|
||||
ninja nr-softmodem nr-uesoftmodem
|
||||
@@ -3,6 +3,7 @@
|
||||
*/
|
||||
|
||||
#include "bits.h"
|
||||
#include "utils.h"
|
||||
// we avoid assertions.h as it necessitates othe dependencies (e.g., exit_function)
|
||||
#include <assert.h>
|
||||
#include <simde/x86/gfni.h>
|
||||
@@ -73,3 +74,70 @@ uint64_t reverse_bits(uint64_t in, int n_bits)
|
||||
return rev_bits;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the next contiguous block of set bits.
|
||||
* @param bitmap The bit buffer
|
||||
* @param size Total bits in the buffer
|
||||
* @param pos Pointer to current bit index (updated by function)
|
||||
* @param start Output: Start index of the found block
|
||||
* @param end Output: End index of the found block
|
||||
* @return true if a block was found, false if no more bits are set
|
||||
*/
|
||||
bool find_next_rb_block(const uint32_t *bitmap, int size, int *pos, int *start, int *end)
|
||||
{
|
||||
const int words = (size + 31) / 32;
|
||||
|
||||
// Find start of next block
|
||||
int idx = get_first_bit_index_mask(bitmap, words, *pos, size - *pos);
|
||||
if (idx < 0)
|
||||
return false;
|
||||
*start = idx;
|
||||
|
||||
// Find end of block: first zero bit after idx
|
||||
// Reuse get_first_bit_index_from on the inverted bitmap
|
||||
idx++;
|
||||
int word_idx = idx / 32;
|
||||
int n = words - word_idx;
|
||||
uint32_t inv[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
inv[i] = ~bitmap[word_idx + i];
|
||||
if (size % 32 != 0)
|
||||
inv[n - 1] &= (1u << (size % 32)) - 1;
|
||||
|
||||
int end_off = get_first_bit_index_mask(inv, n, idx - word_idx * 32, size - idx);
|
||||
idx = (end_off < 0) ? size : word_idx * 32 + end_off;
|
||||
|
||||
*end = (idx > size) ? size - 1 : idx - 1;
|
||||
*pos = idx; // Update position for the next call
|
||||
return true;
|
||||
}
|
||||
|
||||
bool check_rb_in_bitmap(const freq_alloc_bitmap_t *alloc, int rb)
|
||||
{
|
||||
return (alloc->bitmap[rb / 32] >> (rb % 32)) & 0x01;
|
||||
}
|
||||
|
||||
freq_alloc_bitmap_t set_start_end_from_bitmap(int size, int alloc_size, const uint8_t *bitmap)
|
||||
{
|
||||
freq_alloc_bitmap_t alloc = {0};
|
||||
int num_words = (size + 31) / 32;
|
||||
memcpy(alloc.bitmap, bitmap, alloc_size);
|
||||
alloc.num_rbs = count_bits(alloc.bitmap, num_words);
|
||||
alloc.first_rb = get_first_bit_index(alloc.bitmap, num_words);
|
||||
alloc.last_rb = get_last_bit_index(alloc.bitmap, num_words);
|
||||
AssertFatal(alloc.first_rb >= 0 && alloc.last_rb >=0 , "No valid RB set, no bit set in bitmap\n");
|
||||
return alloc;
|
||||
}
|
||||
|
||||
freq_alloc_bitmap_t set_bitmap_from_start_size(int start, int size)
|
||||
{
|
||||
freq_alloc_bitmap_t alloc = {
|
||||
.num_rbs = size,
|
||||
.first_rb = start,
|
||||
.last_rb = start + size - 1
|
||||
};
|
||||
memset(alloc.bitmap, 0, sizeof(alloc.bitmap));
|
||||
for (int i = start; i < size + start; i++)
|
||||
alloc.bitmap[i / 32] |= (1U << (i % 32));
|
||||
return alloc;
|
||||
}
|
||||
|
||||
@@ -73,4 +73,16 @@ static __attribute__((always_inline)) inline int count_bits64_with_mask(uint64_t
|
||||
uint64_t mask = ((1LL << num) - 1) << start;
|
||||
return count_bits64(v & mask);
|
||||
}
|
||||
|
||||
bool find_next_rb_block(const uint32_t *bitmap, int size, int *pos, int *start, int *end);
|
||||
typedef struct {
|
||||
int first_rb;
|
||||
int last_rb;
|
||||
int num_rbs;
|
||||
uint32_t bitmap[9];
|
||||
} freq_alloc_bitmap_t;
|
||||
bool check_rb_in_bitmap(const freq_alloc_bitmap_t *alloc, int rb);
|
||||
freq_alloc_bitmap_t set_start_end_from_bitmap(int size, int alloc_size, const uint8_t *bitmap);
|
||||
freq_alloc_bitmap_t set_bitmap_from_start_size(int start, int size);
|
||||
|
||||
#endif /* BITS_H_ */
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#ifndef __NR_ESTIMATION_DEFS__H__
|
||||
#define __NR_ESTIMATION_DEFS__H__
|
||||
|
||||
#include "PHY/nr_phy_common/inc/nr_phy_common.h"
|
||||
#include "common/utils/bits.h"
|
||||
#include "PHY/defs_nr_UE.h"
|
||||
|
||||
/** @addtogroup _PHY_PARAMETER_ESTIMATION_BLOCKS_
|
||||
|
||||
@@ -286,7 +286,6 @@ void nr_generate_pbch_llr(const PHY_VARS_NR_UE *ue,
|
||||
const c16_t dl_ch_estimates[frame_parms->nb_antennas_rx][frame_parms->ofdm_symbol_size],
|
||||
int16_t pbch_e_rx[NR_POLAR_PBCH_E])
|
||||
{
|
||||
TracyCZone(ctx, true);
|
||||
const int symbol_offset = nr_get_ssb_start_symbol(frame_parms, i_ssb) % (NR_SYMBOLS_PER_SLOT);
|
||||
const int nb_re = (symbolSSB == 2) ? 72 : 180;
|
||||
|
||||
@@ -377,6 +376,7 @@ int nr_pbch_decode(PHY_VARS_NR_UE *ue,
|
||||
int *ret_symbol_offset,
|
||||
fapiPbch_t *result)
|
||||
{
|
||||
TracyCZone(ctx, true);
|
||||
if (ue) {
|
||||
UEscopeCopy(ue, pbchLlr, pbch_e_rx, sizeof(int16_t), frame_parms->nb_antennas_rx, NR_POLAR_PBCH_E, 0);
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <math.h>
|
||||
#include "PHY/nr_phy_common/inc/nr_phy_common.h"
|
||||
#include "PHY/CODING/nrPolar_tools/nr_polar_psbch_defs.h"
|
||||
#include "common/utils/bits.h"
|
||||
|
||||
#define NR_PUSCH_x 2 // UCI placeholder bit TS 38.212 V15.4.0 subclause 5.3.3.1
|
||||
#define NR_PUSCH_y 3 // UCI placeholder bit
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include "common/platform_constants.h"
|
||||
#include "defs_nr_common.h"
|
||||
#include "PHY/nr_phy_common/inc/nr_phy_common.h"
|
||||
#include "common/utils/bits.h"
|
||||
#include "CODING/nrPolar_tools/nr_polar_pbch_defs.h"
|
||||
#include "openair2/NR_PHY_INTERFACE/NR_IF_Module.h"
|
||||
#include "PHY/CODING/nrLDPC_coding/nrLDPC_coding_interface.h"
|
||||
|
||||
@@ -376,15 +376,4 @@ int nr_get_ssb_start_sc(int scs,
|
||||
int ssb_offset_point_a,
|
||||
int ssb_sco,
|
||||
frequency_range_t freq_range);
|
||||
|
||||
bool find_next_rb_block(const uint32_t *bitmap, int size, int *pos, int *start, int *end);
|
||||
typedef struct {
|
||||
int first_rb;
|
||||
int last_rb;
|
||||
int num_rbs;
|
||||
uint32_t bitmap[9];
|
||||
} freq_alloc_bitmap_t;
|
||||
bool check_rb_in_bitmap(const freq_alloc_bitmap_t *alloc, int rb);
|
||||
freq_alloc_bitmap_t set_start_end_from_bitmap(int size, int alloc_size, const uint8_t bitmap[alloc_size]);
|
||||
freq_alloc_bitmap_t set_bitmap_from_start_size(int start, int size);
|
||||
#endif
|
||||
|
||||
@@ -428,79 +428,6 @@ void nr_scale_channel(int size, int ch_estimates_ext[][size], int symb, uint32_t
|
||||
}
|
||||
}
|
||||
|
||||
freq_alloc_bitmap_t set_start_end_from_bitmap(int size, int alloc_size, const uint8_t bitmap[alloc_size])
|
||||
{
|
||||
freq_alloc_bitmap_t alloc = {0};
|
||||
int num_words = (size + 31) / 32;
|
||||
AssertFatal(num_words <= sizeofArray(alloc.bitmap),
|
||||
"freq_alloc_bitmap.bitmap %lu words < %d\n",
|
||||
sizeofArray(alloc.bitmap),
|
||||
num_words);
|
||||
memcpy(alloc.bitmap, bitmap, alloc_size);
|
||||
alloc.num_rbs = count_bits(alloc.bitmap, num_words);
|
||||
alloc.first_rb = get_first_bit_index(alloc.bitmap, num_words);
|
||||
alloc.last_rb = get_last_bit_index(alloc.bitmap, num_words);
|
||||
AssertFatal(alloc.first_rb >= 0 && alloc.last_rb >=0 , "No valid RB set, no bit set in bitmap\n");
|
||||
return alloc;
|
||||
}
|
||||
|
||||
freq_alloc_bitmap_t set_bitmap_from_start_size(int start, int size)
|
||||
{
|
||||
freq_alloc_bitmap_t alloc = {
|
||||
.num_rbs = size,
|
||||
.first_rb = start,
|
||||
.last_rb = start + size - 1
|
||||
};
|
||||
memset(alloc.bitmap, 0, sizeof(alloc.bitmap));
|
||||
for (int i = start; i < size + start; i++)
|
||||
alloc.bitmap[i / 32] |= (1U << (i % 32));
|
||||
return alloc;
|
||||
}
|
||||
|
||||
bool check_rb_in_bitmap(const freq_alloc_bitmap_t *alloc, int rb)
|
||||
{
|
||||
return (alloc->bitmap[rb / 32] >> (rb % 32)) & 0x01;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the next contiguous block of set bits.
|
||||
* @param bitmap The bit buffer
|
||||
* @param size Total bits in the buffer
|
||||
* @param pos Pointer to current bit index (updated by function)
|
||||
* @param start Output: Start index of the found block
|
||||
* @param end Output: End index of the found block
|
||||
* @return true if a block was found, false if no more bits are set
|
||||
*/
|
||||
bool find_next_rb_block(const uint32_t *bitmap, int size, int *pos, int *start, int *end)
|
||||
{
|
||||
AssertFatal(*pos >= 0 && *pos <= size, "Invalid combination of bit index %d and size %d\n", *pos, size);
|
||||
const int words = (size + 31) / 32;
|
||||
|
||||
// Find start of next block
|
||||
int idx = get_first_bit_index_mask(bitmap, words, *pos, size - *pos);
|
||||
if (idx < 0)
|
||||
return false;
|
||||
*start = idx;
|
||||
|
||||
// Find end of block: first zero bit after idx
|
||||
// Reuse get_first_bit_index_from on the inverted bitmap
|
||||
idx++;
|
||||
int word_idx = idx / 32;
|
||||
int n = words - word_idx;
|
||||
uint32_t inv[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
inv[i] = ~bitmap[word_idx + i];
|
||||
if (size % 32 != 0)
|
||||
inv[n - 1] &= (1u << (size % 32)) - 1;
|
||||
|
||||
int end_off = get_first_bit_index_mask(inv, n, idx - word_idx * 32, size - idx);
|
||||
idx = (end_off < 0) ? size : word_idx * 32 + end_off;
|
||||
|
||||
*end = (idx > size) ? size - 1 : idx - 1;
|
||||
*pos = idx; // Update position for the next call
|
||||
return true;
|
||||
}
|
||||
|
||||
void nr_fo_compensation(double fo_Hz, int samples_per_ms, int sample_offset, const c16_t *rxdata_in, c16_t *rxdata_out, int size)
|
||||
{
|
||||
const double phase_inc = -fo_Hz / (samples_per_ms * 1000);
|
||||
|
||||
Reference in New Issue
Block a user