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

generate auto imports for core callables #1861

Merged
merged 3 commits into from
Aug 20, 2024
Merged

generate auto imports for core callables #1861

merged 3 commits into from
Aug 20, 2024

Conversation

sezna
Copy link
Contributor

@sezna sezna commented Aug 19, 2024

Closes #1860

Currently, we have a separate code path for generating completions for core callables. This code path just hard-codes the callables to
not include any auto-generated imports. This may have been necessary at some point, but it no longer is and it is preventing us from generating
the correct auto-imports for QIR.Runtime. We now have a function that generates completions from a package and is aware of if imports are
needed or not, so I just went ahead and used that instead of special casing Core.

This PR:

  • Uses the standard completion codepath to generate completions for Core
  • Adds the ability to unit test completions with the real stdlib, not just the fake stdlib
  • Adds tests to ensure auto-imports are generated for items that are not already in scope (e.g. QIR.Runtime.*) and are not generated for items already
    in scope (e.g. Length).

@sezna sezna marked this pull request as draft August 19, 2024 22:44
@sezna sezna self-assigned this Aug 19, 2024
@sezna sezna marked this pull request as ready for review August 19, 2024 22:50
@sezna sezna requested a review from swernli as a code owner August 19, 2024 22:50
Copy link

Benchmark for 5f0ee5a

Click to view benchmark
Test Base PR %
Array append evaluation 342.3±6.26µs 337.8±2.62µs -1.31%
Array literal evaluation 169.7±6.33µs 186.5±3.03µs +9.90%
Array update evaluation 418.4±3.30µs 413.9±2.36µs -1.08%
Core + Standard library compilation 23.8±0.87ms 23.5±0.85ms -1.26%
Deutsch-Jozsa evaluation 5.0±0.05ms 5.0±0.07ms 0.00%
Large file parity evaluation 34.2±0.11ms 34.4±0.78ms +0.58%
Large input file compilation 14.6±0.47ms 14.8±0.44ms +1.37%
Large input file compilation (interpreter) 55.5±2.03ms 56.2±2.23ms +1.26%
Large nested iteration 32.9±0.15ms 32.6±0.13ms -0.91%
Perform Runtime Capabilities Analysis (RCA) on Deutsch-Jozsa sample 1574.8±58.97µs 1577.2±103.36µs +0.15%
Perform Runtime Capabilities Analysis (RCA) on large file sample 8.0±0.12ms 8.0±0.16ms 0.00%
Perform Runtime Capabilities Analysis (RCA) on teleport sample 1445.1±115.17µs 1429.9±39.11µs -1.05%
Perform Runtime Capabilities Analysis (RCA) on the core and std libraries 28.0±0.31ms 28.0±0.28ms 0.00%
Teleport evaluation 92.9±3.45µs 93.0±3.47µs +0.11%

Copy link

Benchmark for 13bae1f

Click to view benchmark
Test Base PR %
Array append evaluation 336.9±2.27µs 339.1±2.10µs +0.65%
Array literal evaluation 185.9±0.72µs 168.8±1.01µs -9.20%
Array update evaluation 414.3±2.28µs 418.2±6.65µs +0.94%
Core + Standard library compilation 23.1±0.99ms 22.7±0.75ms -1.73%
Deutsch-Jozsa evaluation 5.0±0.06ms 5.0±0.06ms 0.00%
Large file parity evaluation 34.3±0.13ms 34.5±0.94ms +0.58%
Large input file compilation 14.1±0.27ms 14.5±0.49ms +2.84%
Large input file compilation (interpreter) 56.9±1.80ms 53.5±1.42ms -5.98%
Large nested iteration 32.8±0.38ms 32.7±0.18ms -0.30%
Perform Runtime Capabilities Analysis (RCA) on Deutsch-Jozsa sample 1561.0±41.68µs 1571.8±47.70µs +0.69%
Perform Runtime Capabilities Analysis (RCA) on large file sample 7.9±0.16ms 7.9±0.12ms 0.00%
Perform Runtime Capabilities Analysis (RCA) on teleport sample 1429.2±35.30µs 1433.2±51.50µs +0.28%
Perform Runtime Capabilities Analysis (RCA) on the core and std libraries 27.9±0.33ms 27.8±0.33ms -0.36%
Teleport evaluation 94.8±3.47µs 94.9±4.38µs +0.11%

