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

[1.x] Backport of intgemm #17559 #19099

Merged
merged 12 commits into from
Sep 16, 2020
Merged

Conversation

kpuatamazon
Copy link
Contributor

Description

This is a backport of intgemm from master to the v1.x branch. intgemm was merged into master in #17559. It is an 8-bit matrix multiply library for x86 CPUs.

Changes from the master cherry-pick:

  • Fixing CMakeLists.txt so that target_link_libraries attaches to mxnet_static
  • In the tests, @pytest.mark.parametrize is broken with @with_seed() so I used manual for loops
  • Add Makefile compilation with apology in advance to @leezu

Checklist

Essentials

  • PR's title starts with a category (e.g. [BUGFIX], [MODEL], [TUTORIAL], [FEATURE], [DOC], etc)
  • Changes are complete (i.e. I finished coding on this PR)
  • All changes have test coverage
  • Code is well-documented

@mxnet-bot
Copy link

Hey @kpuatamazon , 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: [website, windows-cpu, edge, clang, centos-gpu, windows-gpu, unix-cpu, unix-gpu, centos-cpu, sanity, miscellaneous]


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.

@samskalicky
Copy link
Contributor

@pengzhao-intel @ZhennanQin @ciyongch Can you guys hook us up with someone who might be able to help with the issues around intrinsics?

[2020-09-07T21:41:15.193Z] In file included from build/3rdparty/intgemm/intgemm/intgemm.cc:1:
[2020-09-07T21:41:15.193Z] In file included from build/3rdparty/intgemm/intgemm/intgemm.h:46:
[2020-09-07T21:41:15.193Z] In file included from build/3rdparty/intgemm/intgemm/sse2_gemm.h:3:
[2020-09-07T21:41:15.193Z] In file included from build/3rdparty/intgemm/intgemm/kernels.h:4:
[2020-09-07T21:41:15.193Z] build/3rdparty/intgemm/intgemm/intrinsics.h:543:10: error: argument to '__builtin_ia32_psllwi512_mask' must be a constant integer
[2020-09-07T21:41:15.193Z]   return _mm512_slli_epi16(a, b);
[2020-09-07T21:41:15.193Z]          ^~~~~~~~~~~~~~~~~~~~~~~
[2020-09-07T21:41:15.193Z] /usr/lib/llvm-3.9/bin/../lib/clang/3.9.1/include/avx512bwintrin.h:1767:12: note: expanded from macro '_mm512_slli_epi16'
[2020-09-07T21:41:15.193Z]   (__m512i)__builtin_ia32_psllwi512_mask((__v32hi)(__m512i)(A), (int)(B), \
[2020-09-07T21:41:15.193Z]            ^                                                    ~~~~~~~~

https://jenkins.mxnet-ci.amazon-ml.com/blue/rest/organizations/jenkins/pipelines/mxnet-validation/pipelines/clang/branches/PR-19099/runs/3/nodes/42/steps/128/log/?start=0
There seems to be some issues compiling this PR on the 1.x branch

@pengzhao-intel
Copy link
Contributor

@pengzhao-intel @ZhennanQin @ciyongch Can you guys hook us up with someone who might be able to help with the issues around intrinsics?

[2020-09-07T21:41:15.193Z] In file included from build/3rdparty/intgemm/intgemm/intgemm.cc:1:
[2020-09-07T21:41:15.193Z] In file included from build/3rdparty/intgemm/intgemm/intgemm.h:46:
[2020-09-07T21:41:15.193Z] In file included from build/3rdparty/intgemm/intgemm/sse2_gemm.h:3:
[2020-09-07T21:41:15.193Z] In file included from build/3rdparty/intgemm/intgemm/kernels.h:4:
[2020-09-07T21:41:15.193Z] build/3rdparty/intgemm/intgemm/intrinsics.h:543:10: error: argument to '__builtin_ia32_psllwi512_mask' must be a constant integer
[2020-09-07T21:41:15.193Z]   return _mm512_slli_epi16(a, b);
[2020-09-07T21:41:15.193Z]          ^~~~~~~~~~~~~~~~~~~~~~~
[2020-09-07T21:41:15.193Z] /usr/lib/llvm-3.9/bin/../lib/clang/3.9.1/include/avx512bwintrin.h:1767:12: note: expanded from macro '_mm512_slli_epi16'
[2020-09-07T21:41:15.193Z]   (__m512i)__builtin_ia32_psllwi512_mask((__v32hi)(__m512i)(A), (int)(B), \
[2020-09-07T21:41:15.193Z]            ^                                                    ~~~~~~~~

https://jenkins.mxnet-ci.amazon-ml.com/blue/rest/organizations/jenkins/pipelines/mxnet-validation/pipelines/clang/branches/PR-19099/runs/3/nodes/42/steps/128/log/?start=0
There seems to be some issues compiling this PR on the 1.x branch

@kpuatamazon write this code and he will be the right people for this issue :)

@pengzhao-intel
Copy link
Contributor

CC @anko-intel for any quick thoughts ~~~

@samskalicky
Copy link
Contributor

@kpuatamazon write this code and he will be the right people for this issue :)

