Add Absorbing state to the idle view in Nanos6
This commit is contained in:
parent
6cafd347ce
commit
b16c30a5e6
@ -142,12 +142,12 @@ select_idle(struct mux *mux, struct value value, struct mux_input **input)
|
||||
{
|
||||
dbg("selecting tri output for value %s", value_str(value));
|
||||
|
||||
if (value.type == VALUE_INT64 && value.i == ST_WORKER_IDLE) {
|
||||
dbg("selecting input 1 (idle)");
|
||||
*input = mux_get_input(mux, 1);
|
||||
} else {
|
||||
if (value.type == VALUE_INT64 && value.i == ST_PROGRESSING) {
|
||||
dbg("selecting input 0 (tr)");
|
||||
*input = mux_get_input(mux, 0);
|
||||
} else {
|
||||
dbg("selecting input 1 (idle)");
|
||||
*input = mux_get_input(mux, 1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "thread.h"
|
||||
#include "value.h"
|
||||
|
||||
enum { PUSH = 1, POP = 2, IGN = 3 };
|
||||
enum { PUSH = 1, POP, SET, IGN };
|
||||
|
||||
#define CHSS CH_SUBSYSTEM
|
||||
#define CHTH CH_THREAD
|
||||
@ -40,8 +40,9 @@ static const int ss_table[256][256][3] = {
|
||||
['*'] = { CHSS, IGN, -1 },
|
||||
},
|
||||
['P'] = {
|
||||
['r'] = { CH_IDLE, PUSH, ST_WORKER_IDLE },
|
||||
['p'] = { CH_IDLE, POP, ST_WORKER_IDLE },
|
||||
['p'] = { CH_IDLE, SET, ST_PROGRESSING },
|
||||
['r'] = { CH_IDLE, SET, ST_RESTING },
|
||||
['a'] = { CH_IDLE, SET, ST_ABSORBING },
|
||||
},
|
||||
['C'] = {
|
||||
['['] = { CHSS, PUSH, ST_TASK_CREATING },
|
||||
@ -123,6 +124,8 @@ simple(struct emu *emu)
|
||||
return chan_push(ch, value_int64(st));
|
||||
} else if (action == POP) {
|
||||
return chan_pop(ch, value_int64(st));
|
||||
} else if (action == SET) {
|
||||
return chan_set(ch, value_int64(st));
|
||||
} else if (action == IGN) {
|
||||
return 0; /* do nothing */
|
||||
} else {
|
||||
|
@ -67,10 +67,11 @@ enum nanos6_thread_type {
|
||||
ST_TH_EXTERNAL = 4,
|
||||
};
|
||||
|
||||
enum nanos6_worker_idle {
|
||||
enum nanos6_progress {
|
||||
/* Can mix with subsystem values */
|
||||
ST_WORKER_IDLE = 100,
|
||||
ST_WORKER_BUSY = 101,
|
||||
ST_PROGRESSING = 100,
|
||||
ST_RESTING,
|
||||
ST_ABSORBING,
|
||||
};
|
||||
|
||||
struct nanos6_thread {
|
||||
|
@ -55,7 +55,6 @@ static const char *chan_name[CH_MAX] = {
|
||||
static const int chan_stack[CH_MAX] = {
|
||||
[CH_SUBSYSTEM] = 1,
|
||||
[CH_THREAD] = 1,
|
||||
[CH_IDLE] = 1,
|
||||
};
|
||||
|
||||
static const int chan_dup[CH_MAX] = {
|
||||
@ -127,8 +126,9 @@ static const struct pcf_value_label nanos6_thread_type[] = {
|
||||
};
|
||||
|
||||
static const struct pcf_value_label nanos6_worker_idle[] = {
|
||||
{ ST_WORKER_IDLE, "Idle" },
|
||||
{ ST_WORKER_BUSY, "Busy" },
|
||||
{ ST_PROGRESSING, "Progressing" },
|
||||
{ ST_RESTING, "Resting" },
|
||||
{ ST_ABSORBING, "Absorbing noise" },
|
||||
{ -1, NULL },
|
||||
};
|
||||
|
||||
@ -310,8 +310,8 @@ model_nanos6_connect(struct emu *emu)
|
||||
for (struct thread *th = emu->system.threads; th; th = th->gnext) {
|
||||
struct nanos6_thread *mth = EXT(th, model_id);
|
||||
struct chan *idle = &mth->m.ch[CH_IDLE];
|
||||
/* By default set all threads as Busy */
|
||||
if (chan_push(idle, value_int64(ST_WORKER_BUSY)) != 0) {
|
||||
/* By default set all threads as Progressing */
|
||||
if (chan_set(idle, value_int64(ST_PROGRESSING)) != 0) {
|
||||
err("chan_push idle failed");
|
||||
return -1;
|
||||
}
|
||||
@ -320,8 +320,8 @@ model_nanos6_connect(struct emu *emu)
|
||||
for (struct cpu *cpu = emu->system.cpus; cpu; cpu = cpu->next) {
|
||||
struct nanos6_cpu *mcpu = EXT(cpu, model_id);
|
||||
struct mux *mux = &mcpu->m.track[CH_IDLE].mux;
|
||||
/* Emit Idle when a CPU has no idle threads */
|
||||
mux_set_default(mux, value_int64(ST_WORKER_IDLE));
|
||||
/* Emit Resting when a CPU has no running threads */
|
||||
mux_set_default(mux, value_int64(ST_RESTING));
|
||||
}
|
||||
|
||||
memu->connected = 1;
|
||||
|
@ -11,5 +11,5 @@ test_emu(ss-mismatch.c SHOULD_FAIL
|
||||
test_emu(delayed-connect-ss.c)
|
||||
test_emu(switch-same-type.c)
|
||||
test_emu(sponge.c)
|
||||
|
||||
test_emu(sponge-breakdown.c BREAKDOWN)
|
||||
test_emu(breakdown-no-black.c BREAKDOWN)
|
||||
|
@ -106,6 +106,10 @@ INSTR_0ARG(instr_nanos6_alloc_exit, "6MA")
|
||||
INSTR_0ARG(instr_nanos6_free_enter, "6Mf")
|
||||
INSTR_0ARG(instr_nanos6_free_exit, "6MF")
|
||||
|
||||
INSTR_0ARG(instr_nanos6_progressing, "6Pp")
|
||||
INSTR_0ARG(instr_nanos6_resting, "6Pr")
|
||||
INSTR_0ARG(instr_nanos6_absorbing, "6Pa")
|
||||
|
||||
static inline void
|
||||
instr_nanos6_task_create_and_execute(int32_t id, uint32_t typeid)
|
||||
{
|
||||
|
57
test/emu/nanos6/sponge-breakdown.c
Normal file
57
test/emu/nanos6/sponge-breakdown.c
Normal file
@ -0,0 +1,57 @@
|
||||
/* Copyright (c) 2023 Barcelona Supercomputing Center (BSC)
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include "common.h"
|
||||
#include "emu_prv.h"
|
||||
#include "instr.h"
|
||||
#include "instr_nanos6.h"
|
||||
#include "nanos6/nanos6_priv.h"
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
instr_start(0, 1);
|
||||
|
||||
int type = PRV_NANOS6_BREAKDOWN;
|
||||
FILE *f = fopen("match.sh", "w");
|
||||
if (f == NULL)
|
||||
die("fopen failed:");
|
||||
|
||||
instr_nanos6_worker_loop_enter();
|
||||
|
||||
/* Enter sponge subsystem */
|
||||
instr_nanos6_sponge_enter();
|
||||
|
||||
/* Set state to Absorbing */
|
||||
instr_nanos6_absorbing();
|
||||
|
||||
/* Ensure the only row in breakdown is in absorbing */
|
||||
fprintf(f, "grep '1:%ld:%d:%d$' ovni/nanos6-breakdown.prv\n",
|
||||
get_delta(), type, ST_ABSORBING);
|
||||
|
||||
/* Set state to Resting */
|
||||
instr_nanos6_resting();
|
||||
|
||||
/* Ensure the only row in breakdown is in Resting */
|
||||
fprintf(f, "grep '1:%ld:%d:%d$' ovni/nanos6-breakdown.prv\n",
|
||||
get_delta(), type, ST_RESTING);
|
||||
|
||||
instr_nanos6_progressing();
|
||||
|
||||
/* Now the state must follow the subsystem, which should be
|
||||
* sponge mode */
|
||||
fprintf(f, "grep '1:%ld:%d:%d$' ovni/nanos6-breakdown.prv\n",
|
||||
get_delta(), type, ST_SPONGE);
|
||||
|
||||
fclose(f);
|
||||
|
||||
instr_nanos6_sponge_exit();
|
||||
|
||||
instr_nanos6_worker_loop_exit();
|
||||
|
||||
instr_end();
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user