-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vcs: add support for --workload-list option #293
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
This function seems not related to checkpoints. For all workloads, the list should work well. If so, then we should name it like
workload-list
instead ofckpt-list
. -
Probably we need a CI for this test? The list could be, like, multiple microbench.bin lines.
Let @klin02 have a review and help the CI things
src/test/csrc/vcs/vcs_main.cpp
Outdated
} | ||
|
||
static int checkpoint_reset (char * file_name) { | ||
int line_len = strlen(file_name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please format the code like the others
src/test/csrc/vcs/vcs_main.cpp
Outdated
else | ||
return 1; | ||
|
||
if (sscanf(str1,"_%d_0.%ld_.gz", &checkpoin_idx, &max_instrs) != 2) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please format the code carefully. E.g., whitespace after ,
src/test/csrc/vcs/vcs_main.cpp
Outdated
@@ -58,6 +64,12 @@ extern "C" void set_diff_ref_so(char *s) { | |||
difftest_ref_so = buf; | |||
} | |||
|
|||
extern "C" void difftest_checkpoint_list (char * path) { | |||
checkpoint_list_path = (char *)malloc(256); | |||
strcpy(checkpoint_list_path,path); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whitespace after ","
src/test/csrc/vcs/vcs_main.cpp
Outdated
@@ -58,6 +64,12 @@ extern "C" void set_diff_ref_so(char *s) { | |||
difftest_ref_so = buf; | |||
} | |||
|
|||
extern "C" void difftest_checkpoint_list (char * path) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
avoid whitespace between function name and arguments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe u could try format tools like black.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've adopted clang-format in the master branch. Thanks
It's theoretically possible to support different workload lists, but for now I'm only supporting our new checkpoint resolution |
Also, we should create a strict C++ formatter to avoid PRs that bring in inconsistent C++ code style into the repo. @klin02 If you have time, please help find some C++ formatter that is suitable for us. I know Verilator is using the clang formatter for C++ |
What are the differences between checkpoints and other workloads? They are simply different images. |
src/test/vsrc/vcs/top.v
Outdated
@@ -197,8 +224,9 @@ reg [63:0] n_cycles; | |||
always @(posedge clock) begin | |||
if (reset) begin | |||
n_cycles <= 64'h0; | |||
xs_rst_en<= 1'b0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid namings like this (xs
). Difftest is not for XS only.
|
I see. Currently this PR is using I think we should avoid this. Probably we can use like |
58bf07c
to
8f8667f
Compare
Sure. I will try to handle it. |
.github/workflows/main.yml
Outdated
|
||
- name: Verilator Build with VCS Top (with workload list) | ||
run : | | ||
echo "TEST_HOME=/nfs/home/share/ci-workloads/workload-list-test" >> $GITHUB_ENV |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not use internal server files in CI. CI runs on GitHub servers. We need to setup a workload list in CI and then use it.
For example:
echo "./ready-to-run/microbench.bin,10000" > list.txt
echo "./ready-to-run/linux.bin,20000" >> list.txt
./build/simv +workload-list=list.txt +diff=./ready-to-run/riscv64-nemu-interpreter-so
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok,i get it
.github/workflows/main.yml
Outdated
source ./env.sh | ||
make clean | ||
make simv DIFFTEST_PERFCNT=1 VCS=verilator -j2 | ||
./build/simv +workload=./ready-to-run/microbench.bin +e=0 +diff=./ready-to-run/riscv64-nemu-interpreter-so +max-instrs=10000 +workload-list=$TEST_HOME/list.txt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think when +workload-list
is given, we don't need +workload
any more. Similarly, with workload-list
specifying the max-instrs, we do not need to set +max-instrs
again. Is it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also please add \n
to the end of file. In the Files changed
tab, GitHub shows a red mark here which means the code is missing the \n
at the end of the file.
In VSCode, it is added by adding a new blank line at the end of the file. In vim, it should work well without explicit \n
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the PR is clear. However, some details should be improved and then we can merge it.
src/test/csrc/vcs/vcs_main.cpp
Outdated
@@ -58,6 +63,12 @@ extern "C" void set_diff_ref_so(char *s) { | |||
difftest_ref_so = buf; | |||
} | |||
|
|||
extern "C" void difftest_workload_list(char * path) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use similar function name like set_workload_list() for arg passing. difftest_xxx is more like a func name in difftest.cpp.
src/test/csrc/vcs/vcs_main.cpp
Outdated
static bool has_reset = false; | ||
static char bin_file[256] = "ram.bin"; | ||
static char *flash_bin_file = NULL; | ||
static bool enable_difftest = true; | ||
static uint64_t max_instrs = 0; | ||
|
||
static int ram_path_reset(char *file_name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems no need to declare a func as static
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only this file will use this function, so can use static
I have some questions about Memory reload and Software reload.
For software:
Overall, I think the code structure will be like this:
|
It seems CI
Did you try the CI tests on local machine? You can test it with local servers using Verilator. |
src/test/vsrc/vcs/top.v
Outdated
@@ -215,7 +247,12 @@ always @(posedge clock) begin | |||
`ifdef CONFIG_DIFFTEST_DEFERRED_RESULT | |||
else if (simv_result) begin | |||
$display("DIFFTEST FAILED at cycle %d", n_cycles); | |||
$finish(); | |||
if (simv_result == STATE_LIMIT_EXCEEDED && workload_list_en == 1'b1)begin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
simv_result is only used when define CONFIG_DIFFTEST_DEFERRED_RESULT. If it is not defined, it seems ended at first workload.
.github/workflows/main.yml
Outdated
echo "./ready-to-run/linux.bin 20000" >> list.txt | ||
make simv VCS=verilator WORKLOAD_SWITCH=1 -j2 | ||
./build/simv +e=0 +diff=./ready-to-run/riscv64-nemu-interpreter-so +workload-list=./list.txt | ||
rm -rf ./ready-to-run/list.txt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to remove.
a47dfc6
to
198e602
Compare
* CI: add clang-format for github actions We add clang-format to ensure consistent Cpp code style. When some code is no need to formatter, use clang-format off/on to control it. Now our clang-format config is based on LLVM style, which can be checked by clang-format -style=LLVM --dump-config. All possible options and their meanings can be searched in https://clang.llvm.org/docs/ClangFormatStyleOptions.html After this PR, github actions will check format automatically. When the code need format, CI will fail, user need to make format manully and commit again.
46a9a3e
to
1253d95
Compare
src/test/vsrc/vcs/DeferredControl.v
Outdated
@@ -31,7 +31,10 @@ initial $ixc_ctrl("sfifo", "set_deferred_result"); | |||
`endif // PALLADIUM | |||
|
|||
always @(posedge clock) begin | |||
if (!reset && step != 0) begin | |||
if (reset) begin | |||
simv_result = 1'b0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use <= instead of =
src/test/vsrc/vcs/top.v
Outdated
// set exit instrs const | ||
if ($test$plusargs("max-instrs")) begin | ||
$value$plusargs("max-instrs=%d", max_instrs); | ||
set_max_instrs(max_instrs); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had changed this in another PR #298
src/test/csrc/vcs/vcs_main.cpp
Outdated
@@ -117,6 +117,7 @@ extern "C" uint8_t simv_init() { | |||
init_goldenmem(); | |||
init_nemuproxy(DEFAULT_EMU_RAM_SIZE); | |||
} | |||
simv_result = SIMV_RUN; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to change this? The simv_result is get from every simv_nstep. We declared it outside just becuase when some workload failed. No more simv_step should act.
9487f9a
to
d4dcf7b
Compare
When you use --workload-list to set up a list of checkpoints or workload, you run through all the workloadin the list in a single launch; Using this feature requires need add WORKLOAD_SWITCH=1 at compile time and enable DPIC functionality
The format of the list should be,Use Spaces as separators
work-path program-run-limit