mratsim / constantine

Constantine: modular, high-performance, zero-dependency cryptography stack for verifiable computation, proof systems and blockchain protocols.
Other
413 stars 44 forks source link

LLVM: field addition with saturated fields #456

Closed mratsim closed 3 months ago

mratsim commented 3 months ago

This PR merges several experiments to implement modular addition in pure LLVM IR so that instead of writing an assembly backend for each target we can generate multiplatform code from LLVM IR, especially for ARM and AMDGPU as they support addition-with-carry and also SIMD, without doing vectorization myself.

That was to try to address:

Unfortunately, compilers are still inefficient at translating modular addition into optimal code. See https://github.com/mratsim/constantine/issues/357:

Description of experiments: