microbench: add huge input

This commit is contained in:
Zihao Yu 2021-01-28 00:00:35 +08:00
parent f4f447c422
commit 54f5c1f8fa
4 changed files with 59 additions and 41 deletions

View file

@ -25,6 +25,13 @@ static int PUZZLE_L[N*N] = {
1, 15, 13, 14,
};
static int PUZZLE_H[N*N] = {
2, 6, 8, 0,
9, 15, 4, 12,
5, 13, 11,14,
1, 7, 3, 10,
};
static int ans;
extern "C" {
@ -40,6 +47,7 @@ void bench_15pz_run() {
case 0: puzzle = N_puzzle<N>(PUZZLE_S); MAXN = 10; break;
case 1: puzzle = N_puzzle<N>(PUZZLE_M); MAXN = 2048; break;
case 2: puzzle = N_puzzle<N>(PUZZLE_L); MAXN = 16384; break;
case 3: puzzle = N_puzzle<N>(PUZZLE_H); MAXN = 786432; break;
default: assert(0);
}
assert(puzzle.solvable());

View file

@ -12,13 +12,13 @@ static uint64_t uptime() { return io_read(AM_TIMER_UPTIME).us; }
// The benchmark list
#define ENTRY(_name, _sname, _s, _m, _l, _desc) \
#define ENTRY(_name, _sname, _s, _m, _l, _h, _desc) \
{ .prepare = bench_##_name##_prepare, \
.run = bench_##_name##_run, \
.validate = bench_##_name##_validate, \
.name = _sname, \
.desc = _desc, \
.settings = {_s, _m, _l}, },
.settings = {_s, _m, _l, _h}, },
Benchmark benchmarks[] = {
BENCHMARK_LIST(ENTRY)
@ -70,9 +70,10 @@ int main(const char *args) {
if (strcmp(setting_name, "test" ) == 0) setting_id = 0;
else if (strcmp(setting_name, "train") == 0) setting_id = 1;
else if (strcmp(setting_name, "ref" ) == 0) setting_id = 2;
else if (strcmp(setting_name, "huge" ) == 0) setting_id = 3;
else {
printf("Invalid mainargs: \"%s\"; "
"must be in {test, train, ref}\n", setting_name);
"must be in {test, train, ref, huge}\n", setting_name);
halt(1);
}
@ -127,7 +128,7 @@ int main(const char *args) {
printf("==================================================\n");
printf("MicroBench %s", pass ? "PASS" : "FAIL");
if (setting_id == 2) {
if (setting_id >= 2) {
printf(" %d Marks\n", (unsigned int)bench_score);
printf(" vs. %d Marks (%s)\n", REF_SCORE, REF_CPU);
} else {