PCLMULQDQ CRC32
i'll be porting the not bit-reflected version of that PCLMULQDQ CRC algo to c#
27 Replies
oh cool, this will allow me to get rid of the lookup table
lookup tables are bad for CPU cache
u wot m8
it's true
it has to store the whole table in the cache or else you're getting cache misses all over the place
a 8kB table was better than a 4kB table than having no table at all
also the cpu doesnt know the length of tables
well it depends
it caches whatever is looked up
sometimes the algorithm is helped by it
it caches in blocks
but yeah if you can get rid of the need for the lookup table without making it slower you make it faster
in this case SIMD blasts through the algorithm
ok, i tried porting two C implementations to c#
neither gives me what i want
i will have to port the assembly version
<a:SKULL_IS_ANIM:968366113127796786>
what is this formatting
who did this
oh hey, it worked first try
aaaand it went to the code path i didn't want it to go
this will be FUN
holy shit
my assembly port was right all along
lmfao
copied 3 crc implementations off stackoverflow
all of them are different
@kaijellinghaus see, this is why i gave up on this yesterday
it's hopeless
but i am proud i managed to port assembly to c# first try
I have like
no idea what is happening
i am trying to get a CRC algo that uses pclmulqdq to work for vorbis
right
have you considered just comparing the ASM 1:1
like
x2, put windows side by side, step through and compare?
i mean, the asm is no longer the problem
my c# port is the same as the asm, as seen here
result
local is the actual assembly, the cAsm
local is my port
i could also step through assembly in VSI have never used the VS C++/ASM/C/whatever debugger so I wouldn't know
what's the problem then?
vorbis uses a different polynomial and possibly endianness
so i need to patch things up for the intel crc to match the vorbis crc
I see
if i do get it working, crc validation of vorbis packets will basically be free lol
compared to the rest of the decoding process
and i feel like this may be a good exercise in case i ever use OPUS for something
unless OPUS has a completely different checksum algo
oh i'm silly
OPUS is not responsible for the checksums, it's the ogg container
i see that as an absolute win damn i did it
https://github.com/jeffareid/crc/blob/master/crc32f/crc32fa.asm
ported this to c#
i only had to fix two branches in the c#
because x86 flags are funky
preliminary results
will make a markdown table tomorrow after i clean everything up