diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2d0a72f56..ec9bfc4ad 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,6 +28,43 @@ jobs: run: | bash ./scripts/compilation-test.sh + test-with-libcheckpoint: + runs-on: nemu + continue-on-error: false + timeout-minutes: 10 + name: Build NEMU interpreter with LibCheckpoint + steps: + - uses: actions/checkout@v4 + - name: checkout am + uses: actions/checkout@v4 + with: + repository: OpenXiangShan/nexus-am + path: nexus-am + ref: memory-test-v3 + - name: Setup env + run: | + echo "NEMU_HOME=$GITHUB_WORKSPACE" >> $GITHUB_ENV + echo "AM_HOME=$GITHUB_WORKSPACE/nexus-am" >> $GITHUB_ENV + - name: Build NEMU interpreter with LibCheckpoint + run: | + make riscv64-xs-cpt-with-libcheckpoint_defconfig + make -j + - name: Build AM for test baremetal workload checkpoint + run: | + cd $AM_HOME + cp $NEMU_HOME/scripts/am_patch_for_checkpoint.patch ./ + git apply am_patch_for_checkpoint.patch + make -C apps/mem_test/mem_test_latency ARCH=riscv64-xs INST=20 + - name: Build LibCheckpoint and link AM workload + run: | + cd $NEMU_HOME/resource/LibCheckpoint + make clean + ./configure --gcpt-payload=$AM_HOME/apps/mem_test/mem_test_latency/build/build-mem_test_latency-20-riscv64-xs.bin --mode=bare_metal + make + - name: System - mem_test_latency + run: | + ./build/riscv64-nemu-interpreter -b resource/LibCheckpoint/build/gcpt.bin + basic-xiangshan: runs-on: nemu continue-on-error: false diff --git a/scripts/am_patch_for_checkpoint.patch b/scripts/am_patch_for_checkpoint.patch new file mode 100644 index 000000000..287cd92aa --- /dev/null +++ b/scripts/am_patch_for_checkpoint.patch @@ -0,0 +1,46 @@ +diff --git a/am/src/nemu/isa/riscv/boot/loader64.ld b/am/src/nemu/isa/riscv/boot/loader64.ld +index 05cf7af7..020181e8 100644 +--- a/am/src/nemu/isa/riscv/boot/loader64.ld ++++ b/am/src/nemu/isa/riscv/boot/loader64.ld +@@ -1,7 +1,7 @@ +-pmem_base = 0x80000000; ++pmem_base = 0x80100000; + + MEMORY { +- ram (rwxa) : ORIGIN = 0x80000000, LENGTH = 1024M ++ ram (rwxa) : ORIGIN = 0x80100000, LENGTH = 1024M + } + + INCLUDE "section.ld" +diff --git a/apps/mem_test/mem_test_latency/mem_test_latency.c b/apps/mem_test/mem_test_latency/mem_test_latency.c +index a3e8ea0e..d118bfd1 100644 +--- a/apps/mem_test/mem_test_latency/mem_test_latency.c ++++ b/apps/mem_test/mem_test_latency/mem_test_latency.c +@@ -4,6 +4,17 @@ + #define xstr(s) str(s) + #define str(s) #s + ++#define DISABLE_TIME_INTR 0x100 ++#define NOTIFY_PROFILER 0x101 ++ ++void nemu_signal(int a){ ++ asm volatile ("mv a0, %0\n\t" ++ ".insn r 0x6B, 0, 0, x0, x0, x0\n\t" ++ : ++ : "r"(a) ++ : "a0"); ++} ++ + void flush_cache_efficient(unsigned size_in_kb, uint64_t start_addr) { + unsigned bytes = 1024 * size_in_kb; + uint64_t blackhole = 0; +@@ -29,6 +40,9 @@ int main() { + "Then flushing cache of %i KB starting from %#lx\n", + block_count, start_addr, flush_start, 0xdeadbeaf, footprint_kb, flush_start); + pseudo_random_warmup(start_addr, 0xdeadbeaf /*non-zero*/, block_count, 0x40000000); ++ ++ nemu_signal(DISABLE_TIME_INTR); ++ nemu_signal(NOTIFY_PROFILER); + //flush cache + flush_cache_efficient(footprint_kb, flush_start); + //cache latency test