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

llvm.x86.pclmulqdq on Julia over Apple M1 #21

Closed
uchkw opened this issue Mar 3, 2022 · 3 comments
Closed

llvm.x86.pclmulqdq on Julia over Apple M1 #21

uchkw opened this issue Mar 3, 2022 · 3 comments

Comments

@uchkw
Copy link

uchkw commented Mar 3, 2022

On Julia over Apple M1, I am unable to perform power operations as shown below.

julia> versioninfo()
Julia Version 1.7.2
Commit bf53498635 (2022-02-06 15:21 UTC)
Platform Info:
  OS: macOS (arm64-apple-darwin21.2.0)
  CPU: Apple M1
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-12.0.1 (ORCJIT, cyclone)

julia> using GaloisFields
[ Info: Precompiling GaloisFields [8d0d7f98-d412-5cd4-8397-071c807280aa]

julia> const G, α = GaloisField(2, 4, )
(𝔽₁₆, α)

julia> α^2
LLVM ERROR: Cannot select: intrinsic %llvm.x86.pclmulqdq

signal (6): Abort trap: 6
in expression starting at REPL[3]:1
__pthread_kill at /usr/lib/system/libsystem_kernel.dylib (unknown line)
Allocations: 7490130 (Pool: 7486448; Big: 3682); GC: 9
fish: Job 1, 'julia' terminated by signal SIGABRT (Abort)

There seems to be an error in the following line executing pclmulqdq in BinaryFields.jl. I would appreciate it if you could provide me with a solution.

function carrylessmul(a::m128, b::m128)
    ccall("llvm.x86.pclmulqdq", llvmcall, m128, (m128, m128, UInt8), a, b, 0)
end
@tkluck
Copy link
Owner

tkluck commented Mar 4, 2022

Hi @uchkw , would you be able to verify for me that

julia> using Base.BinaryPlatforms.CPUID

julia> CPUID.test_cpu_feature(CPUID.JL_X86_pclmul)

returns false on your platform? That will help me publish a fix.

@uchkw
Copy link
Author

uchkw commented Mar 5, 2022

Thanks for your quick response.
Yes, it returns false.

julia> using Base.BinaryPlatforms.CPUID

julia> CPUID.test_cpu_feature(CPUID.JL_X86_pclmul)
false

@tkluck tkluck closed this as completed in 8fd1088 May 9, 2022
@uchkw
Copy link
Author

uchkw commented May 9, 2022

It worked! Thanks!

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