Leandro Campos
MModular
•Created by Leandro Campos on 1/19/2025 in #community-showcase
MPFR-based correctness testing for Mojo 🔥
This project is a proof of concept (PoC) that demonstrates how we can use the MPFR library as a “gold standard” to test the correctness of mathematical functions implemented in Mojo.
MPFR is an efficient C library for multiple-precision floating-point computations with correct rounding. It is used to test numerical routines in projects such as CORE-MATH, LLVM-libc, and RLIBM.
By comparing the outputs of our custom Mojo functions with MPFR, we can ensure that our implementations are correctly rounded or at least as accurate as possible within specific memory or latency requirements.
Main Features:
- Provides a routine to convert MPFR values into lower-precision floating-point types (like
float16
and bfloat16
), avoiding double rounding errors.
- Supports correctness testing under multiple IEEE 754 rounding modes.
- Includes utilities to change and check rounding mode at runtime.
Project Repository đź”— github.com/leandrolcampos/mpfr-for-mojo5 replies
MModular
•Created by Leandro Campos on 6/12/2024 in #community-showcase
Specials: Accurate, Hardware Accelerated, Special Functions in Mojo
Specials is a Mojo package designed to provide highly-optimized and hardware-acceleration-friendly special functions implementations for AI computing.
https://github.com/leandrolcampos/specials
7 replies
MModular
•Created by Leandro Campos on 2/1/2024 in #questions
DTypePointer to StaticTuple array
Suppose I have defined a static tuple
x
as follows: var x = StaticTuple[4, Float32](1.0, 2.0, 3.0, 4.0)
. Is it possible to create an instance of DTypePointer[DType.float32]
from the address of x
's underlying storage?7 replies
MModular
•Created by Leandro Campos on 12/7/2023 in #questions
Are literals splatted in SIMD Operations?
Is there any performance difference if I write this
instead of this?
In other words, is the literal
2
transformed into a splatted SIMD vector at runtime every time multiply_by_two
is called? Or is this something that the compiler is able to optimize?4 replies