Skip to content

Optimize softmax cpu by parallel using openmp. - #36

Merged
Zhang Lei (zhanghuanrong) merged 3 commits into
masterfrom
zhalei/softmax_optimize
Nov 29, 2018
Merged

Zhang Lei (zhanghuanrong) merged 3 commits into
masterfrom
zhalei/softmax_optimize

Conversation

@zhanghuanrong

Copy link
Copy Markdown
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;

@ke1337 Ke Deng (ke1337) Nov 27, 2018 •

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
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
Zhang Lei (zhanghuanrong) requested a review from a team as a code owner November 28, 2018 19:16

@ke1337 Ke Deng (ke1337) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

:shipit:

@zhanghuanrong
Zhang Lei (zhanghuanrong) merged commit cd1042c into master Nov 29, 2018
@pranavsharma
Pranav Sharma (pranavsharma) deleted the zhalei/softmax_optimize branch December 3, 2018 23:02
Nat Kershaw (MSFT) (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
Ted Themistokleous (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>
Changming Sun (snnn) pushed a commit that referenced this pull request Jun 21, 2024
Ted Themistokleous (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>
Dmitri Smirnov (yuslepukhin) pushed a commit that referenced this pull request Mar 17, 2026
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