Rust-GPU / Rust-GPU/rust-cuda

Feature request: global "Fast Math" flag

Open
#262 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Rust
Stars
5.4k
Forks
249
PR merge metrics
No merged PRs in 30d

Description

With NVCC, I can use the flag --use_fast_math to enable algebraic optimisations globally when compiling a file. The only way I found to enable such optimisations in Rust-CUDA is to use the fadd_fast intrinsics (and similar). The typical reasoning for using this approach instead of a global "fast math" flag is that some math functions may rely on strict adherence to IEEE float semantics, so using a global "fast math" flag might silently break these. However, CudaBuilder already has a global ftz flag which may already break such functions. Therefore, perhaps it makes sense to also add a global fast_math flag, given that it's ok to globally opt-in to breaking IEEE anyway via ftz?

I'm happy to help with the implementation of this

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating CudaBuilder's existing global ftz option and reviewing how fadd_fast and similar intrinsics are exposed. Compare that behavior with NVCC's --use_fast_math semantics; done means establishing whether a global fast_math option can be added without changing the existing opt-in behavior for strict IEEE math.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.