Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • mesa mesa
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 2,756
    • Issues 2,756
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 910
    • Merge requests 910
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Mesa
  • mesamesa
  • Merge requests
  • !10670

nir/opt_algebraic: Add fmul(a, 2.0) -> fadd(a, a)

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Alyssa Rosenzweig requested to merge alyssa/mesa:nir-fmul-two into main May 06, 2021
  • Overview 13
  • Commits 1
  • Pipelines 2
  • Changes 2

Investigated for Bifrost, but should be the same or cheaper for any reasonable architecture. For the compilers I maintain:

  • Bifrost - fadd can be scheduled 2x as frequently as ffma, there is no fmul separate from ffma.
  • Midgard - fadd x, x is used as a canonical form, again for easier scheduling.
  • AGX - fmul and fadd are both native ops, but fmul is heavier weight (unknown whether this is a performance issue or just power consumption). Also saves a move / uniform file slot for the constant.

Since floating point multiplication is inherently more expensive than addition, presumably this is a win for everyone else too.

Signed-off-by: Alyssa Rosenzweig alyssa@collabora.com

Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: nir-fmul-two