Closed
Description
We need operations over finite fields defined in the Metal Shading Language for implementing FFT (#116) and possibly other future algorithms in the GPU. So it's required to make implementations that mimic the ones we already have in Rust.
Some requirements:
- Basic operations like
sum
,sub
,mul
,div
. - Watch out for integer overflow, special care is needed to implement the
mul
operation for example. - Ideally we could build a field with a custom module (represented as an
uint64_t
or whichever type is needed) - MSL only supports up to 64-bit integers, so it would be needed to also implement classes for bigger ints (specifically see which fields with big integers there are implemented on Rust right now)
- The work directory will be
math/src/fft/metal/
Relevant resources:
- MSL Specification (MSL is based on C++)
- The Metal documentation and also see our metal_playground repo for examples on how to use the
metal
crate in Rust, useful for testing. - risc0 and ministark have some examples of prime fields implemented in C or MSL.
- Us
- General information about finite fields and modular arithmetic can be easily found on the web.