Make mkldnn Stream object thread_local and enable mkldnn thread-safe (#17022)
authorBoris Daskalov <boris@hyperscience.com>
Wed, 13 Feb 2019 23:30:39 +0000 (15:30 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Thu, 14 Feb 2019 00:04:53 +0000 (16:04 -0800)
commit41dddfd55fc59a0ebae7cda7e759b80011741a78
tree2cdeb68786edcc502e46fe7010d6558fba7d2a45
parent491f2d4cb86da3cfaf908f538be20889e64bb4fa
Make mkldnn Stream object thread_local and enable mkldnn thread-safe (#17022)

Summary:
This PR fixes following issue: https://github.com/pytorch/pytorch/issues/16828

It is a combination of two things:
1) MKLDNN streams are not thread-safe but are currently shared between different threads. This change makes them thread_local
2) By default MKLDNN primitives can share global memory and can't be invoked from multiple threads. This PR enables the MKLDNN_ENABLE_CONCURRENT_EXEC cmake configuration option that makes them thread-safe.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/17022

Differential Revision: D14069052

Pulled By: ezyang

fbshipit-source-id: f8f7fcb86c40f5d751fb35dfccc2f802b6e137c6
aten/src/ATen/mkldnn/Runtime.h
tools/build_pytorch_libs.py