microsoft / microsoft/DirectXShaderCompiler

[SPIRV] Add support for -ffast-math

Open
#8,430 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement needs-triage spirv
Dominant language
C++
Stars
3.7k
Forks
900
Avg merge
2d 11h
Merged PRs (30d)
44

Description

Is your feature request related to a problem? Please describe.
Cant seem to find any way to get -ffast-math to work with dxc

Describe the solution you'd like
A flag like -fspv-ffast-math to enable decorations for appropriate operations

Describe alternatives you've considered
-ffinite-math-only but it doesnt imply Fast and AllowRecip afaik that are mentioned here: https://registry.khronos.org/SPIR-V/specs/unified1/SPIRV.html#FP_Fast_Math_Mode

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 at dxc's handling of compiler flags and trace how -ffinite-math-only is translated for SPIR-V. Consult the linked SPIR-V FP_Fast_Math_Mode specification to identify the required decorations; done means a new -fspv-ffast-math flag enables the appropriate Fast and AllowRecip behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.