Skip to content

Conversation

@heshpdx
Copy link

@heshpdx heshpdx commented Sep 17, 2024

Description

For the generic/CPU path, we noticed a super hot loop executing a floating point divide, where the divisor is a loop invariant and can be replaced by a floating point multiply. This can provide some speedup for microarchitectures which implement FMUL faster than FDIV.

Added dependencies: none

How to test

I could not build this repository on my box. We were testing with the SPEC CPU candidate drop of marian. The edit is small and contained, and verified within our framework without loss of accuracy. We are offering this patch in case it helps the community.

Here is a snippet of coverage from tensor_operations.cpp, where hit counts are listed to the right of the line numbers. In this image, line 1177 and 1181 are the ones we would edit.

image

Checklist

  • [y] I have tested the code manually
  • [n] I have run regression tests
  • [y] I have read and followed CONTRIBUTING.md
  • [y] I have updated CHANGELOG.md

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.

1 participant