microsoft / microsoft/DirectXShaderCompiler

[Feature Request] Separate compiler flags to disable/enable associative expression rewriting and other FP optimizations

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

Nobody has claimed this yet.

enhancement needs-triage
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.
Currently, users have the following options to disable fast-math optimizations:

  • The precise qualifier can decorate any expression/variable to inhibit all fast-math operations
  • The -Gis flag can be used to implicitly declare that all expressions are precise

Unfortunately, there is no "in between," meaning that you either have all of fast-math or none of it. In particular, being able to decouple the compiler setting for math associativity from math contraction optimizations would be a useful lever to pull in many shader programs.

Describe the solution you'd like
I would like the various fast-math optimizations to be enabled or disabled independently of each other.

Describe alternatives you've considered
Here, I describe the possibility of an intrinsic that suggests a contracted operation, even if precise or -Gis is requested.

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 reviewing how the precise qualifier and -Gis flag currently disable fast-math optimizations, then read the linked hlsl-specs issue 883 for the related intrinsic proposal. Done should provide independent controls for associative expression rewriting, contraction, and other fast-math optimizations without requiring all or none of them.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.