Skip to content

Commit 8e6ebd8

Browse files
herlesupreethcodebot
authored andcommitted
sched: fix computation RB limits for slice candidate
1 parent e40603d commit 8e6ebd8

File tree

3 files changed

+26
-19
lines changed

3 files changed

+26
-19
lines changed

lib/scheduler/slicing/slice_scheduler.cpp

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -65,24 +65,30 @@ void slice_scheduler::slot_indication(slot_point slot_tx)
6565
slice.inst.slot_indication(slot_tx);
6666
}
6767

68-
// TODO: Update slices (store_grant()) with already allocated grant in the previous slots.
69-
7068
// Recompute the priority queues.
7169
dl_prio_queue.clear();
7270
ul_prio_queue.clear();
7371
for (const auto& slice : slices) {
74-
unsigned max_rbs = slice.inst.cfg.min_prb > 0 ? slice.inst.cfg.min_prb : slice.inst.cfg.max_prb;
72+
unsigned max_rbs = slice.inst.pdsch_rb_count <= slice.inst.cfg.min_prb and slice.inst.cfg.min_prb > 0
73+
? slice.inst.cfg.min_prb
74+
: slice.inst.cfg.max_prb;
7575
dl_prio_queue.push(slice_candidate_context{
76-
slice.inst.id, slice.get_prio(true, slot_count, false, slot_tx), {0, max_rbs}, slot_tx});
76+
slice.inst.id, slice.get_prio(true, slot_count, slot_tx), {slice.inst.pdsch_rb_count, max_rbs}, slot_tx});
7777

7878
// TODO: Revisit when PUSCH time domain resource list is also defined in UE dedicated configuration.
7979
span<const pusch_time_domain_resource_allocation> pusch_time_domain_list =
8080
cell_cfg.ul_cfg_common.init_ul_bwp.pusch_cfg_common.value().pusch_td_alloc_list;
8181
for (const unsigned pusch_td_res_idx :
8282
valid_pusch_td_list_per_slot[slot_tx.to_uint() % valid_pusch_td_list_per_slot.size()]) {
8383
slot_point pusch_slot = slot_tx + pusch_time_domain_list[pusch_td_res_idx].k2;
84-
ul_prio_queue.push(slice_candidate_context{
85-
slice.inst.id, slice.get_prio(false, slot_count, false, pusch_slot), {0, max_rbs}, pusch_slot});
84+
max_rbs = slice.inst.pusch_rb_count_per_slot[pusch_slot.to_uint()] <= slice.inst.cfg.min_prb and
85+
slice.inst.cfg.min_prb > 0
86+
? slice.inst.cfg.min_prb
87+
: slice.inst.cfg.max_prb;
88+
ul_prio_queue.push(slice_candidate_context{slice.inst.id,
89+
slice.get_prio(false, slot_count, pusch_slot),
90+
{slice.inst.pusch_rb_count_per_slot[pusch_slot.to_uint()], max_rbs},
91+
pusch_slot});
8692
}
8793
}
8894
}
@@ -222,17 +228,18 @@ slice_scheduler::get_next_candidate()
222228
if (not rb_lims.contains(rb_count)) {
223229
// The slice has been scheduled in this slot with a number of RBs that is not within the limits for this
224230
// candidate. This could happen, for instance, if the scheduler could not schedule all RBs of a candidate
225-
// bounded between {0, minRB}. In this case, the second candidate for the same slice with bounds {minRB, maxRB}
226-
// is skipped.
231+
// bounded between {RBLimsMin, RBLimsMax}. In this case, the second candidate for the same slice with bounds
232+
// {RBLimsMax, maxRB} is skipped.
227233
continue;
228234
}
229235

