marian-dev icon indicating copy to clipboard operation
marian-dev copied to clipboard

Add oneDNN

Open graemenail opened this issue 2 years ago • 0 comments

TODO

  • Manual check of training / scoring

Description

Replaces MKL with oneDNN. This PR should enable completely open-source releases of Marian.

This PR also includes a caching of boost, and a cleaning of the debug build directory. These can be broken off into a separate PR if necessary. During testing, windows builds would fail from running out of space building both debug and release. Since disabling oneDNN JIT profiling the build sizes are smaller.

Related: https://github.com/marian-nmt/marian-regression-tests/pull/86 Closes: https://github.com/marian-nmt/marian-dev/issues/706

List of changes:

  • Adds oneDNN as a submodule
  • Removes MKL related code
  • Use oneDNN for sgemm
  • Modified code paths:
    • batched GEMM (cblas_sgemm_batch in prod.cpp)
    • TransposeFirst3In4 (mkl_somatcopy in tensor_operators.cpp)
    • Bias copy-op (mkl_somatcopy in packed_gemm.cpp)

The following have some MKL component, and have not been touched:

  • azure workflows
  • src/microsoft code
  • vs/*

Added dependencies: Intel oneDNN (removing Intel MKL)

How to test

Ran the 1 million sentence testset of WNGT21 through the MKL (4672.1s) and oneDNN (3918.9s) versions.

Using the wngt19 model from regression tests.

Setup
relative-paths: true
models:
  - wngt19/model.base.npz
vocabs:
  - wngt19/en-de.spm
  - wngt19/en-de.spm
normalize: 0.6
beam-size: 1
mini-batch: 128
maxi-batch: 100
maxi-batch-sort: src
cpu-threads: 16

Ran #cpu tagged regression tests. Non-intgemm tests pass.

Regression test results
Skipped:
- tests/models/wngt19/test_model_base_fbgemm_packed16.sh
- tests/models/wngt19/test_model_base_fbgemm_packed8.sh
- tests/server/test_ende_cpu.sh
Failed:
- tests/decoder/intgemm/test_intgemm_16bit.sh
- tests/decoder/intgemm/test_intgemm_16bit_avx2.sh
- tests/decoder/intgemm/test_intgemm_16bit_sse2.sh
- tests/decoder/intgemm/test_intgemm_8bit.sh
- tests/decoder/intgemm/test_intgemm_8bit_avx2.sh
- tests/decoder/intgemm/test_intgemm_8bit_ssse3.sh
Logs:
- /home/gnail/dev/marian-dev/regression-tests/tests/decoder/intgemm/test_intgemm_16bit.sh.log
- /home/gnail/dev/marian-dev/regression-tests/tests/decoder/intgemm/test_intgemm_16bit_avx2.sh.log
- /home/gnail/dev/marian-dev/regression-tests/tests/decoder/intgemm/test_intgemm_16bit_sse2.sh.log
- /home/gnail/dev/marian-dev/regression-tests/tests/decoder/intgemm/test_intgemm_8bit.sh.log
- /home/gnail/dev/marian-dev/regression-tests/tests/decoder/intgemm/test_intgemm_8bit_avx2.sh.log
- /home/gnail/dev/marian-dev/regression-tests/tests/decoder/intgemm/test_intgemm_8bit_ssse3.sh.log
---------------------
Ran 19 tests in 00:03:6.267s, 10 passed, 3 skipped, 6 failed
FAILED

The static binaries are now larger (merge #938 first for comparison).

Checklist

  • [x] I have tested the code manually
  • [x] I have run regression tests
  • [x] I have read and followed CONTRIBUTING.md
  • [x] I have updated CHANGELOG.md

graemenail avatar Jun 03 '22 15:06 graemenail