quil-lang / qvm

The high-performance and featureful Quil simulator.
Other
413 stars 57 forks source link

Compiling on ARM64 requires removal of AVX2 mention #306

Closed genos closed 1 year ago

genos commented 2 years ago

Hi qvm friends! As you might have seen in other quil-lang repos, I've been working with an ARM64 machine recently. To get qvm to build on it, we needed to make a change to qvm.asd:

diff --git a/qvm.asd b/qvm.asd
index 96c9496..afc9cea 100644
--- a/qvm.asd
+++ b/qvm.asd
@@ -2,11 +2,6 @@
 ;;;;
 ;;;; Author: Robert Smith

-#+sbcl
-#.(when (sb-alien:extern-alien "avx2_supported" sb-alien:int)
-    (cl:push :qvm-avx2 cl:*features*)
-    (values))
-
 (asdf:defsystem #:qvm
   :description "An implementation of the Quantum Abstract Machine."
   :author "Robert Smith <robert@rigetti.com>"

With the AVX2 mention removed, compilation and running (so far?) go off without a hitch; with it things fail, citing

Unhandled LOAD-SYSTEM-DEFINITION-ERROR in thread #<SB-THREAD:THREAD "main thread" RUNNING {10027C0013}>: Error while trying to load definition for system qvm from pathname /home/genos/quicklisp/local-projects/qvm/qvm.asd: READ error during LOAD: Attempt to access an undefined alien variable.(in form starting at line: 5, column: 0, position: 45)

Thanks!

notmgsk commented 2 years ago

Now that I think about it, this might be due to having an old version of SBCL.

genos commented 2 years ago

@notmgsk oh yeah,

$ sbcl --version
SBCL 2.0.1.debian
genos commented 2 years ago

Just confirmed that this change is still necessary with sbcl --version = SBCL 2.2.8.124-ba95d2ff0, the current development version.

genos commented 2 years ago

Whoa, but now with the proposed fix, we get a different failure in build-app.lisp:

While evaluating the form starting at line 14, column 0
  of #P"/home/genos/quicklisp/local-projects/qvm/build-app.lisp":
Unhandled TYPE-ERROR in thread #<SB-THREAD:THREAD "main thread" RUNNING
                                  {1005B10713}>:
  The value
    NIL
  is not of type
    SB-KERNEL:CONSTANT
ecpeterson commented 2 years ago

I regret to say I've also seen this (second) error and failed to file a report about it.

erichulburd commented 1 year ago

I hit this TYPE-ERROR as well, but using SBCL 2.0.9 fixed for me, but sounds like @stylewarning upstreamed a fix to SBCL that should be released towards the end of the month: https://discord.com/channels/842124688002908231/842124688494428233/1025320591491866685