filecoin-project / ec-gpu

OpenCL code generator for finite-field arithmetic over arbitrary prime fields
Other
89 stars 60 forks source link

fix: make it more AMD GPU compatible #12

Closed vmx closed 2 years ago

vmx commented 2 years ago

The AMD OpenCL compiler doesn't support assignments with the struct initializer syntax ({ … }). So intead of using defines for intitializing field elements, define them as constants instead.

It changes from e.g.

#define Fr_ONE ((Fr){ { 4294967294, 1, 215042, 1485092858, 3971764213, 2576109551, 2898593135, 405057881 } })

to

CONSTANT Fr Fr_ONE = { { 4294967294, 1, 215042, 1485092858, 3971764213, 2576109551, 2898593135, 405057881 } };

Fixes https://github.com/filecoin-project/neptune/issues/118.

vmx commented 2 years ago

CI for upstream users passes with those changes:

I also did run gbench from Neptune and I couldn't see any performance difference. There was bigger difference between runs, than withing that branch and master.