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

M1 Mac runtimecheck Errors #12

Closed
miguelmartin75 opened this issue Aug 25, 2023 · 6 comments
Closed

M1 Mac runtimecheck Errors #12

miguelmartin75 opened this issue Aug 25, 2023 · 6 comments

Comments

@miguelmartin75
Copy link

miguelmartin75 commented Aug 25, 2023

With the following code:

import nimsimd/runtimecheck

let
  cpuHasAvx* = checkInstructionSets({AVX})
  cpuHasAvx2* = checkInstructionSets({AVX, AVX2})

This fails to compile:

/Users/miguelmartin/.cache/nim/nimsimd_test_d/@m..@s..@s..@[email protected]@[email protected]@[email protected]:130:10: error: invalid output constraint '=a' in asm
        :"=a"(eaxr), "=b"(ebxr), "=c"(ecxr), "=d"(edxr)
         ^
1 error generated.
Error: execution of an external compiler program 'clang -c  -w -ferror-limit=3 -pthread   -I/Users/miguelmartin/.choosenim/toolchains/nim-2.0.0/lib -I/Users/miguelmartin/repos/nim_playground/nimsimd_test/src -o /Users/miguelmartin/.cache/nim/nimsimd_test_d/@m..@s..@s..@[email protected]@[email protected]@[email protected] /Users/miguelmartin/.cache/nim/nimsimd_test_d/@m..@s..@s..@[email protected]@[email protected]@[email protected]' failed with exit code: 1

System Details:

  • OS: MacOS 13.5
  • CPU: M1 Max
  • RAM: 64GB

Compiler version: 2.0

@guzba
Copy link
Owner

guzba commented Aug 25, 2023

I have confirmed this works as expected on my M1 using nim c -r examples/runtimecheck.nim added #13

What is your compile command?

@guzba
Copy link
Owner

guzba commented Aug 25, 2023

Ah, I'm guessing you are compiling as arm64. It is only possible to runtime check amd64 instruction sets. You'll need a when defined(amd64): block.

Edit: looks like I have that at the top of runtimecheck.nim to prevent this. Lets see what the compile command is.

@miguelmartin75
Copy link
Author

It seems related to choosenim not providing an arm64 build (dom96/choosenim#318). I'll install the compiler myself.

@guzba
Copy link
Owner

guzba commented Aug 25, 2023

Ah, interesting. Lets see if anything changes with a fresh compiler build. Fortunately Nim makes that relatively straightforward imo.

@miguelmartin75
Copy link
Author

Compiling & installing the nim compiler worked to resolve this (I can now use pixie!). Apologies for the noise.

@guzba
Copy link
Owner

guzba commented Aug 26, 2023

All good, glad that fixed things and hopefully choosenim stuff will be sorted out soon too.

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

No branches or pull requests

2 participants