Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize softmax cpu by parallel using openmp. #36

Merged
merged 3 commits into from
Nov 29, 2018

Conversation

zhanghuanrong
Copy link
Contributor

No description provided.


// Put the intermediate result X - max(X) into Y by first copying X to Y, and then subtracting max from each entry
gsl::copy(gsl::make_span(Xdata, nd), gsl::make_span(Ydata, nd));
static const int kGROUP = 8;
Copy link
Contributor

@ke1337 ke1337 Nov 27, 2018

Choose a reason for hiding this comment

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

8 [](start = 28, length = 1)

Why this hardcoded number? Would it be more readable and efficient to use Eigen reduction and broadcast directly for the whole Softmax computation? https://eigen.tuxfamily.org/dox/group__TutorialReductionsVisitorsBroadcasting.html

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is to control the parallel. I could change it to let openmp decide it dynamically.

Currently no idea on how to use Eigen for such parallel. Could you provide more information?

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You considered the same thing when I start working on this. I read this before, it have parallel gemm and some other matrix algebra. But no generic support to control the parallel on rowwise, colwise, cwise, etc. Some body raised such issue for years, yet no implementation accepted yet.
So outside control parallel is manually needed now.

Also I changed the group count calculation logic. Please check again.
Thanks, Lei

@zhanghuanrong zhanghuanrong requested a review from a team as a code owner November 28, 2018 19:16
ke1337
ke1337 previously approved these changes Nov 28, 2018
Copy link
Contributor

@ke1337 ke1337 left a comment

Choose a reason for hiding this comment

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

:shipit:

@zhanghuanrong zhanghuanrong merged commit cd1042c into master Nov 29, 2018
@pranavsharma pranavsharma deleted the zhalei/softmax_optimize branch December 3, 2018 23:02
natke referenced this pull request in natke/onnxruntime Feb 15, 2022
* Add inference and evaluation for BERT QDQ

* Add fp16 and int8 flags

* Modify data reader to handle multiple features

* Set batch size to 1 due to some qdq model might have issues processing batch size greate than 1

* Add comment and ignore last commit commit

* Add evaluation for squad v2.0

* Run evaluate script directly in e2e script
TedThemistokleous added a commit to TedThemistokleous/onnxruntime that referenced this pull request Jun 18, 2024
* enable MIGraphX EP on Windows

* [MIGraphX EP] Fix provider options

* fix formatting

* unify the package name for both rocm and migraphx

* fix compilation after moving to rocm6.2

* make STREAM_SYNC the default

* workaround hip sdk bug on windows

* Revert rename of private var for now

---------

Co-authored-by: Filip Jankovic <filip.jankovic@amd.com>
Co-authored-by: Ted Themistokleous <107195283+TedThemistokleous@users.noreply.github.com>
Co-authored-by: Ted Themistokleous <tedthemistokleous@amd.com>
snnn added a commit that referenced this pull request Jun 21, 2024
TedThemistokleous added a commit to TedThemistokleous/onnxruntime that referenced this pull request Jul 4, 2024
* enable MIGraphX EP on Windows

* [MIGraphX EP] Fix provider options

* fix formatting

* unify the package name for both rocm and migraphx

* fix compilation after moving to rocm6.2

* make STREAM_SYNC the default

* workaround hip sdk bug on windows

* Revert rename of private var for now

---------

Co-authored-by: Filip Jankovic <filip.jankovic@amd.com>
Co-authored-by: Ted Themistokleous <107195283+TedThemistokleous@users.noreply.github.com>
Co-authored-by: Ted Themistokleous <tedthemistokleous@amd.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.

2 participants