diff --git a/CHANGELOG.md b/CHANGELOG.md index fdf69ff..5714d7c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed + +- Fix emulation for level 2 or lower in nOS-V with inline tasks by + allowing duplicates in the subsystem channel. + ## [1.4.0] - 2023-11-08 ### Added diff --git a/src/emu/nosv/setup.c b/src/emu/nosv/setup.c index 7f0f9a6..32c9140 100644 --- a/src/emu/nosv/setup.c +++ b/src/emu/nosv/setup.c @@ -57,6 +57,9 @@ static const int chan_dup[CH_MAX] = { [CH_APPID] = 1, [CH_TYPE] = 1, [CH_RANK] = 1, + /* Can push twice ST_TASK_BODY if we run without subsystem + * events (level 2). */ + [CH_SUBSYSTEM] = 1, }; /* ----------------- pvt ------------------ */ diff --git a/test/emu/nosv/CMakeLists.txt b/test/emu/nosv/CMakeLists.txt index 29e9b9e..54b432b 100644 --- a/test/emu/nosv/CMakeLists.txt +++ b/test/emu/nosv/CMakeLists.txt @@ -10,3 +10,4 @@ test_emu(mp-rank.c MP) test_emu(switch-same-type.c) test_emu(multiple-segment.c MP NPROC 4) test_emu(task-pause-from-submit.c) +test_emu(same-subsystem.c) diff --git a/test/emu/nosv/same-subsystem.c b/test/emu/nosv/same-subsystem.c new file mode 100644 index 0000000..21b184f --- /dev/null +++ b/test/emu/nosv/same-subsystem.c @@ -0,0 +1,30 @@ +/* Copyright (c) 2023 Barcelona Supercomputing Center (BSC) + * SPDX-License-Identifier: GPL-3.0-or-later */ + +#include +#include "compat.h" +#include "instr.h" +#include "instr_nosv.h" + +/* With the introduction of ovni.level in nOS-V, we can have the + * situation in which two VTx events are emitted without the subsystem + * events. This causes the subsystem channel to push twice the same + * value ST_TASK_BODY. */ + +int +main(void) +{ + instr_start(0, 1); + + instr_nosv_type_create(10); + instr_nosv_task_create(1, 10); + instr_nosv_task_create(2, 10); + instr_nosv_task_execute(1); + instr_nosv_task_execute(2); + instr_nosv_task_end(2); + instr_nosv_task_end(1); + + instr_end(); + + return 0; +}