MLAS: tune softmax kernels for partial vectors#3906
Merged
Conversation
stevenlix
pushed a commit
that referenced
this pull request
May 12, 2020
skottmckay
added a commit
that referenced
this pull request
Jun 9, 2020
skottmckay
added a commit
that referenced
this pull request
Jun 24, 2020
rayankrish
pushed a commit
to rayankrish/onnxruntime
that referenced
this pull request
Jun 24, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description: The code paths to handle partial vectors in the softmax kernels was too slow: speed it up.
Motivation and Context
This addresses some of the slowness indicated in #3892. The paths to handle partial 256b vectors used the AVX instructions to load/store data, but these can be slower than handling the data an element at a time instead. In some microbenchmarks of MlasComputeSoftmax with D < 8, the updated sequences can be twice as fast.
There is additional performance to be had from de-virtualizing the softmax kernel, but that will be done in a different PR.
Also, clean up pooling.cpp to use the new helpers to do a vector wide max/sum reduction. The code generated by this is the same.