Skip to content
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

Perform packing/unpacking of arguments and results in HDL #18

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

martijnbastiaan
Copy link
Member

@martijnbastiaan martijnbastiaan commented Mar 5, 2024

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.

Figures are taken by observing clash-vexriscv-sim:unittests's debug times.

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%

I'm overrunning my timebox though, so I'm putting this as "Draft".

TODO

  • Include Verilog
  • Test synthesis / with hardware in the loop on bittide-hardware

@martijnbastiaan martijnbastiaan force-pushed the remove-simulation-hack branch from f51c511 to f797bbf Compare March 5, 2024 08:12
@martijnbastiaan martijnbastiaan force-pushed the remove-simulation-hack branch from f797bbf to 9e480e0 Compare March 5, 2024 08:28
@martijnbastiaan martijnbastiaan force-pushed the remove-simulation-hack branch 2 times, most recently from 4236d7f to 14620c8 Compare March 5, 2024 14:22
Base automatically changed from remove-simulation-hack to main March 5, 2024 14:54
@martijnbastiaan martijnbastiaan force-pushed the use-bbf branch 2 times, most recently from 3a7f094 to 6e1f735 Compare February 15, 2025 14:22
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.
@martijnbastiaan martijnbastiaan marked this pull request as ready for review February 15, 2025 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant