correct verification of sched rates in sched benchmark test

master
Francisco 4 years ago committed by Francisco Paisana
parent d334907afe
commit ac4d058fbf

@ -895,7 +895,7 @@ void sf_sched::set_ul_sched_result(const sf_cch_allocator::alloc_result_t& dci_r
fmt::format_to(str_buffer,
"SCHED: {} {} rnti=0x{:x}, cc={}, pid={}, dci=({},{}), prb={}, n_rtx={}, tbs={}, bsr={} ({}-{})",
ul_alloc.is_msg3 ? "Msg3" : "UL",
ul_alloc.is_retx() ? "retx" : "newtx",
ul_alloc.is_retx() ? "retx" : "tx",
user->get_rnti(),
cc_cfg->enb_cc_idx,
h->get_id(),

@ -83,7 +83,7 @@ tbs_info compute_mcs_and_tbs(uint32_t nof_prb,
float max_coderate = srslte_cqi_to_coderate(std::min(cqi + 1U, 15U), use_tbs_index_alt);
uint32_t max_Qm = (is_ul) ? (ulqam64_enabled ? 6 : 4) : (use_tbs_index_alt ? 8 : 6);
max_coderate = std::min(max_coderate, 0.93F * max_Qm);
max_coderate = std::min(max_coderate, 0.932F * max_Qm);
int mcs = 0;
float prev_max_coderate = 0;
@ -113,7 +113,7 @@ tbs_info compute_mcs_and_tbs(uint32_t nof_prb,
// update max coderate based on mcs
srslte_mod_t mod = (is_ul) ? srslte_ra_ul_mod_from_mcs(mcs) : srslte_ra_dl_mod_from_mcs(mcs, use_tbs_index_alt);
uint32_t Qm = srslte_mod_bits_x_symbol(mod);
max_coderate = std::min(0.93F * Qm, max_coderate);
max_coderate = std::min(0.932F * Qm, max_coderate);
if (coderate <= max_coderate) {
// solution was found
@ -217,7 +217,7 @@ int generate_ra_bc_dci_format1a_common(srslte_dci_dl_t& dci,
// Compute effective code rate and verify it doesn't exceed max code rate
uint32_t nof_re = cell_params.get_dl_nof_res(tti_tx_dl, dci, current_cfi);
if (srslte_coderate(tbs, nof_re) >= 0.93F * Qm) {
if (srslte_coderate(tbs, nof_re) >= 0.932F * Qm) {
return -1;
}

@ -234,7 +234,7 @@ tbs_info cqi_to_tbs_dl(const sched_ue_cell& cell,
ret = compute_min_mcs_and_tbs_from_required_bytes(
nof_prb, nof_re, cell.dl_cqi, cell.max_mcs_dl, req_bytes, false, false, use_tbs_index_alt);
// If coderate > SRSLTE_MIN(max_coderate, 0.930 * Qm) we should set TBS=0. We don't because it's not correctly
// If coderate > SRSLTE_MIN(max_coderate, 0.932 * Qm) we should set TBS=0. We don't because it's not correctly
// handled by the scheduler, but we might be scheduling undecodable codewords at very low SNR
if (ret.tbs_bytes < 0) {
ret.mcs = 0;
@ -260,7 +260,7 @@ tbs_info cqi_to_tbs_ul(const sched_ue_cell& cell, uint32_t nof_prb, uint32_t nof
ret = compute_min_mcs_and_tbs_from_required_bytes(
nof_prb, nof_re, cell.ul_cqi, cell.max_mcs_ul, req_bytes, true, ulqam64_enabled, false);
// If coderate > SRSLTE_MIN(max_coderate, 0.930 * Qm) we should set TBS=0. We don't because it's not correctly
// If coderate > SRSLTE_MIN(max_coderate, 0.932 * Qm) we should set TBS=0. We don't because it's not correctly
// handled by the scheduler, but we might be scheduling undecodable codewords at very low SNR
if (ret.tbs_bytes < 0) {
ret.mcs = 0;

@ -15,8 +15,6 @@
#include "srslte/adt/accumulators.h"
#include <chrono>
const uint32_t seed = std::chrono::system_clock::now().time_since_epoch().count();
namespace srsenb {
struct run_params {
@ -197,8 +195,9 @@ int run_benchmark_scenario(run_params params, std::vector<run_data>& run_results
sched_interface::sched_args_t sched_args = {};
sched_args.sched_policy = params.sched_policy;
sched sched_obj;
sched_obj.init(nullptr, sched_args);
sched sched_obj;
rrc_dummy rrc{};
sched_obj.init(&rrc, sched_args);
sched_tester tester(&sched_obj, sched_args, cell_list);
tester.total_stats = {};
@ -248,31 +247,72 @@ run_data expected_run_result(run_params params)
{
assert(params.cqi == 15 && "only cqi=15 supported for now");
run_data ret{};
float dl_overhead = 0.9, ul_overhead = 0.75;
int tbs_idx = srslte_ra_tbs_idx_from_mcs(28, false, false);
int tbs = srslte_ra_tbs_from_idx(tbs_idx, params.nof_prbs);
ret.avg_dl_throughput = tbs * 1e3; // bps
tbs_idx = srslte_ra_tbs_idx_from_mcs(28, false, true);
uint32_t nof_pusch_prbs = params.nof_prbs - (params.nof_prbs == 6 ? 2 : 4);
tbs = srslte_ra_tbs_from_idx(tbs_idx, nof_pusch_prbs);
ret.avg_ul_throughput = tbs * 1e3; // bps
ret.avg_dl_mcs = 27;
ret.avg_ul_mcs = 22;
switch (params.nof_prbs) {
case 6:
ret.avg_dl_mcs = 25;
ret.avg_ul_mcs = 22;
dl_overhead = 0.8;
ul_overhead = 0.4;
ret.avg_dl_throughput *= 0.7;
ret.avg_ul_throughput *= 0.25;
break;
case 15:
ret.avg_dl_throughput *= 0.95;
ret.avg_ul_throughput *= 0.5;
break;
default:
ret.avg_dl_mcs = 26;
ret.avg_ul_mcs = 22;
ret.avg_dl_throughput *= 0.97;
ret.avg_ul_throughput *= 0.5;
break;
}
return ret;
}
void print_benchmark_results(const std::vector<run_data>& run_results)
{
srslog::flush();
fmt::print("run | Nprb | cqi | sched pol | Nue | DL/UL [Mbps] | DL/UL mcs | DL/UL OH [%] | latency "
"[usec]\n");
fmt::print("---------------------------------------------------------------------------------------"
"------\n");
for (uint32_t i = 0; i < run_results.size(); ++i) {
const run_data& r = run_results[i];
int tbs_idx = srslte_ra_tbs_idx_from_mcs(ret.avg_dl_mcs, false, false);
int tbs = srslte_ra_tbs_from_idx(tbs_idx, params.nof_prbs);
ret.avg_dl_throughput = tbs * 1e3 * dl_overhead; // bps
int tbs_idx = srslte_ra_tbs_idx_from_mcs(28, false, false);
int tbs = srslte_ra_tbs_from_idx(tbs_idx, r.params.nof_prbs);
float dl_rate_overhead = 1.0F - r.avg_dl_throughput / (tbs * 1e3);
tbs_idx = srslte_ra_tbs_idx_from_mcs(28, false, true);
uint32_t nof_pusch_prbs = r.params.nof_prbs - (r.params.nof_prbs == 6 ? 2 : 4);
tbs = srslte_ra_tbs_from_idx(tbs_idx, nof_pusch_prbs);
float ul_rate_overhead = 1.0F - r.avg_ul_throughput / (tbs * 1e3);
tbs_idx = srslte_ra_tbs_idx_from_mcs(ret.avg_ul_mcs, false, true);
tbs = srslte_ra_tbs_from_idx(tbs_idx, params.nof_prbs - 2);
ret.avg_ul_throughput = tbs * 1e3 * ul_overhead; // bps
return ret;
fmt::print("{:>3d}{:>6d}{:>6d}{:>12}{:>6d}{:>9.2}/{:>4.2}{:>9.1f}/{:>4.1f}{:9.1f}/{:>4.1f}{:12d}\n",
i,
r.params.nof_prbs,
r.params.cqi,
r.params.sched_policy,
r.params.nof_ues,
r.avg_dl_throughput / 1e6,
r.avg_ul_throughput / 1e6,
r.avg_dl_mcs,
r.avg_ul_mcs,
dl_rate_overhead * 100,
ul_rate_overhead * 100,
r.avg_latency.count());
}
}
int run_rate_test()
{
fmt::print("\n====== Scheduler Rate Test ======\n\n");
run_params_range run_param_list{};
srslog::basic_logger& mac_logger = srslog::fetch_basic_logger("MAC");
@ -285,13 +325,13 @@ int run_rate_test()
for (size_t r = 0; r < nof_runs; ++r) {
run_params runparams = run_param_list.get_params(r);
mac_logger.info("\n### New run {} ###\n", r);
mac_logger.info("\n=== New run {} ===\n", r);
TESTASSERT(run_benchmark_scenario(runparams, run_results) == SRSLTE_SUCCESS);
}
const std::array<float, 6> expected_dl_rate_Mbps{2.5, 8.8, 15, 31, 47, 64};
const std::array<float, 6> expected_ul_rate_Mbps{0.1, 1.8, 4, 8.3, 13, 19};
bool success = true;
print_benchmark_results(run_results);
bool success = true;
for (auto& run : run_results) {
run_data expected = expected_run_result(run.params);
if (run.avg_dl_mcs < expected.avg_dl_mcs) {
@ -322,27 +362,6 @@ int run_rate_test()
return success ? SRSLTE_SUCCESS : SRSLTE_ERROR;
}
void print_benchmark_results(const std::vector<run_data>& run_results)
{
srslog::flush();
fmt::print("run | Nprb | cqi | sched pol | Nue | DL [Mbps] | UL [Mbps] | DL mcs | UL mcs | latency [usec]\n");
fmt::print("---------------------------------------------------------------------------------------------\n");
for (uint32_t i = 0; i < run_results.size(); ++i) {
const run_data& r = run_results[i];
fmt::print("{:>3d}{:>6d}{:>6d}{:>12}{:>6d}{:12.2}{:12.2}{:9.1f}{:9.1f}{:12d}\n",
i,
r.params.nof_prbs,
r.params.cqi,
r.params.sched_policy,
r.params.nof_ues,
r.avg_dl_throughput / 1e6,
r.avg_ul_throughput / 1e6,
r.avg_dl_mcs,
r.avg_ul_mcs,
r.avg_latency.count());
}
}
int run_benchmark()
{
run_params_range run_param_list{};
@ -366,10 +385,6 @@ int run_benchmark()
int main()
{
// Setup seed
srsenb::set_randseed(seed);
printf("This is the chosen seed: %u\n", seed);
// Setup the log spy to intercept error and warning log entries.
if (!srslog::install_custom_sink(
srslte::log_sink_spy::name(),

@ -317,7 +317,7 @@ int test_dci_content_common(const sf_output_res_t& sf_out, uint32_t enb_cc_idx)
float coderate = srslte_coderate(tbs * 8, nof_re);
const uint32_t Qm = 2;
CONDERROR(
coderate > 0.930f * Qm, "Max coderate was exceeded from %s DCI", dci.rnti == SRSLTE_SIRNTI ? "SIB" : "RAR");
coderate > 0.932f * Qm, "Max coderate was exceeded from %s DCI", dci.rnti == SRSLTE_SIRNTI ? "SIB" : "RAR");
return SRSLTE_SUCCESS;
};

@ -54,7 +54,7 @@ bool lower_coderate(tbs_info tb, uint32_t nof_re, const tbs_test_args& args)
srslte_mod_t mod =
(args.is_ul) ? srslte_ra_ul_mod_from_mcs(tb.mcs) : srslte_ra_dl_mod_from_mcs(tb.mcs, args.use_tbs_index_alt);
float Qm = std::min(args.get_max_Qm(), srslte_mod_bits_x_symbol(mod));
return coderate <= 0.930f * Qm;
return coderate <= 0.932f * Qm;
}
int test_mcs_tbs_dl_helper(const sched_cell_params_t& cell_params, const tbs_test_args& args, tbs_info* result)

@ -49,9 +49,9 @@ inline srsenb::sched_interface::cell_cfg_t generate_default_cell_cfg(uint32_t no
cell_cfg.maxharq_msg3tx = 3;
cell_cfg.initial_dl_cqi = 6;
cell_cfg.target_ul_sinr = -1;
cell_cfg.nrb_cqi = 2;
cell_cfg.nrb_cqi = 1;
cell_cfg.n1pucch_an = 12;
cell_cfg.delta_pucch_shift = 2;
cell_cfg.delta_pucch_shift = 1;
cell_cfg.ncs_an = 0;
return cell_cfg;

@ -106,7 +106,7 @@ int test_pdsch_grant(const sim_enb_ctxt_t& enb_ctxt,
srslte_mod_t mod = srslte_ra_dl_mod_from_mcs(pdsch.dci.tb[0].mcs_idx, ue_ctxt.ue_cfg.use_tbs_index_alt);
uint32_t max_Qm = ue_ctxt.ue_cfg.use_tbs_index_alt ? 8 : 6;
uint32_t Qm = std::min(max_Qm, srslte_mod_bits_x_symbol(mod));
CONDERROR(coderate > 0.930f * Qm, "Max coderate was exceeded");
CONDERROR(coderate > 0.932f * Qm, "Max coderate was exceeded");
}
// TEST: PUCCH-ACK will not collide with SR

Loading…
Cancel
Save