Skip to content

Commit

Permalink
add contiguous subschedule spec for callstack exhaustion
Browse files Browse the repository at this point in the history
  • Loading branch information
erichulburd committed Jan 27, 2021
1 parent 9c35515 commit f7ad1f3
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/addresser-tests.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,26 @@
(quil::chip-contiguous-subschedule-from-last-instructions
sched (quil::make-qubit-resource 0 2))
expected-subschedule))))))

(deftest test-fidelity-addresser-subschedule-on-deep-circuit ()
(let* ((chip (quil::build-nq-fully-connected-chip 3))
(sched (quil::make-chip-schedule chip))
(h0 (build-gate "H" nil 0))
(circuit-depth 99999))
(loop :for i :from 1 :to circuit-depth :do
(progn
;; this gates will exercise depth in the outer dfs, ie in
;; chip-contiguous-subschedule-from-last-instructions.
(quil::chip-schedule-append sched (build-gate "H" nil 0))
;; these gates will exercise depth in the inner dfs, ie in
;; mark-predecessors-seen.
(quil::chip-schedule-append sched (build-gate "H" nil 1))))
(flet ((is-h0 (gate)
(and (string= (quil::application-operator-root-name gate)
(quil::application-operator-root-name h0))
(equalp (quil::application-parameters gate)
(quil::application-parameters h0)))))
(let ((result (quil::chip-contiguous-subschedule-from-last-instructions sched (quil::make-qubit-resource 0))))
(is (= (length result) circuit-depth))
(is (every #'is-h0 result))))))

0 comments on commit f7ad1f3

Please sign in to comment.