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

[WIP] Add HLS plugin benchmarks #12329

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft

Conversation

ElePT
Copy link
Contributor

@ElePT ElePT commented May 2, 2024

Summary

This is a first attempt at adding a file to test potential performance improvements in HLS plugins.

Details and comments

@coveralls
Copy link

coveralls commented May 2, 2024

Pull Request Test Coverage Report for Build 8982169336

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 56 unchanged lines in 5 files lost coverage.
  • Overall coverage increased (+0.02%) to 89.642%

Files with Coverage Reduction New Missed Lines %
qiskit/transpiler/passes/synthesis/unitary_synthesis.py 2 88.2%
crates/qasm2/src/lex.rs 4 92.37%
qiskit/converters/init.py 7 72.0%
crates/accelerate/src/sparse_pauli_op.rs 18 93.27%
crates/qasm3/src/circuit.rs 25 78.06%
Totals Coverage Status
Change from base Build 8966541600: 0.02%
Covered Lines: 62250
Relevant Lines: 69443

💛 - Coveralls

Comment on lines 150 to 151
hls_config = HLSConfig(clifford=["ag"])
pm = PassManager([HighLevelSynthesis(hls_config=hls_config)])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would probably move this to setUp() to avoid this skewing the measurements. The entire contents of this function is what ends up being measured.

hls_config = HLSConfig(clifford=["ag"])
pm = PassManager([HighLevelSynthesis(hls_config=hls_config)])

for _ in range(self.num_samples):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to do this explicitly the asv harness handles taking multiple samples to get the statistical sampling. We probably want to move the random clifford construction to setup too though to avoid randomization impacting the measurements.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we nonetheless consider multiple different random linear functions, random cliffords, etc. to avoid overtuning synthesis algorithms on specific circuits?

@ElePT
Copy link
Contributor Author

ElePT commented May 6, 2024

Thanks for the suggestions. I have moved the circuit and pm construction to the setup and fixed the random seeds, and applied a few offline suggestions from @alexanderivrii. So far the benchmarks run but I wonder if the circuit I am currently building makes sense for the bm_wide_circuit test, because the run seems to be too fast (range of ms instead of s), so it's probably not doing any synthesis? The difference between ag/bm and default/greedy is also quite stark in the wide_circuit tests (maybe the first two are also not synthesizing). I will add tests that monitor depth/gate count to try to get more information:

[55.00%] ··· transpiler_hls_plugins.HLSPluginsSuite.time_clifford_ag_rand_benchmarking           3.34±0.08s                                                                                                       
[60.00%] ··· transpiler_hls_plugins.HLSPluginsSuite.time_clifford_ag_wide_circuit                1.24±0.08s                                                                                             
[65.00%] ··· transpiler_hls_plugins.HLSPluginsSuite.time_clifford_bm_rand_benchmarking           9.98±0.09s                                                                                                       
[70.00%] ··· transpiler_hls_plugins.HLSPluginsSuite.time_clifford_bm_wide_circuit                2.02±0.07ms                                                                                                   
[75.00%] ··· transpiler_hls_plugins.HLSPluginsSuite.time_clifford_default_rand_benchmarking      9.47±0.2s                                                                                         
[80.00%] ··· transpiler_hls_plugins.HLSPluginsSuite.time_clifford_default_wide_circuit           26.1±0.9s                                                                                                     
[85.00%] ··· transpiler_hls_plugins.HLSPluginsSuite.time_clifford_greedy_rand_benchmarking       9.22±0.2s                                                                                                   
[90.00%] ··· transpiler_hls_plugins.HLSPluginsSuite.time_clifford_greedy_wide_circuit            25.8±0.5s                                                                                               
[95.00%] ··· transpiler_hls_plugins.HLSPluginsSuite.time_linear_func_kms                         1.86±0.1s                                                                                                   
[100.00%] ··· transpiler_hls_plugins.HLSPluginsSuite.time_linear_func_pmh                        1.14±0.06s                                                                                                           

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.

None yet

4 participants