vrtsim: Enable batch processing in perform_channel_modelling
In perfrom_channel_modelling, do convolution in batches which allows vrtsim to write the channel samples as they are being produced instead of waiting for the last sample in the slot to be ready.
This commit is contained in:
+13
-1
@@ -372,6 +372,8 @@ typedef struct {
|
|||||||
int nbAnt;
|
int nbAnt;
|
||||||
int flags;
|
int flags;
|
||||||
int aarx;
|
int aarx;
|
||||||
|
int batch_size;
|
||||||
|
int num_batches;
|
||||||
c16_t saved_samples[MAX_NUM_ANTENNAS_TX][SAVED_SAMPLES_LEN];
|
c16_t saved_samples[MAX_NUM_ANTENNAS_TX][SAVED_SAMPLES_LEN];
|
||||||
} channel_modelling_args_t;
|
} channel_modelling_args_t;
|
||||||
|
|
||||||
@@ -415,8 +417,14 @@ static void perform_channel_modelling(void *arg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (int batch_index = 0; batch_index < channel_modelling_args->num_batches; batch_index++) {
|
||||||
|
int start_sample = batch_index * channel_modelling_args->batch_size;
|
||||||
|
int num_samples = min(channel_modelling_args->batch_size, nsamps - start_sample);
|
||||||
|
if (start_sample >= nsamps) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
for (int aatx = 0; aatx < nb_tx_ant; aatx++) {
|
for (int aatx = 0; aatx < nb_tx_ant; aatx++) {
|
||||||
for (int i = 0; i < nsamps; i++) {
|
for (int i = start_sample; i < start_sample + num_samples; i++) {
|
||||||
cf_t *impulse_response = channel_impulse_response_p[aatx];
|
cf_t *impulse_response = channel_impulse_response_p[aatx];
|
||||||
for (int l = 0; l < channel_desc->channel_length; l++) {
|
for (int l = 0; l < channel_desc->channel_length; l++) {
|
||||||
int idx = i - l;
|
int idx = i - l;
|
||||||
@@ -458,6 +466,7 @@ static void perform_channel_modelling(void *arg)
|
|||||||
channel_modelling_args->flags,
|
channel_modelling_args->flags,
|
||||||
aarx);
|
aarx);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static int vrtsim_write_with_chanmod(vrtsim_state_t *vrtsim_state,
|
static int vrtsim_write_with_chanmod(vrtsim_state_t *vrtsim_state,
|
||||||
openair0_timestamp timestamp,
|
openair0_timestamp timestamp,
|
||||||
@@ -470,6 +479,7 @@ static int vrtsim_write_with_chanmod(vrtsim_state_t *vrtsim_state,
|
|||||||
static c16_t saved_samples[MAX_NUM_ANTENNAS_TX][SAVED_SAMPLES_LEN] __attribute__((aligned(32))) = {0};
|
static c16_t saved_samples[MAX_NUM_ANTENNAS_TX][SAVED_SAMPLES_LEN] __attribute__((aligned(32))) = {0};
|
||||||
// Indicates what samples are saves in saved_samples
|
// Indicates what samples are saves in saved_samples
|
||||||
static openair0_timestamp last_timestamp = 0;
|
static openair0_timestamp last_timestamp = 0;
|
||||||
|
const int batch_size = 4096;
|
||||||
|
|
||||||
AssertFatal(nbAnt <= MAX_NUM_ANTENNAS_TX, "Number of antennas %d exceeds maximum %d\n", nbAnt, MAX_NUM_ANTENNAS_TX);
|
AssertFatal(nbAnt <= MAX_NUM_ANTENNAS_TX, "Number of antennas %d exceeds maximum %d\n", nbAnt, MAX_NUM_ANTENNAS_TX);
|
||||||
for (int aarx = 0; aarx < vrtsim_state->peer_info.num_rx_antennas; aarx++) {
|
for (int aarx = 0; aarx < vrtsim_state->peer_info.num_rx_antennas; aarx++) {
|
||||||
@@ -481,6 +491,8 @@ static int vrtsim_write_with_chanmod(vrtsim_state_t *vrtsim_state,
|
|||||||
args->nbAnt = nbAnt;
|
args->nbAnt = nbAnt;
|
||||||
args->flags = flags;
|
args->flags = flags;
|
||||||
args->aarx = aarx;
|
args->aarx = aarx;
|
||||||
|
args->batch_size = batch_size;
|
||||||
|
args->num_batches = (nsamps + batch_size - 1) / batch_size;
|
||||||
for (int i = 0; i < nbAnt; i++) {
|
for (int i = 0; i < nbAnt; i++) {
|
||||||
args->samples[i] = samplesVoid[i];
|
args->samples[i] = samplesVoid[i];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user