-
Notifications
You must be signed in to change notification settings - Fork 73
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
Style warning cleanup #826
Open
gefjon
wants to merge
13
commits into
quil-lang:master
Choose a base branch
from
gefjon:style-warning-cleanup
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
e582caa
delete unused and warning-ey `*cost-fn-weight-style-assn*` from rewir…
350fa09
print source file and conflicts when warning of ambiguous definition
5f7eeff
load `magicl-constructors` after `ast`
c34696a
remove unused `:collect :into` clause
bb11045
reorder definitions in chip-specification.lisp so sbcl can inline acc…
5d091fa
reorder definitions and `inline` declarations so SBCL can inline
12c5e66
quiet warnings about circular dependency between chip-specification a…
166c6e4
remove unused keyword argument in defualt `do-greedy-addressing` method
0610412
reorder struct definitions to allow inlining
fc7db93
`locally notinline` declarations to prevent SBCL warnings
9dd61f2
quiet more forward-referenced struct accessor warnings
ce7bf14
rename duplicate gate definitions in a benchmark
d825e7c
Improve optimization for the containers declared in types.lisp
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,50 +39,6 @@ LOOKUP-CACHE is a hash table mapping lists of qubit indices to hardware objects. | |
(print-unreadable-object (cs stream :type t :identity nil) | ||
(format stream "of ~{~D~^:~} objects" (map 'list #'length (chip-specification-objects cs))))) | ||
|
||
(defun debug-print-link (stream link &optional colon-p at-sign-p) | ||
"Print out the two qubits constituting a link." | ||
(declare (ignore colon-p at-sign-p)) | ||
(let* ((cxns (hardware-object-cxns link)) | ||
(qubit0 (vnth 0 (vnth 0 cxns))) | ||
(qubit1 (vnth 1 (vnth 0 cxns)))) | ||
(format stream "~a -- ~a" qubit0 qubit1))) | ||
|
||
(defun debug-print-chip-spec (cs &optional (stream *standard-output*)) | ||
"Print out a simple, human-readable representation of a chip specification consisting of the number of qubits, the number of links, and a list of the links." | ||
(format stream "~a qubits, ~a links~%links:~%~{~/cl-quil::debug-print-link/~%~}~%" | ||
(chip-spec-n-qubits cs) | ||
(chip-spec-n-links cs) | ||
(coerce (chip-spec-links cs) 'list))) | ||
|
||
(defstruct permutation-record | ||
"Houses information about a permutation gate, for ease of lookup by the greedy scheduler. | ||
|
||
OPERATOR is a string that names the permutation gate. | ||
|
||
ARGUMENTS is a list of positions into the hardware object's cxns list's 0th level, naming the argument order for the gate application. | ||
|
||
PERMUTATION is a list of positions into the hardware object's cxns list's 0th level, indicating the permutation that this gate application has on the qubit data. | ||
|
||
DURATION is the time duration in nanoseconds of this gate application." | ||
(operator "SWAP") | ||
(arguments (list 0 1)) | ||
(permutation (list 1 0)) | ||
(duration 600)) | ||
|
||
(defstruct (gate-record (:copier nil)) | ||
"Houses information about a hardware instantiation of a gate. | ||
|
||
FIDELITY stores the measured gate fidelity. | ||
|
||
DURATION stores the measured gate duration (in nanoseconds)." | ||
(fidelity +near-perfect-fidelity+ :type (or null real)) | ||
(duration 1/100 :type (or null real))) | ||
|
||
(defun copy-gate-record (record &key fidelity duration) | ||
(make-gate-record :fidelity (or fidelity (gate-record-fidelity record)) | ||
:duration (or duration (gate-record-duration record)))) | ||
|
||
|
||
;;; The HARDWARE object structure stores a lot of information. It | ||
;;; serves many purposes, principally to solve some of the following | ||
;;; problems: | ||
|
@@ -118,15 +74,9 @@ DURATION stores the measured gate duration (in nanoseconds)." | |
;;; our order. maybe there is a more intelligent data structure to use. something | ||
;;; to think about in the future. | ||
;;; | ||
;;; We NOTINLINE here because a previous file "compilation-methods.lisp" uses this | ||
;;; structure, but the dependency is circular, so moving this doesn't make much sense. | ||
(declaim (notinline hardware-object-order | ||
hardware-object-native-instruction-p | ||
hardware-object-compilation-methods | ||
hardware-object-permutation-gates | ||
hardware-object-rewriting-rules | ||
hardware-object-cxns | ||
hardware-object-misc-data)) | ||
;;; Note that a previous file "compilation-methods.lisp" uses this structure, but the dependency is circular, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we reverse it? Can we
and just inline whenever we feel we need to? Adding bulky notinline decls everywhere just to quiet SBCL is sort of a code smell to me; I'd rather condense it all, and use |
||
;;; so moving this doesn't make much sense. To get SBCL to be quiet about it, each usage of one of the struct | ||
;;; accessors defined here is explicitly declared NOTINLINE at the callsite. | ||
(defstruct hardware-object | ||
"Houses information about a particular hardware object on a QPU. | ||
|
||
|
@@ -152,6 +102,49 @@ MISC-DATA is a hash-table of miscellaneous data associated to this hardware obje | |
(make-adjustable-vector)))) | ||
(misc-data (make-hash-table :test #'equal) :type hash-table)) | ||
|
||
(defun debug-print-link (stream link &optional colon-p at-sign-p) | ||
"Print out the two qubits constituting a link." | ||
(declare (ignore colon-p at-sign-p)) | ||
(let* ((cxns (hardware-object-cxns link)) | ||
(qubit0 (vnth 0 (vnth 0 cxns))) | ||
(qubit1 (vnth 1 (vnth 0 cxns)))) | ||
(format stream "~a -- ~a" qubit0 qubit1))) | ||
|
||
(defun debug-print-chip-spec (cs &optional (stream *standard-output*)) | ||
"Print out a simple, human-readable representation of a chip specification consisting of the number of qubits, the number of links, and a list of the links." | ||
(format stream "~a qubits, ~a links~%links:~%~{~/cl-quil::debug-print-link/~%~}~%" | ||
(chip-spec-n-qubits cs) | ||
(chip-spec-n-links cs) | ||
(coerce (chip-spec-links cs) 'list))) | ||
|
||
(defstruct permutation-record | ||
"Houses information about a permutation gate, for ease of lookup by the greedy scheduler. | ||
|
||
OPERATOR is a string that names the permutation gate. | ||
|
||
ARGUMENTS is a list of positions into the hardware object's cxns list's 0th level, naming the argument order for the gate application. | ||
|
||
PERMUTATION is a list of positions into the hardware object's cxns list's 0th level, indicating the permutation that this gate application has on the qubit data. | ||
|
||
DURATION is the time duration in nanoseconds of this gate application." | ||
(operator "SWAP") | ||
(arguments (list 0 1)) | ||
(permutation (list 1 0)) | ||
(duration 600)) | ||
|
||
(defstruct (gate-record (:copier nil)) | ||
"Houses information about a hardware instantiation of a gate. | ||
|
||
FIDELITY stores the measured gate fidelity. | ||
|
||
DURATION stores the measured gate duration (in nanoseconds)." | ||
(fidelity +near-perfect-fidelity+ :type (or null real)) | ||
(duration 1/100 :type (or null real))) | ||
|
||
(defun copy-gate-record (record &key fidelity duration) | ||
(make-gate-record :fidelity (or fidelity (gate-record-fidelity record)) | ||
:duration (or duration (gate-record-duration record)))) | ||
|
||
(defun hardware-object-native-instruction-p (obj instr) | ||
"Emits the physical duration in nanoseconds if this instruction translates to a physical pulse (i.e., if it is a native gate, \"instruction native\"), and emits NIL if this instruction does not admit direct translation to a physical pulse. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we just move this whole rewiring section to be defined after
token
is?