230236
const slice_rrm_policy_config& cfg = chosen_slice.inst.cfg;
231-
if (cfg.min_prb != cfg.max_prb and rb_lims.stop() == cfg.min_prb) {
232-
// For the special case when minRB ratio>0, the first candidate for this slice was bounded between {0, minRB}.
233-
// We re-add the slice as a candidate, this time, with RB bounds {minRB, maxRB}.
234-
priority_type prio = chosen_slice.get_prio(IsDownlink, slot_count, true, slot_tx);
235-
prio_queue.push(slice_candidate_context{chosen_slice.inst.id, prio, {cfg.min_prb, cfg.max_prb}, slot_tx});
237+
if (cfg.min_prb > 0 and cfg.min_prb != cfg.max_prb and rb_lims.stop() >= cfg.min_prb) {
238+
// For the special case when minRB ratio>0, the first candidate for this slice was bounded between {RBLimsMin,
239+
// RBLimsMax}. We re-add the slice as a candidate, this time, with RB bounds {RBLimsMax, maxRB}.
240+
priority_type prio = chosen_slice.get_prio(IsDownlink, slot_count, slot_tx);
241+
unsigned min_rbs = rb_count > 0 ? rb_count : cfg.min_prb;
242+
prio_queue.push(slice_candidate_context{chosen_slice.inst.id, prio, {min_rbs, cfg.max_prb}, slot_tx});
236243
}
237244

238245
// Save current slot count.
@@ -258,7 +265,6 @@ std::optional<ul_ran_slice_candidate> slice_scheduler::get_next_ul_candidate()
258265

259266
slice_scheduler::priority_type slice_scheduler::ran_slice_sched_context::get_prio(bool is_dl,
260267
slot_count_type current_slot_count,
261-
bool slice_resched,
262268
slot_point slot_tx) const
263269
{
264270
// Note: The positive integer representing the priority of a slice consists of a concatenation of three priority
@@ -282,8 +288,8 @@ slice_scheduler::priority_type slice_scheduler::ran_slice_sched_context::get_pri
282288
return skip_prio;
283289
}
284290

285-
// In case minRB > 0 and this is the first time the slice is proposed as a candidate, we give it a higher priority.
286-
priority_type slice_prio = inst.cfg.min_prb > 0 and not slice_resched ? high_prio : default_prio;
291+
// In case minRB > 0 and minimum RB ratio agreement is not yet reached, we give it a higher priority.
292+
priority_type slice_prio = inst.cfg.min_prb > 0 and rb_count < inst.cfg.min_prb ? high_prio : default_prio;
287293

288294
// Increase priorities of slices that have not been scheduled for a long time.
289295
unsigned last_count = is_dl ? last_dl_slot : last_ul_slot;

lib/scheduler/slicing/slice_scheduler.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,7 @@ class slice_scheduler
6666
}
6767

6868
/// Determines the slice candidate priority.
69-
priority_type
70-
get_prio(bool is_dl, slot_count_type current_slot_count, bool slice_resched, slot_point slot_tx) const;
69+
priority_type get_prio(bool is_dl, slot_count_type current_slot_count, slot_point slot_tx) const;
7170
};
7271

7372
struct slice_candidate_context {

tests/unittests/scheduler/slicing/slice_scheduler_test.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,7 @@ TEST_F(rb_ratio_slice_scheduler_test,
355355
// Original slice is selected again, now using maxRB ratio as the remaining RBs.
356356
ASSERT_EQ(next_dl_slice->id(), drb1_slice_id);
357357
ASSERT_EQ(next_dl_slice->remaining_rbs(), MAX_SLICE_RB - MIN_SLICE_RB);
358+
next_dl_slice->store_grant(MAX_SLICE_RB - MIN_SLICE_RB);
358359

359360
// No more slices to schedule.
360361
next_dl_slice = slice_sched.get_next_dl_candidate();
@@ -374,7 +375,7 @@ TEST_F(rb_ratio_slice_scheduler_test,
374375
next_dl_slice = slice_sched.get_next_dl_candidate();
375376
next_dl_slice->store_grant(MIN_SLICE_RB);
376377
next_dl_slice = slice_sched.get_next_dl_candidate();
377-
next_dl_slice = slice_sched.get_next_dl_candidate();
378+
next_dl_slice->store_grant(MAX_SLICE_RB - MIN_SLICE_RB);
378379
next_dl_slice = slice_sched.get_next_dl_candidate();
379380
ASSERT_FALSE(next_dl_slice.has_value());
380381

@@ -390,6 +391,7 @@ TEST_F(rb_ratio_slice_scheduler_test,
390391
next_dl_slice = slice_sched.get_next_dl_candidate();
391392
ASSERT_EQ(next_dl_slice->id(), drb1_slice_id);
392393
ASSERT_EQ(next_dl_slice->remaining_rbs(), MAX_SLICE_RB - MIN_SLICE_RB);
394+
next_dl_slice->store_grant(MAX_SLICE_RB - MIN_SLICE_RB);
393395
next_dl_slice = slice_sched.get_next_dl_candidate();
394396
ASSERT_FALSE(next_dl_slice.has_value());
395397
}

0 commit comments

Comments
 (0)