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

add support for intel crc32 instruction #5

Open
andrewcooke opened this issue Mar 22, 2015 · 11 comments
Open

add support for intel crc32 instruction #5

andrewcooke opened this issue Mar 22, 2015 · 11 comments

Comments

@andrewcooke
Copy link
Owner

see https://crc32c.angeloflogic.com/performance/

@andrewcooke
Copy link
Owner Author

also the amd instruction (see same link)

@andrewcooke
Copy link
Owner Author

thanks; i'm trying to find out how to call assembly from julia...

@andrewcooke
Copy link
Owner Author

@andrewcooke
Copy link
Owner Author

@andrewcooke
Copy link
Owner Author

@stevengj
Copy link
Contributor

stevengj commented Aug 5, 2016

I did some digging, and this seems to work:

crc32(crc::Int32, x::Int32) =
      Base.llvmcall(("declare i32 @llvm.x86.sse42.crc32.32.32(i32, i32)",
                     """%3 = call i32 @llvm.x86.sse42.crc32.32.32(i32 %0, i32 %1)                    
                        ret i32 %3"""), Int32, Tuple{Int32,Int32}, crc, x)
crc32(Int32(0), Int32(1))

(I haven't checked whether the result is correct, but it gives me an answer without complaining at least.)

@andrewcooke
Copy link
Owner Author

oh wow. thanks. tbh i don't think i ever got to the point where i understood how to use it... i will need to read the technical note again. but if you feel like posting a patch, that would be awesome!

@stevengj
Copy link
Contributor

stevengj commented Aug 6, 2016

Will be gone for the next few days, but let me know if you can't figure it out. Note that there are related instructions that take inputs of different widths, IIRC.

@stevengj
Copy link
Contributor

In Julia 0.6, you can just call Base.crc32c to get an efficient hardware-accelerated CRC32c; see JuliaLang/julia#18297

@stevengj
Copy link
Contributor

stevengj commented Jun 7, 2017

Ping: now that 0.6 is almost out, you might want to call Base.crc32c for that checksum type in 0.6, since it was more than an order of magnitude faster than CRC.jl last time I checked.

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

3 participants