Skip to content

Commit

Permalink
Perform packing/unpacking of arguments and results in HDL
Browse files Browse the repository at this point in the history
Running three experiments with the old and the new code shows that
avoiding packing/unpacking in Haskell yields a ~20-30% performance
increase for longer running tests. Table below shows the minimum
value for all runs.

| Test                       | main (min) | branch (min) | faster  | faster (>1s) |
|----------------------------|------------|--------------|---------|--------------|
| dyn_dispatch (debug)       | 0.34       | 0.31         | 8.82%   |              |
| ebreak_exception (debug)   | 1.42       | 1.08         | 23.94%  | 23.94%       |
| fpu_test (debug)           | 3.42       | 2.4          | 29.82%  | 29.82%       |
| hello_world (debug)        | 0.47       | 0.38         | 19.15%  |              |
| long_string (debug)        | 4.97       | 3.37         | 32.19%  | 32.19%       |
| loop_write (debug)         | 9.7        | 6.64         | 31.55%  | 31.55%       |
| many_calls (debug)         | 0.93       | 0.74         | 20.43%  | 20.43%       |
| print_a (debug)            | 0.31       | 0.31         | 0.00%   |              |
| print_b (debug)            | 0.39       | 0.32         | 17.95%  |              |
| print_numbers (debug)      | 3.8        | 2.71         | 28.68%  | 28.68%       |
| single_write (debug)       | 0.82       | 0.6          | 26.83%  |              |
| dyn_dispatch (release)     | 0.2        | 0.24         | -20.00% |              |
| ebreak_exception (release) | 0.27       | 0.2          | 25.93%  |              |
| fpu_test (release)         | 0.71       | 0.5          | 29.58%  |              |
| hello_world (release)      | 0.2        | 0.19         | 5.00%   |              |
| long_string (release)      | 0.35       | 0.25         | 28.57%  |              |
| loop_write (release)       | 0.95       | 0.8          | 15.79%  |              |
| many_calls (release)       | 0.27       | 0.28         | -3.70%  |              |
| print_a (release)          | 0.19       | 0.23         | -21.05% |              |
| print_b (release)          | 0.16       | 0.17         | -6.25%  |              |
| print_numbers (release)    | 0.49       | 0.43         | 12.24%  |              |
| single_write (release)     | 0.3        | 0.23         | 23.33%  |              |
| JTAG                       | 33.33      | 25.89        | 22.32%  | 22.32%       |
| JTAG chain                 | 126.67     | 89.85        | 29.07%  | 29.07%       |
|                            |            |              | 15.84%  | 27.25%       |

Figures are taken by observing clash-vexriscv-sim:unittests's times.
  • Loading branch information
martijnbastiaan committed Feb 15, 2025
1 parent 6dccf40 commit 3a7f094
Show file tree
Hide file tree
Showing 3 changed files with 339 additions and 454 deletions.
6 changes: 6 additions & 0 deletions clash-vexriscv/clash-vexriscv.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ library
default-language: Haskell2010
exposed-modules:
VexRiscv
VexRiscv.BlackBox
VexRiscv.ClockTicks
VexRiscv.FFI
VexRiscv.JtagTcpBridge
Expand All @@ -119,18 +120,23 @@ library
build-depends:
base,
bytestring >= 0.10 && < 0.13,
clash-lib,
clash-prelude >= 1.9.0,
clash-protocols,
containers,
directory >= 1.3 && < 1.4,
filepath,
Glob,
infinite-list,
mtl,
network,
pretty-show,
process >= 1.6 && < 1.8,
random,
string-interpolate,
tagged,
template-haskell,
text,
extra-libraries: VexRiscvFFI, stdc++
include-dirs: src/

Expand Down
Loading

0 comments on commit 3a7f094

Please sign in to comment.