Skip to content

Instantly share code, notes, and snippets.

@fwsGonzo
Last active July 23, 2024 14:06
Show Gist options
  • Save fwsGonzo/7ef100ba4fe7116e97ddb20cf26e6879 to your computer and use it in GitHub Desktop.
Save fwsGonzo/7ef100ba4fe7116e97ddb20cf26e6879 to your computer and use it in GitHub Desktop.
CoreMark: libriscv w/binary translation, Ryzen 7950X
$ VERBOSE=1 ./rvlinux -v ~/github/coremark/coremark-rv32g_b
libriscv: Registered embedded translation for hash 9C111F55, 13/1835 mappings
* Loading program of size 75145 from 0x7cc1b18ef010 to virtual 0x10000 -> 0x22589
* Program segment readable: 1 writable: 0 executable: 1
* Loading program of size 1864 from 0x7cc1b190159c to virtual 0x2358c -> 0x23cd4
* Program segment readable: 1 writable: 1 executable: 0
libriscv: Found embedded translation for hash 9C111F55, 13/1835 mappings
* Entry is at 0x109f4
2K performance run parameters for coremark.
CoreMark Size : 666
Total ticks : 15697
Total time (secs): 15.697000
Iterations/Sec : 38223.864433
Iterations : 600000
Compiler version : GCC13.2.0
Compiler flags : -O3 -DPERFORMANCE_RUN=1
Memory location : Please put data memory location here
(e.g. code in flash, data on heap etc)
seedcrc : 0xe9f5
[0]crclist : 0xe714
[0]crcmatrix : 0x1fd7
[0]crcstate : 0x8e3a
[0]crcfinal : 0xa14c
Correct operation validated. See README.md for run and reporting rules.
CoreMark 1.0 : 38223.864433 / GCC13.2.0 -O3 -DPERFORMANCE_RUN=1 / Static
>>> Program exited, exit code = 0 (0x0)
Runtime: 18644.764ms (Use --accurate for instruction counting)
Pages in use: 25 (100 kB virtual memory, total 175 kB)
@fwsGonzo
Copy link
Author

fwsGonzo commented Nov 13, 2023

Without binary translation:

$ ./rvlinux ~/github/coremark/coremark-15-rv32gb 
2K performance run parameters for coremark.
CoreMark Size    : 666
Total ticks      : 16860
Total time (secs): 16.860000
Iterations/Sec   : 3558.718861
Iterations       : 60000
Compiler version : GCC15.0.0 20240429 (experimental)
Compiler flags   : -O3 -DPERFORMANCE_RUN=1  
Memory location  : Please put data memory location here
			(e.g. code in flash, data on heap etc)
seedcrc          : 0xe9f5
[0]crclist       : 0xe714
[0]crcmatrix     : 0x1fd7
[0]crcstate      : 0x8e3a
[0]crcfinal      : 0xbd59
Correct operation validated. See README.md for run and reporting rules.
CoreMark 1.0 : 3558.718861 / GCC15.0.0 20240429 (experimental) -O3 -DPERFORMANCE_RUN=1   / Static
>>> Program exited, exit code = 0 (0x0)
Instructions executed: 20514801086  Runtime: 20073.410ms  Insn/s: 1022mi/s
Pages in use: 26 (104 kB virtual memory, total 335 kB)

@fwsGonzo
Copy link
Author

fwsGonzo commented Jun 13, 2024

With TCC as JIT-like translator (~40% of native CoreMark):

$ ./rvlinux -vP ~/github/coremark/coremark-rv32g_b 
* Loading program of size 75145 from 0x740e00d13000 to virtual 0x10000 -> 0x22589
* Program segment readable: 1 writable: 0  executable: 1
* Loading program of size 1864 from 0x740e00d2558c to virtual 0x2358c -> 0x23cd4
* Program segment readable: 1 writable: 1  executable: 0
libriscv: No embedded translation found for hash 0602B8AD
libriscv: Emitted 17963 accelerated instructions, 1 blocks and 1912 functions. GP=0x23FF8
libriscv: Activated libtcc binary translation with 1/1912 mappings
* Entry is at 0x109f4
2K performance run parameters for coremark.
CoreMark Size    : 666
Total ticks      : 17953
Total time (secs): 17.953000
Iterations/Sec   : 16710.299114
Iterations       : 300000
Compiler version : GCC13.2.0
Compiler flags   : -O3 -DPERFORMANCE_RUN=1  
Memory location  : Please put data memory location here
			(e.g. code in flash, data on heap etc)
seedcrc          : 0xe9f5
[0]crclist       : 0xe714
[0]crcmatrix     : 0x1fd7
[0]crcstate      : 0x8e3a
[0]crcfinal      : 0xcc42
Correct operation validated. See README.md for run and reporting rules.
CoreMark 1.0 : 16710.299114 / GCC13.2.0 -O3 -DPERFORMANCE_RUN=1   / Static
>>> Program exited, exit code = 0 (0x0)
Runtime: 24604.955ms   (Use --accurate for instruction counting)
Pages in use: 25 (100 kB virtual memory, total 175 kB)

@fwsGonzo
Copy link
Author

Fully sandboxed with instruction counting as execution timeout (83% of native):

$ ./rvlinux -av ~/github/coremark/coremark-rv32g_b 
* Loading program of size 75145 from 0x7c725d1d6010 to virtual 0x10000 -> 0x22589
* Program segment readable: 1 writable: 0  executable: 1
* Loading program of size 1864 from 0x7c725d1e859c to virtual 0x2358c -> 0x23cd4
* Program segment readable: 1 writable: 1  executable: 0
libriscv: Found embedded translation for hash 92256FC6, 13/1835 mappings
* Entry is at 0x109f4
2K performance run parameters for coremark.
CoreMark Size    : 666
Total ticks      : 17405
Total time (secs): 17.405000
Iterations/Sec   : 34472.852629
Iterations       : 600000
Compiler version : GCC13.2.0
Compiler flags   : -O3 -DPERFORMANCE_RUN=1  
Memory location  : Please put data memory location here
			(e.g. code in flash, data on heap etc)
seedcrc          : 0xe9f5
[0]crclist       : 0xe714
[0]crcmatrix     : 0x1fd7
[0]crcstate      : 0x8e3a
[0]crcfinal      : 0xa14c
Correct operation validated. See README.md for run and reporting rules.
CoreMark 1.0 : 34472.852629 / GCC13.2.0 -O3 -DPERFORMANCE_RUN=1   / Static
>>> Program exited, exit code = 0 (0x0)
Instructions executed: 206453338176  Runtime: 20626.098ms  Insn/s: 10009mi/s
Pages in use: 25 (100 kB virtual memory, total 175 kB)

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