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

Refactor evaluator to reduce stack use #294

Merged
merged 6 commits into from
May 17, 2023
Merged

Refactor evaluator to reduce stack use #294

merged 6 commits into from
May 17, 2023

Conversation

swernli
Copy link
Collaborator

@swernli swernli commented May 11, 2023

This change refactors the evaluator to use a "stackless" design where the stack is tracked manually via data structures instead of via literal progam stack. This allows for better avoidance of stack overflow at the cost of some performance. To help track performance characteristics, this also introduces benchmarks based on evaluating some programs from the samples folder.

@swernli
Copy link
Collaborator Author

swernli commented May 11, 2023

Keeping in draft while I try to work through some further refactoring.

@swernli swernli marked this pull request as ready for review May 12, 2023 07:57
@swernli swernli force-pushed the swernli/stackless branch 2 times, most recently from e5ee176 to db8002b Compare May 12, 2023 21:42
compiler/qsc_eval/src/val.rs Outdated Show resolved Hide resolved
compiler/qsc_hir/src/hir.rs Outdated Show resolved Hide resolved
compiler/qsc_hir/src/hir.rs Outdated Show resolved Hide resolved
compiler/qsc_passes/src/lib.rs Outdated Show resolved Hide resolved
compiler/qsc_passes/src/lib.rs Show resolved Hide resolved
compiler/qsc_passes/src/replace_qubit_allocation.rs Outdated Show resolved Hide resolved
compiler/qsc_passes/src/replace_qubit_allocation.rs Outdated Show resolved Hide resolved
compiler/qsc_eval/src/lib.rs Outdated Show resolved Hide resolved
compiler/qsc_eval/src/lib.rs Outdated Show resolved Hide resolved
compiler/qsc_eval/src/lib.rs Outdated Show resolved Hide resolved
compiler/qsc_eval/src/lib.rs Outdated Show resolved Hide resolved
compiler/qsc_eval/src/lib.rs Outdated Show resolved Hide resolved
compiler/qsc_eval/src/lib.rs Outdated Show resolved Hide resolved
compiler/qsc_eval/src/lib.rs Outdated Show resolved Hide resolved
compiler/qsc_eval/src/lib.rs Outdated Show resolved Hide resolved
compiler/qsc_eval/src/lib.rs Outdated Show resolved Hide resolved
compiler/qsc_eval/src/lib.rs Show resolved Hide resolved
Copy link
Collaborator Author

@swernli swernli left a comment

Choose a reason for hiding this comment

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

I'm going to work on the rebase on main now, so expect some squashes and force pushes.

This change adds some benchmarking of the evaluator using the checked in Teleportation and Deutsch-Jozsa samples.
compiler/qsc_eval/src/lib.rs Outdated Show resolved Hide resolved
@swernli swernli merged commit 3086821 into main May 17, 2023
@swernli swernli deleted the swernli/stackless branch May 17, 2023 19:11
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.

3 participants