Copy link

Benchmark for fad84d1

Click to view benchmark
Test Base PR %
Array append evaluation 355.7±38.62µs 338.8±8.00µs -4.75%
Array literal evaluation 169.6±1.15µs 169.2±1.92µs -0.24%
Array update evaluation 432.2±21.72µs 416.0±2.56µs -3.75%
Core + Standard library compilation 23.8±1.29ms 24.1±1.04ms +1.26%
Deutsch-Jozsa evaluation 5.0±0.07ms 5.0±0.05ms 0.00%
Large file parity evaluation 34.5±0.22ms 34.2±0.13ms -0.87%
Large input file compilation 14.6±0.30ms 14.3±0.25ms -2.05%
Large input file compilation (interpreter) 56.8±1.94ms 55.4±1.73ms -2.46%
Large nested iteration 32.8±0.30ms 33.0±2.54ms +0.61%
Perform Runtime Capabilities Analysis (RCA) on Deutsch-Jozsa sample 1578.6±46.94µs 1600.8±131.63µs +1.41%
Perform Runtime Capabilities Analysis (RCA) on large file sample 8.0±0.11ms 8.1±0.17ms +1.25%
Perform Runtime Capabilities Analysis (RCA) on teleport sample 1442.9±60.01µs 1454.9±102.88µs +0.83%
Perform Runtime Capabilities Analysis (RCA) on the core and std libraries 28.0±0.26ms 28.2±0.49ms +0.71%
Teleport evaluation 95.2±10.05µs 93.7±3.14µs -1.58%

@sezna sezna added this pull request to the merge queue Aug 20, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to a conflict with the base branch Aug 20, 2024
@sezna sezna enabled auto-merge August 20, 2024 18:37
@sezna sezna added this pull request to the merge queue Aug 20, 2024
Copy link

Benchmark for 6c9bedb

Click to view benchmark
Test Base PR %
Array append evaluation 338.6±5.14µs 340.5±7.39µs +0.56%
Array literal evaluation 185.8±1.70µs 186.0±2.12µs +0.11%
Array update evaluation 417.3±12.95µs 416.7±3.80µs -0.14%
Core + Standard library compilation 23.8±0.76ms 24.5±1.09ms +2.94%
Deutsch-Jozsa evaluation 4.9±0.06ms 4.9±0.06ms 0.00%
Large file parity evaluation 34.9±0.21ms 35.0±0.40ms +0.29%
Large input file compilation 14.9±0.67ms 15.2±0.84ms +2.01%
Large input file compilation (interpreter) 56.6±1.99ms 57.2±2.11ms +1.06%
Large nested iteration 32.7±0.15ms 32.9±0.20ms +0.61%
Perform Runtime Capabilities Analysis (RCA) on Deutsch-Jozsa sample 1596.6±103.38µs 1595.5±89.07µs -0.07%
Perform Runtime Capabilities Analysis (RCA) on large file sample 8.2±0.17ms 8.1±0.15ms -1.22%
Perform Runtime Capabilities Analysis (RCA) on teleport sample 1459.0±128.44µs 1446.2±62.88µs -0.88%
Perform Runtime Capabilities Analysis (RCA) on the core and std libraries 28.2±0.31ms 28.5±2.04ms +1.06%
Teleport evaluation 93.0±4.33µs 92.9±3.39µs -0.11%

Merged via the queue into main with commit 1096d87 Aug 20, 2024
19 checks passed
@sezna sezna deleted the alex/1860 branch August 20, 2024 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants