Conversation
|
Hi, I encountered the same issue so I agree with the bug. // calculate offsets for group distribution
uint32_t remaining_offset = 0;
if (core_id >= remaining_groups_per_core)
// The remaining groups per core have been distributed (1 by 1) on the
// previous cores (whose core_id are < remaining_groups_per_core), so we
// now need to offset by the total remaining groups
remaining_offset = remaining_groups_per_core;
uint32_t group_offset = core_id * total_groups_per_core + remaining_offset;If I'm not mistaken, this is equivalent to your code. For the if case in your code, this is easy to show as |
Hello. I have encountered a bug in vx_spawn. When the number of groups (or tasks) does not divide evenly across active
cores, the old formula produced wrong offsets for cores with
core_id < remaining, causing some work items to be skipped and othersto be processed twice.
Cause of bug
Before computing the offset,
total_groups_per_coreis incremented forcores that receive an extra group:
The old formula then used this already-mutated variable:
This double-counts the remainder for affected cores. The same bug was
present in the task distribution path (
all_tasks_offset).Example
10 groups, 4 cores →
base = 2,remaining = 2This pull request fixes this bug.