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

Draft
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 ~50% performance increase for longer running tests.

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

Old 1 Old 2 Old 3 Old min New 1 New 2 New 3 New min New faster
0.25 0.31 0.3 0.25 0.28 0.24 0.26 0.24 4.2%
0.65 0.69 0.74 0.65 0.51 0.48 0.5 0.48 35.4%
0.44 0.48 0.53 0.44 0.36 0.31 0.34 0.31 41.9%
1.84 1.72 1.7 1.7 1.12 1.08 1.12 1.08 57.4%
1.57 1.58 1.58 1.57 1.03 1.06 1.01 1.01 55.4%
0.43 0.4 0.4 0.4 0.33 0.33 0.32 0.32 25.0%
4.62 4.18 4.5 4.18 2.69 2.73 2.73 2.69 55.4%
0.17 0.18 0.24 0.17 0.18 0.24 0.23 0.18 -5.6%
2.26 2.57 2.43 2.26 1.35 1.45 1.42 1.35 67.4%

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

TODO

  • Include Verilog
  • Test

Eleminates the need for prepending singals with dummy elements

Fixes #1
Running three experiments with the old and the new code shows that
avoiding packing/unpacking in Haskell yields a ~50% performance
increase.

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

| Old 1 | Old 2 | Old 3 | Old min | New 1 | New 2 | New 3 | New min | New faster |
|-------|-------|-------|---------|-------|-------|-------|---------|------------|
| 0.25  | 0.31  | 0.3   | 0.25    | 0.28  | 0.24  | 0.26  | 0.24    | 4.2%       |
| 0.65  | 0.69  | 0.74  | 0.65    | 0.51  | 0.48  | 0.5   | 0.48    | 35.4%      |
| 0.44  | 0.48  | 0.53  | 0.44    | 0.36  | 0.31  | 0.34  | 0.31    | 41.9%      |
| 1.84  | 1.72  | 1.7   | 1.7     | 1.12  | 1.08  | 1.12  | 1.08    | 57.4%      |
| 1.57  | 1.58  | 1.58  | 1.57    | 1.03  | 1.06  | 1.01  | 1.01    | 55.4%      |
| 0.43  | 0.4   | 0.4   | 0.4     | 0.33  | 0.33  | 0.32  | 0.32    | 25.0%      |
| 4.62  | 4.18  | 4.5   | 4.18    | 2.69  | 2.73  | 2.73  | 2.69    | 55.4%      |
| 0.17  | 0.18  | 0.24  | 0.17    | 0.18  | 0.24  | 0.23  | 0.18    | -5.6%      |
| 2.26  | 2.57  | 2.43  | 2.26    | 1.35  | 1.45  | 1.42  | 1.35    | 67.4%      |
@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
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