:D agreed, we're getting close to feature freeze on the 18th so any help would be awesome!

@lanking520 lanking520 added pr-awaiting-testing PR is reviewed and waiting CI build and test pr-awaiting-review PR is waiting for code review and removed pr-awaiting-testing PR is reviewed and waiting CI build and test pr-awaiting-review PR is waiting for code review labels Sep 14, 2020
@lanking520 lanking520 added pr-awaiting-review PR is waiting for code review pr-awaiting-testing PR is reviewed and waiting CI build and test and removed pr-awaiting-testing PR is reviewed and waiting CI build and test pr-awaiting-review PR is waiting for code review labels Sep 14, 2020
@kpuatamazon
Copy link
Contributor Author

Hi sorry I work Mondays on this.

The issues are all around older compilers and getting Makefile to work.

gcc below 5 doesn't support avx2 intrinstics well, so I want to disable intgemm compilation below that. Any comments on how best to test for this, keeping in mind that gcc can have many different CXX names? I was thinking about a compilation test. But at least in 2.x, MXNet fetches intgemm so I figured the Makefile would do the same with a target that does a git checkout. Which means any intgemm compilation tests are not available at the time Makefile is deciding whether to download stuff. Currently I have a rather hacky test in the Makefile. Is there somewhere in the main repo to put a compilation test?

Regarding debug and _mm512_slli_epi16 that should be fixed now. It requires a constant shift argument. Compiler versions differ in their willingness to see a constant through a function call, especially in debug. I've changed it to a template argument to force the constant to be passed through function calls.

Windows should be fixed. It just didn't have pytest so import pytest was failing. I've removed the dependency on pytest.

@lanking520 lanking520 removed the pr-awaiting-testing PR is reviewed and waiting CI build and test label Sep 14, 2020
@lanking520 lanking520 added the pr-work-in-progress PR is still work in progress label Sep 14, 2020
@lanking520 lanking520 added pr-awaiting-testing PR is reviewed and waiting CI build and test pr-awaiting-review PR is waiting for code review pr-work-in-progress PR is still work in progress and removed pr-work-in-progress PR is still work in progress pr-awaiting-testing PR is reviewed and waiting CI build and test pr-awaiting-review PR is waiting for code review labels Sep 14, 2020
@lanking520 lanking520 added pr-awaiting-testing PR is reviewed and waiting CI build and test pr-awaiting-review PR is waiting for code review pr-work-in-progress PR is still work in progress and removed pr-work-in-progress PR is still work in progress pr-awaiting-testing PR is reviewed and waiting CI build and test pr-awaiting-review PR is waiting for code review labels Sep 14, 2020
@samskalicky samskalicky added pr-awaiting-merge Review and CI is complete. Ready to Merge and removed pr-work-in-progress PR is still work in progress labels Sep 16, 2020
@samskalicky samskalicky merged commit d2e6452 into apache:v1.x Sep 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
pr-awaiting-merge Review and CI is complete. Ready to Merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants