Add preliminar support for taskfor

The emulator cannot handle tasks that are executed multiple times and
concurrently. The task for executes a single task (with unique id) multiple
times by using different arguments. The task model needs to be extended to
support the taskfor clause properly. In the meanwhile, we simple set the
subsystem to be running a taskfor.
This commit is contained in:
Rodrigo Arias 2022-09-21 13:18:06 +02:00
parent cd2e949613
commit baff1c050b
4 changed files with 18 additions and 1 deletions

View File

@ -117,6 +117,9 @@ The complete list of subsystems and sections is shown below.
- **Running body**: Executing the body of the task (user defined code). - **Running body**: Executing the body of the task (user defined code).
- **Running task for**: Running the body of the task in a task for (one of
the collaborators).
- **Spawning function**: Spawning a function as task that will be submitted - **Spawning function**: Spawning a function as task that will be submitted
for later execution. for later execution.
@ -189,3 +192,14 @@ The complete list of subsystems and sections is shown below.
body" subsystem only when the task has not called any other instrumented body" subsystem only when the task has not called any other instrumented
subsystem in Nanos6. Tasks will continue to be in the running state until subsystem in Nanos6. Tasks will continue to be in the running state until
paused or finished. paused or finished.
## Limitations
The task for clause is partially supported, as currently the emulator uses a
simplified tasking model where a task can only be executed by one thread, and
only once. However, the Nanos6 runtime can run the body of a single task
multiple times by varying the arguments with the task for clause, which breaks
the emulation model.
The task for is currently only shown in the subsystem view, but it doesn't
appear as running any task in the the other views.

3
emu.h
View File

@ -107,6 +107,7 @@ enum nanos6_ss_state {
ST_NANOS6_TASK_CREATING, ST_NANOS6_TASK_CREATING,
ST_NANOS6_TASK_SUBMIT, ST_NANOS6_TASK_SUBMIT,
ST_NANOS6_TASK_SPAWNING, ST_NANOS6_TASK_SPAWNING,
ST_NANOS6_TASK_FOR,
ST_NANOS6_SCHED_ADDING, ST_NANOS6_SCHED_ADDING,
ST_NANOS6_SCHED_PROCESSING, ST_NANOS6_SCHED_PROCESSING,
ST_NANOS6_SCHED_SERVING, ST_NANOS6_SCHED_SERVING,
@ -184,7 +185,7 @@ struct task_stack {
struct ovni_ethread *thread; struct ovni_ethread *thread;
}; };
#define MAX_CHAN_STACK 128 #define MAX_CHAN_STACK 512
enum chan_track { enum chan_track {
/* The channel is manually controlled. */ /* The channel is manually controlled. */

View File

@ -551,6 +551,7 @@ hook_pre_nanos6(struct ovni_emu *emu)
case 'S': pre_sched(emu); break; case 'S': pre_sched(emu); break;
case 'U': pre_ss(emu, ST_NANOS6_TASK_SUBMIT); break; case 'U': pre_ss(emu, ST_NANOS6_TASK_SUBMIT); break;
case 'F': pre_ss(emu, ST_NANOS6_TASK_SPAWNING); break; case 'F': pre_ss(emu, ST_NANOS6_TASK_SPAWNING); break;
case 'O': pre_ss(emu, ST_NANOS6_TASK_FOR); break;
case 'H': pre_thread(emu); break; case 'H': pre_thread(emu); break;
case 'D': pre_deps(emu); break; case 'D': pre_deps(emu); break;
case 'B': pre_blocking(emu); break; case 'B': pre_blocking(emu); break;

1
pcf.c
View File

@ -179,6 +179,7 @@ struct pcf_value_label nanos6_ss_values[] = {
{ ST_NANOS6_TASK_CREATING, "Task: Creating" }, { ST_NANOS6_TASK_CREATING, "Task: Creating" },
{ ST_NANOS6_TASK_SUBMIT, "Task: Submitting" }, { ST_NANOS6_TASK_SUBMIT, "Task: Submitting" },
{ ST_NANOS6_TASK_SPAWNING, "Task: Spawning function" }, { ST_NANOS6_TASK_SPAWNING, "Task: Spawning function" },
{ ST_NANOS6_TASK_FOR, "Task: Running task for" },
{ ST_NANOS6_SCHED_SERVING, "Scheduler: Serving tasks" }, { ST_NANOS6_SCHED_SERVING, "Scheduler: Serving tasks" },
{ ST_NANOS6_SCHED_ADDING, "Scheduler: Adding ready tasks" }, { ST_NANOS6_SCHED_ADDING, "Scheduler: Adding ready tasks" },
{ ST_NANOS6_SCHED_PROCESSING, "Scheduler: Processing ready tasks" }, { ST_NANOS6_SCHED_PROCESSING, "Scheduler: Processing ready tasks" },