Skip to content

Fix layer_norm.cc on x86#6556

Merged
snnn merged 2 commits into
masterfrom
user/cianh/fix-32bit-layer-norm
Feb 9, 2021
Merged

Fix layer_norm.cc on x86#6556
snnn merged 2 commits into
masterfrom
user/cianh/fix-32bit-layer-norm

Conversation

@cianmhayes
Copy link
Copy Markdown
Contributor

@cianmhayes cianmhayes commented Feb 4, 2021

Description: Explicitly cast size parameters to int

Motivation and Context
Building with --enable_training or --enable_training_ops on x86 encounters build errors in layer_norm.cc because SizeToDimension and SizeFromDimension return int64_t, whereas the Eigen constructors and templates take int. This compiles fine in x64 builds, but in x86 builds all the uses of M or N produce an error like:

error C2398: Element '2': conversion from 'const int64_t' to 'Eigen::EigenBase::Index' requires a narrowing conversion

@cianmhayes cianmhayes requested a review from a team as a code owner February 4, 2021 01:45
Comment thread orttraining/orttraining/training_ops/cpu/nn/layer_norm.cc Outdated
Comment thread orttraining/orttraining/training_ops/cpu/nn/layer_norm.cc Outdated
@cianmhayes cianmhayes force-pushed the user/cianh/fix-32bit-layer-norm branch from a2f985d to ededac0 Compare February 8, 2021 21:46
@cianmhayes
Copy link
Copy Markdown
Contributor Author

@mrry , @snnn, can you folks take a look at the last set of changes?

Copy link
Copy Markdown
Contributor

@mrry mrry left a comment

Choose a reason for hiding this comment

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

Looks good to me, thanks Cian!

@snnn snnn merged commit 16eed68 into master Feb 9, 2021
@snnn snnn deleted the user/cianh/fix-32bit-layer-norm branch February 9, 2021 01:36
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.

3 participants