Skip to content

AngelicosPhosphoros/Test-Fast-Math-Using-Hack-Rust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Script for testing safe fast math effect

Tested only Ubuntu 20 with Python3, Clang and Rust.

Versions

Ubuntu clang version 11.0.0-2~ubuntu20.04.1 Target: x86_64-pc-linux-gnu Thread model: posix InstalledDir: /usr/bin

rustc 1.51.0 (2fd73fabe 2021-03-23)

How to test

Tweak constants in compile.py (you need specify your CPU, linker, llvm tools, etc) And just run python3 compile.py

What it does

It generated LLVM IR code for dot product dynamic library in Rust. Then adds some faster and imprecise (but still SAFE and without UB!) flags to fadd and fmul instructions in one of implementations. Runs LLVM optimizations then link it to dynamic library. Then builds and run Rust project to show difference between IEEE-754 compilant and fast arithmetics.

Results on my PC

Running IEEE-754 floating math
Elapsed 155 microseconds
Result: 2666686666700000

Running fast floating math
Elapsed 104 microseconds
Result: 2666686666700000

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published