Skip to content

[FASTMATH] Allow contract by default#4015

Merged
whitneywhtsang merged 2 commits intomainfrom
whitneywhtsang/fastmath
Apr 26, 2025
Merged

[FASTMATH] Allow contract by default#4015
whitneywhtsang merged 2 commits intomainfrom
whitneywhtsang/fastmath

Conversation

@whitneywhtsang
Copy link
Copy Markdown
Contributor

@whitneywhtsang whitneywhtsang commented Apr 25, 2025

This PR set the fast math flag to allow contract by default.

A floating expression may be contracted, that is, evaluated as though it were a single operation, thereby omitting rounding errors implied by the source code and the expression evaluation method.

The single most common contracted expression is FMA operations: a * b + c → fma(a, b, c).

Notes:

  • All Triton unit tests and benchmarks pass with this change.
  • TRITON_DEFAULT_FP_FUSION is an existing Triton env var, it is enabled by default.

@whitneywhtsang whitneywhtsang self-assigned this Apr 25, 2025
@whitneywhtsang whitneywhtsang requested review from a team, alexbaden, chengjunlu and etiotto April 25, 2025 02:46
@whitneywhtsang whitneywhtsang force-pushed the whitneywhtsang/fastmath branch from f3f15ae to bbe68ab Compare April 25, 2025 02:47
Signed-off-by: Whitney Tsang <whitney.tsang@intel.com>
@whitneywhtsang whitneywhtsang force-pushed the whitneywhtsang/fastmath branch from bbe68ab to e3276a9 Compare April 25, 2025 03:38
@alexbaden
Copy link
Copy Markdown
Contributor

alexbaden commented Apr 25, 2025

Have you run the Inductor tests and accuracy benchmarks?

@whitneywhtsang
Copy link
Copy Markdown
Contributor Author

Copy link
Copy Markdown
Contributor

@alexbaden alexbaden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The inductor failure seems unrelated (cc @anmyachev) and enough accuracy benchmarks passed that it seems like we should be good once they finish.

@anmyachev
Copy link
Copy Markdown
Contributor

The inductor failure seems unrelated (cc @anmyachev)

yep, unrelated. Again only cuda-device test in main branch.

@whitneywhtsang whitneywhtsang enabled auto-merge (squash) April 26, 2025 18:39
@whitneywhtsang whitneywhtsang merged commit 6515a90 into main Apr 26, 2025
9 checks passed
@whitneywhtsang whitneywhtsang deleted the whitneywhtsang/fastmath branch April 26, 2025 19:29
david-hls pushed a commit to david-hls/intel-xpu-backend-for-triton that referenced this pull request Jun 18, 2025
The TritonGPUPipeline pass has unused pass options and the
TritonGPUAccelerateMatmul pass option could instead be read from the
module attributes, where the data already exists. The goal is to reduce
redundancy.

---------

Signed-off-by: Finlay Marno <finlay.marno@codeplay.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants