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

Fix handling of matrix layout in PTR-REF and LAPACK-CSD #121

Merged
merged 1 commit into from
Jan 27, 2021

Conversation

braised-babbage
Copy link
Contributor

@braised-babbage braised-babbage commented Jan 27, 2021

This fixes a bug where LAPACK-CSD gives the wrong values for row-major matrices.

In previous versions of magicl, matrices constructed with FROM-ARRAY had their layout determined by the layout of the input array, and so essentially all matrices had :column-major by default. More recent changes f761ef9 allow this to be controlled by a keyword argument of FROM-ARRAY, and the default was changed to :row-major. Unfortunately LAPACK-CSD did not handle this correctly for two reasons:

  • :column-major input layout was hardcoded by default in LAPACK-CSD
  • The actual code responsible for dereferencing pointers for the underlying lapack library, PTR-REF, was incomplete.

This issue was not exercised by magicl-tests, but does come up in cl-quil-tests::compiler-hook-tests. We fix these and add a new test for LAPACK-CSD in magicl-tests.

This also suggests a change to the general magicl PR workflow: in addition to ensuring that magicl tests pass, we should also be routinely running cl-quil tests against the updated versions for magicl.

cc: @notmgsk @stylewarning

@notmgsk
Copy link
Member

notmgsk commented Jan 27, 2021

cl-quil-tests run pretty long. I wonder if executing a subset of the tests would suffice.

@notmgsk
Copy link
Member

notmgsk commented Jan 27, 2021

What does the error in quilc look like? I don't think I've hit it, so I guess I haven't been using an up-to-date magicl.

@braised-babbage
Copy link
Contributor Author

braised-babbage commented Jan 27, 2021

What does the error in quilc look like? I don't think I've hit it, so I guess I haven't been using an up-to-date magicl.

Probably you (and the CI infrastructure) are running off of magicl 0.7, the latest in quicklisp. The bug appears on the sohaib.quil compiler hook test, and is a classic: "Matrices do not lie in the same projective class".

@notmgsk
Copy link
Member

notmgsk commented Jan 27, 2021

Classic Sohaib

@braised-babbage
Copy link
Contributor Author

cl-quil-tests run pretty long. I wonder if executing a subset of the tests would suffice.

Another option (probably healthier) is to create an issue to make sure that magicl test coverage is at least as comprehensive as the code paths exercised by quilc. I noticed with the LAPACK-CSD function that it was not well tested in magicl.

@notmgsk
Copy link
Member

notmgsk commented Jan 27, 2021

cl-quil-tests run pretty long. I wonder if executing a subset of the tests would suffice.

Another option (probably healthier) is to create an issue to make sure that magicl test coverage is at least as comprehensive as the code paths exercised by quilc. I noticed with the LAPACK-CSD function that it was not well tested in magicl.

#122 (comment)

@notmgsk notmgsk merged commit cec99fd into quil-lang:master Jan 27, 2021
@notmgsk notmgsk mentioned this pull request Jan 28, 2021
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