Skip to content

feat(difftest): generate checkpoint on difftest mismatch#878

Open
good-circle wants to merge 1 commit into
masterfrom
20260517-cpt
Open

feat(difftest): generate checkpoint on difftest mismatch#878
good-circle wants to merge 1 commit into
masterfrom
20260517-cpt

Conversation

@good-circle

Copy link
Copy Markdown
Contributor

Add an --auto-checkpoint option that asks the REF to dump a checkpoint when difftest reports a mismatch.

Without --enable-fork, generate the checkpoint after the mismatch is detected. With --enable-fork, wake the fork child and generate the checkpoint from the fork snapshot instead.

Route the request through RefProxy and pass a checkpoint base path to the REF.

Add an --auto-checkpoint option that asks the REF to dump a checkpoint when difftest reports a mismatch.

Without --enable-fork, generate the checkpoint after the mismatch is detected. With --enable-fork, wake the fork child and generate the checkpoint from the fork snapshot instead.

Route the request through RefProxy and pass a checkpoint base path to the REF.

@poemonsense poemonsense left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems we don't need difftest_auto_cpt and cpt_from_fork

info->notgood = false;
info->endCycles = 0;
info->oldest = 0;
info->do_cpt = false;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no need to pass these. The child can decide it on its own.

#ifndef CONFIG_NO_DIFFTEST
extern const char *difftest_ref_so;
extern bool difftest_auto_cpt;
extern bool cpt_from_fork;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't know why we need cpt_from_fork

case 6: args.enable_fork = true; continue;
case 6: args.enable_fork = true;
#ifndef CONFIG_NO_DIFFTEST
cpt_from_fork = true;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't know why we need this.


uint8_t *ref_golden_mem = NULL;
const char *difftest_ref_so = NULL;
bool difftest_auto_cpt = false;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't know why we need this. Is it already in the args?

};

extern const char *difftest_ref_so;
extern bool difftest_auto_cpt;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this

Comment thread src/test/csrc/emu/emu.cpp
bool need_wakeup = trapCode != STATE_GOODTRAP && trapCode != STATE_LIMIT_EXCEEDED && trapCode != STATE_SIG;
if (need_wakeup) {
#ifndef CONFIG_NO_DIFFTEST
if (difftest_auto_cpt) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to set the path here

Comment thread src/test/csrc/emu/emu.cpp

// Generate checkpoint from the fork snapshot state if requested
if (lightsss->get_do_cpt()) {
const char *base_filepath = lightsss->get_cpt_filepath();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The path should be determined here, the same as waveform.

Comment thread src/test/csrc/emu/emu.cpp
if (lightsss->get_do_cpt()) {
const char *base_filepath = lightsss->get_cpt_filepath();
FORK_PRINTF("Generating checkpoint from fork snapshot: %s_memory_.gz\n", base_filepath)
for (int i = 0; i < NUM_CORES; i++) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems we don't support multicore checkpoint here. Maybe we should check NUM_CORES and avoid checkpointing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants