Skip to content
This repository was archived by the owner on Nov 17, 2023. It is now read-only.

Conversation

@access2rohit
Copy link
Contributor

Description

This PR makes MKL_INT a typedef for int64_t when using large tensor thus avoiding the following error when building with MKL as blas and the compiler flag -Werror=narrowing
Error:

[2020-06-27T06:00:01.634Z] /work/mxnet/src/operator/contrib/transformer.cc: In function 'void mxnet::op::strided_batch_sgemm(bool, bool, mxnet::index_t, mxnet::index_t, mxnet::index_t, float, const float*, mxnet::index_t, mxnet::index_t, const float*, mxnet::index_t, mxnet::index_t, float, float*, mxnet::index_t, mxnet::index_t, int32_t)':

[2020-06-27T06:00:01.634Z] /work/mxnet/src/operator/contrib/transformer.cc:143:31: error: narrowing conversion of 'm' from 'mxnet::index_t {aka long int}' to 'int' inside { } [-Werror=narrowing]

[2020-06-27T06:00:01.634Z]    MKL_INT p_m[GROUP_SIZE] = {m};

[2020-06-27T06:00:01.634Z]                                ^

[2020-06-27T06:00:01.634Z] /work/mxnet/src/operator/contrib/transformer.cc:144:31: error: narrowing conversion of 'n' from 'mxnet::index_t {aka long int}' to 'int' inside { } [-Werror=narrowing]

[2020-06-27T06:00:01.634Z]    MKL_INT p_n[GROUP_SIZE] = {n};

[2020-06-27T06:00:01.634Z]                                ^

[2020-06-27T06:00:01.634Z] /work/mxnet/src/operator/contrib/transformer.cc:145:31: error: narrowing conversion of 'k' from 'mxnet::index_t {aka long int}' to 'int' inside { } [-Werror=narrowing]

[2020-06-27T06:00:01.634Z]    MKL_INT p_k[GROUP_SIZE] = {k};

[2020-06-27T06:00:01.634Z]                                ^

[2020-06-27T06:00:01.634Z] /work/mxnet/src/operator/contrib/transformer.cc:146:35: error: narrowing conversion of 'lda' from 'mxnet::index_t {aka long int}' to 'int' inside { } [-Werror=narrowing]

[2020-06-27T06:00:01.634Z]    MKL_INT p_lda[GROUP_SIZE] = {lda};

[2020-06-27T06:00:01.634Z]                                    ^

[2020-06-27T06:00:01.634Z] /work/mxnet/src/operator/contrib/transformer.cc:147:35: error: narrowing conversion of 'ldb' from 'mxnet::index_t {aka long int}' to 'int' inside { } [-Werror=narrowing]

[2020-06-27T06:00:01.634Z]    MKL_INT p_ldb[GROUP_SIZE] = {ldb};

[2020-06-27T06:00:01.634Z]                                    ^

[2020-06-27T06:00:01.634Z] /work/mxnet/src/operator/contrib/transformer.cc:148:35: error: narrowing conversion of 'ldc' from 'mxnet::index_t {aka long int}' to 'int' inside { } [-Werror=narrowing]

[2020-06-27T06:00:01.634Z]    MKL_INT p_ldc[GROUP_SIZE] = {ldc};

Checklist

Essentials

Please feel free to remove inapplicable items for your PR.

  • Changes are complete (i.e. I finished coding on this PR)
  • All changes have test coverage:
  • Unit tests are added for small changes to verify correctness (e.g. adding a new operator)
  • Build tests will be added for build configuration changes (e.g. adding a new build option with NCCL)
  • To the best of my knowledge, examples are either not affected by this change, or have been fixed to be compatible with this change

@mxnet-bot
Copy link

Hey @access2rohit , Thanks for submitting the PR
All tests are already queued to run once. If tests fail, you can trigger one or more tests again with the following commands:

  • To trigger all jobs: @mxnet-bot run ci [all]
  • To trigger specific jobs: @mxnet-bot run ci [job1, job2]

CI supported jobs: [miscellaneous, windows-gpu, clang, website, sanity, windows-cpu, edge, unix-gpu, unix-cpu, centos-gpu, centos-cpu]


Note:
Only following 3 categories can trigger CI :PR Author, MXNet Committer, Jenkins Admin.
All CI tests must pass before the PR can be merged.

@TaoLv
Copy link
Member

TaoLv commented Jul 1, 2020

Please refer to https://software.intel.com/content/www/us/en/develop/documentation/mkl-macos-developer-guide/top/linking-your-application-with-the-intel-math-kernel-library/linking-in-detail/linking-with-interface-libraries/using-the-ilp64-interface-vs-lp64-interface.html

The cmake flag MKL_USE_ILP64 needs to be set to enable MKL ILP64 interface.

Copy link
Member

@szha szha left a comment

Choose a reason for hiding this comment

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

Thanks @access2rohit for the change and thank you @TaoLv for the context. I think we should also turn on MKL_USE_ILP64 automatically in cmake when both MKL and large tensor is used.

@access2rohit
Copy link
Contributor Author

Not required as its enabled by default now :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants