Repository: pytorch
Issue: TSAN failure related to mkldnn
Labels: oncall: jit,triaged,module: mkldnn

## 🐛 Bug

When running tsan on test/cpp/jit:jit -- 'JitTest\.LiteInterpreterConv', there's failure because of data race. 

## To Reproduce

Steps to reproduce the behavior:

FB internal build

The output trace is below: 

```
> WARNING: ThreadSanitizer: data race (pid=3218388)
>   Write of size 8 at 0x7bbc0000a210 by thread T15:
>     #0 memset <...> (jit+0xb669b):17 (libmkldnn.so+0x1d38bd):10 (libmkldnn.so+0x1d38bd):15 (libmkldnn.so+0x1d38bd)
> 
>   Previous write of size 8 at 0x7bbc0000a210 by main thread:
>     #0 posix_memalign <...> (jit+0xa325b)
>     #1 c10::alloc_cpu(unsigned long) caffe2/c10/core/CPUAllocator.cpp:55 (libcaffe2_c10_c10.so+0x21088)
>     #2 c10::DefaultCPUAllocator::allocate(unsigned long) const caffe2/c10/core/CPUAllocator.cpp:115 (libcaffe2_c10_c10.so+0x22692)
>     #3 c10::Allocator::raw_allocate(unsigned long) caffe2/c10/core/Allocator.h:161 (libcaffe2_aten_ATen-cpu.so+0x35cf15)
>     #4 at::native::AllocForMKLDNN::malloc(unsigned long) caffe2/aten/src/ATen/native/mkldnn/MKLDNNCommon.h:15 (libcaffe2_aten_ATen-cpu.so+0x35bf39) (libcaffe2_aten_ATen-cpu.so+0x35bd12) (libcaffe2_aten_ATen-cpu.so+0x38dc5c) (libcaffe2_aten_ATen-cpu.so+0x35b3fc) (libcaffe2_aten_ATen-cpu.so+0x5e22f6) (libcaffe2_aten_ATen-cpu.so+0x5dfb4a) (libcaffe2_aten_ATen-cpu.so+0x5c7539)
>     #11 at::native::_mkldnn_conv2d(ideep::tensor const&, ideep::tensor const&, c10::optional<...> const&, c10::ArrayRef<...>, c10::ArrayRef<...>, c10::ArrayRef<...>, long) caffe2/aten/src/ATen/native/mkldnn/Conv.cpp:89 (libcaffe2_aten_ATen-cpu.so+0x5c5fe6)
>     #12 at::native::mkldnn_convolution(at::Tensor const&, at::Tensor const&, at::Tensor const&, c10::ArrayRef<...>, c10::ArrayRef<...>, c10::ArrayRef<...>, long) caffe2/aten/src/ATen/native/mkldnn/Conv.cpp:136 (libcaffe2_aten_ATen-cpu.so+0x5c7d44)
>     #13 at::TypeDefault::mkldnn_convolution(at::Tensor const&, at::Tensor const&, at::Tensor const&, c10::ArrayRef<...>, c10::ArrayRef<...>, c10::ArrayRef<...>, long) buck-out/dev/gen/caffe2/aten/gen_aten=TypeDefault.cpp/TypeDefault.cpp:2683 (libcaffe2_aten_ATen-cpu.so+0x1d4db7e)
>     #14 at::Tensor at::ATenOpTable::callUnboxed<...>(at::Tensor const&, at::Tensor const&, at::Tensor const&, c10::ArrayRef<...>, c10::ArrayRef<...>, c10::ArrayRef<...>, long) const caffe2/aten/src/ATen/core/ATenDispatch.h:242 (libcaffe2_libtorch.so+0x750661)
>     #15 at::mkldnn_convolution(at::Tensor const&, at::Tensor const&, at::Tensor const&, c10::ArrayRef<...>, c10::ArrayRef<...>, c10::ArrayRef<...>, long) buck-out/dev/gen/caffe2/aten/generated-aten-headers-cpu#header-mode-symlink-tree-with-header-map,headers/ATen/Functions.h:5702 (libcaffe2_libtorch.so+0x750080)
>     #16 torch::autograd::VariableType::(anonymous namespace)::mkldnn_convolution(at::Tensor const&, at::Tensor const&, at::Tensor const&, c10::ArrayRef<...>, c10::ArrayRef<...>, c10::ArrayRef<...>, long)::$_70::operator()() const buck-out/dev/gen/caffe2/generate-code=VariableType_0.cpp/VariableType_0.cpp:7731 (libcaffe2_libtorch.so+0x74ea91)
>     #17 torch::autograd::VariableType::(anonymous namespace)::mkldnn_convolution(at::Tensor const&, at::Tensor const&, at::Tensor const&, c10::ArrayRef<...>, c10::ArrayRef<...>, c10::ArrayRef<...>, long) buck-out/dev/gen/caffe2/generate-code=VariableType_0.cpp/VariableType_0.cpp:7729 (libcaffe2_libtorch.so+0x74d161)
>     #18 at::Tensor at::ATenOpTable::callUnboxed<...>(at::Tensor const&, at::Tensor const&, at::Tensor const&, c10::ArrayRef<...>, c10::ArrayRef<...>, c10::ArrayRef<...>, long) const caffe2/aten/src/ATen/core/ATenDispatch.h:219 (libcaffe2_aten_ATen-cpu.so+0x624c94)
>     #19 at::mkldnn_convolution(at::Tensor const&, at::Tensor const&, at::Tensor const&, c10::ArrayRef<...>, c10::ArrayRef<...>, c10::ArrayRef<...>, long) buck-out/dev/gen/caffe2/aten/generated-aten-headers-cpu#header-mode-symlink-tree-with-header-map,headers/ATen/Functions.h:5702 (libcaffe2_aten_ATen-cpu.so+0x60d9a6)
>     #20 at::native::_convolution(at::Tensor const&, at::Tensor const&, at::Tensor const&, c10::ArrayRef<...>, c10::ArrayRef<...>, c10::ArrayRef<...>, bool, c10::ArrayRef<...>, long, bool, bool, bool) caffe2/aten/src/ATen/native/Convolution.cpp:640 (libcaffe2_aten_ATen-cpu.so+0x607491)
>     #21 at::TypeDefault::_convolution(at::Tensor const&, at::Tensor const&, at::Tensor const&, c10::ArrayRef<...>, c10::ArrayRef<...>, c10::ArrayRef<...>, bool, c10::ArrayRef<...>, long, bool, bool, bool) buck-out/dev/gen/caffe2/aten/gen_aten=TypeDefault.cpp/TypeDefault.cpp:1118 (libcaffe2_aten_ATen-cpu.so+0x1d35dab)
>     #22 torch::autograd::VariableType::(anonymous namespace)::_convolution(at::Tensor const&, at::Tensor const&, at::Tensor const&, c10::ArrayRef<...>, c10::ArrayRef<...>, c10::ArrayRef<...>, bool, c10::ArrayRef<...>, long, bool, bool, bool) buck-out/dev/gen/caffe2/generate-code=VariableType_1.cpp/VariableType_1.cpp:696 (libcaffe2_libtorch.so+0x8de2fb)
>     #23 at::Tensor at::ATenOpTable::callUnboxed<...>(at::Tensor const&, at::Tensor const&, at::Tensor const&, c10::ArrayRef<...>, c10::ArrayRef<...>, c10::ArrayRef<...>, bool, c10::ArrayRef<...>, long, bool, bool, bool) const caffe2/aten/src/ATen/core/ATenDispatch.h:219 (libcaffe2_libtorch.so+0x1771e38)
>     #24 at::_convolution(at::Tensor const&, at::Tensor const&, at::Tensor const&, c10::ArrayRef<...>, c10::ArrayRef<...>, c10::ArrayRef<...>, bool, c10::ArrayRef<...>, long, bool, bool, bool) buck-out/dev/gen/caffe2/aten/generated-aten-headers-cpu#header-mode-symlink-tree-with-header-map,headers/ATen/Functions.h:2858 (libcaffe2_libtorch.so+0x196702f)
>     #25 $_2::operator()(at::Tensor, at::Tensor, c10::optional<...>, std::vector<...>, std::vector<...>, std::vector<...>, bool, std::vector<...>, long, bool, bool, bool) const caffe2/torch/csrc/jit/mobile/register_mobile_ops.cpp:33 (libcaffe2_libtorch.so+0x1966b77)
>     #26 c10::detail::WrapRuntimeKernelFunctor_<...>::operator()(at::Tensor, at::Tensor, c10::optional<...>, std::vector<...>, std::vector<...>, std::vector<...>, bool, std::vector<...>, long, bool, bool, bool) caffe2/aten/src/ATen/core/boxing/kernel_lambda.h:23 (libcaffe2_libtorch.so+0x19667b3)
>     #27 c10::guts::infer_function_traits<...>::type::return_type c10::detail::call_functor_with_args_from_stack_<...>(c10::detail::WrapRuntimeKernelFunctor_<...>*, std::vector<...>*, std::integer_sequence<...>) caffe2/aten/src/ATen/core/boxing/kernel_functor.h:194 (libcaffe2_libtorch.so+0x1966257)
>     #28 c10::guts::infer_function_traits<...>::type::return_type c10::detail::call_functor_with_args_from_stack<...>(c10::detail::WrapRuntimeKernelFunctor_<...>*, std::vector<...>*) caffe2/aten/src/ATen/core/boxing/kernel_functor.h:202 (libcaffe2_libtorch.so+0x1965e5f)
>     #29 c10::detail::wrap_kernel_functor_boxed<...>::call(c10::OperatorKernel*, std::vector<...>*) caffe2/aten/src/ATen/core/boxing/kernel_functor.h:234 (libcaffe2_libtorch.so+0x196586c)
>     #30 c10::KernelFunction::callBoxed(std::vector<...>*) const caffe2/aten/src/ATen/core/boxing/KernelFunction.h:65 (libcaffe2_libtorch.so+0x15d5e25)
>     #31 c10::impl::OperatorEntry::callBoxed(std::vector<...>*) const::'lambda'(c10::DispatchTable const&)::operator()(c10::DispatchTable const&) const caffe2/aten/src/ATen/core/dispatch/OperatorEntry.h:74 (libcaffe2_libtorch.so+0x15d59f8)
>     #32 std::result_of<...>::type c10::LeftRight<...>::read<...>(c10::impl::OperatorEntry::callBoxed(std::vector<...>*) const::'lambda'(c10::DispatchTable const&)&&) const caffe2/c10/util/LeftRight.h:74 (libcaffe2_libtorch.so+0x15d591d)
>     #33 c10::impl::OperatorEntry::callBoxed(std::vector<...>*) const caffe2/aten/src/ATen/core/dispatch/OperatorEntry.h:73 (libcaffe2_libtorch.so+0x15d55aa)
>     #34 c10::Dispatcher::callBoxed(c10::OperatorHandle const&, std::vector<...>*) const caffe2/aten/src/ATen/core/dispatch/Dispatcher.h:181 (libcaffe2_libtorch.so+0x15d4fec)
>     #35 torch::jit::mobile::InterpreterState::run(std::vector<...>&) caffe2/torch/csrc/jit/mobile/interpreter.cpp:40 (libcaffe2_libtorch.so+0x15d436d)
>     #36 torch::jit::mobile::Function::run(std::vector<...>&) const caffe2/torch/csrc/jit/mobile/function.cpp:89 (libcaffe2_libtorch.so+0x14e1906)
>     #37 torch::jit::mobile::Module::run_method(std::__cxx11::basic_string<...> const&, std::vector<...>&) caffe2/torch/csrc/jit/mobile/module.cpp:25 (libcaffe2_libtorch.so+0x167695f)
>     #38 torch::jit::testLiteInterpreterConv() caffe2/test/cpp/jit/test_lite_interpreter.cpp:67 (libcaffe2_test_cpp_jit_test_lib.so+0x1d5527)
>     #39 torch::jit::JitTest_LiteInterpreterConv_Test::TestBody() caffe2/test/cpp/jit/gtest.cpp:12 (jit+0x58f24):29 (libgtest.so+0x3a3de)
>     #41 main caffe2/test/cpp/common/main.cpp:31 (libcaffe2_test_cpp_common_main.so+0x2f5b)
> 
>   Location is heap block of size 55296 at 0x7bbc00000000 allocated by main thread:
>     #0 posix_memalign <...> (jit+0xa325b)
>     #1 c10::alloc_cpu(unsigned long) caffe2/c10/core/CPUAllocator.cpp:55 (libcaffe2_c10_c10.so+0x21088)
>     #2 c10::DefaultCPUAllocator::allocate(unsigned long) const caffe2/c10/core/CPUAllocator.cpp:115 (libcaffe2_c10_c10.so+0x22692)
>     #3 c10::Allocator::raw_allocate(unsigned long) caffe2/c10/core/Allocator.h:161 (libcaffe2_aten_ATen-cpu.so+0x35cf15)
>     #4 at::native::AllocForMKLDNN::malloc(unsigned long) caffe2/aten/src/ATen/native/mkldnn/MKLDNNCommon.h:15 (libcaffe2_aten_ATen-cpu.so+0x35bf39) (libcaffe2_aten_ATen-cpu.so+0x35bd12) (libcaffe2_aten_ATen-cpu.so+0x38dc5c) (libcaffe2_aten_ATen-cpu.so+0x35b3fc) (libcaffe2_aten_ATen-cpu.so+0x5e22f6) (libcaffe2_aten_ATen-cpu.so+0x5dfb4a) (libcaffe2_aten_ATen-cpu.so+0x5c7539)
>     #11 at::native::_mkldnn_conv2d(ideep::tensor const&, ideep::tensor const&, c10::optional<...> const&, c10::ArrayRef<...>, c10::ArrayRef<...>, c10::ArrayRef<...>, long) caffe2/aten/src/ATen/native/mkldnn/Conv.cpp:89 (libcaffe2_aten_ATen-cpu.so+0x5c5fe6)
>     #12 at::native::mkldnn_convolution(at::Tensor const&, at::Tensor const&, at::Tensor const&, c10::ArrayRef<...>, c10::ArrayRef<...>, c10::ArrayRef<...>, long) caffe2/aten/src/ATen/native/mkldnn/Conv.cpp:136 (libcaffe2_aten_ATen-cpu.so+0x5c7d44)
>     #13 at::TypeDefault::mkldnn_convolution(at::Tensor const&, at::Tensor const&, at::Tensor const&, c10::ArrayRef<...>, c10::ArrayRef<...>, c10::ArrayRef<...>, long) buck-out/dev/gen/caffe2/aten/gen_aten=TypeDefault.cpp/TypeDefault.cpp:2683 (libcaffe2_aten_ATen-cpu.so+0x1d4db7e)
>     #14 at::Tensor at::ATenOpTable::callUnboxed<...>(at::Tensor const&, at::Tensor const&, at::Tensor const&, c10::ArrayRef<...>, c10::ArrayRef<...>, c10::ArrayRef<...>, long) const caffe2/aten/src/ATen/core/ATenDispatch.h:242 (libcaffe2_libtorch.so+0x750661)
>     #15 at::mkldnn_convolution(at::Tensor const&, at::Tensor const&, at::Tensor const&, c10::ArrayRef<...>, c10::ArrayRef<...>, c10::ArrayRef<...>, long) buck-out/dev/gen/caffe2/aten/generated-aten-headers-cpu#header-mode-symlink-tree-with-header-map,headers/ATen/Functions.h:5702 (libcaffe2_libtorch.so+0x750080)
>     #16 torch::autograd::VariableType::(anonymous namespace)::mkldnn_convolution(at::Tensor const&, at::Tensor const&, at::Tensor const&, c10::ArrayRef<...>, c10::ArrayRef<...>, c10::ArrayRef<...>, long)::$_70::operator()() const buck-out/dev/gen/caffe2/generate-code=VariableType_0.cpp/VariableType_0.cpp:7731 (libcaffe2_libtorch.so+0x74ea91)
>     #17 torch::autograd::VariableType::(anonymous namespace)::mkldnn_convolution(at::Tensor const&, at::Tensor const&, at::Tensor const&, c10::ArrayRef<...>, c10::ArrayRef<...>, c10::ArrayRef<...>, long) buck-out/dev/gen/caffe2/generate-code=VariableType_0.cpp/VariableType_0.cpp:7729 (libcaffe2_libtorch.so+0x74d161)
>     #18 at::Tensor at::ATenOpTable::callUnboxed<...>(at::Tensor const&, at::Tensor const&, at::Tensor const&, c10::ArrayRef<...>, c10::ArrayRef<...>, c10::ArrayRef<...>, long) const caffe2/aten/src/ATen/core/ATenDispatch.h:219 (libcaffe2_aten_ATen-cpu.so+0x624c94)
>     #19 at::mkldnn_convolution(at::Tensor const&, at::Tensor const&, at::Tensor const&, c10::ArrayRef<...>, c10::ArrayRef<...>, c10::ArrayRef<...>, long) buck-out/dev/gen/caffe2/aten/generated-aten-headers-cpu#header-mode-symlink-tree-with-header-map,headers/ATen/Functions.h:5702 (libcaffe2_aten_ATen-cpu.so+0x60d9a6)
>     #20 at::native::_convolution(at::Tensor const&, at::Tensor const&, at::Tensor const&, c10::ArrayRef<...>, c10::ArrayRef<...>, c10::ArrayRef<...>, bool, c10::ArrayRef<...>, long, bool, bool, bool) caffe2/aten/src/ATen/native/Convolution.cpp:640 (libcaffe2_aten_ATen-cpu.so+0x607491)
>     #21 at::TypeDefault::_convolution(at::Tensor const&, at::Tensor const&, at::Tensor const&, c10::ArrayRef<...>, c10::ArrayRef<...>, c10::ArrayRef<...>, bool, c10::ArrayRef<...>, long, bool, bool, bool) buck-out/dev/gen/caffe2/aten/gen_aten=TypeDefault.cpp/TypeDefault.cpp:1118 (libcaffe2_aten_ATen-cpu.so+0x1d35dab)
>     #22 torch::autograd::VariableType::(anonymous namespace)::_convolution(at::Tensor const&, at::Tensor const&, at::Tensor const&, c10::ArrayRef<...>, c10::ArrayRef<...>, c10::ArrayRef<...>, bool, c10::ArrayRef<...>, long, bool, bool, bool) buck-out/dev/gen/caffe2/generate-code=VariableType_1.cpp/VariableType_1.cpp:696 (libcaffe2_libtorch.so+0x8de2fb)
>     #23 at::Tensor at::ATenOpTable::callUnboxed<...>(at::Tensor const&, at::Tensor const&, at::Tensor const&, c10::ArrayRef<...>, c10::ArrayRef<...>, c10::ArrayRef<...>, bool, c10::ArrayRef<...>, long, bool, bool, bool) const caffe2/aten/src/ATen/core/ATenDispatch.h:219 (libcaffe2_libtorch.so+0x1771e38)
>     #24 at::_convolution(at::Tensor const&, at::Tensor const&, at::Tensor const&, c10::ArrayRef<...>, c10::ArrayRef<...>, c10::ArrayRef<...>, bool, c10::ArrayRef<...>, long, bool, bool, bool) buck-out/dev/gen/caffe2/aten/generated-aten-headers-cpu#header-mode-symlink-tree-with-header-map,headers/ATen/Functions.h:2858 (libcaffe2_libtorch.so+0x196702f)
>     #25 $_2::operator()(at::Tensor, at::Tensor, c10::optional<...>, std::vector<...>, std::vector<...>, std::vector<...>, bool, std::vector<...>, long, bool, bool, bool) const caffe2/torch/csrc/jit/mobile/register_mobile_ops.cpp:33 (libcaffe2_libtorch.so+0x1966b77)
>     #26 c10::detail::WrapRuntimeKernelFunctor_<...>::operator()(at::Tensor, at::Tensor, c10::optional<...>, std::vector<...>, std::vector<...>, std::vector<...>, bool, std::vector<...>, long, bool, bool, bool) caffe2/aten/src/ATen/core/boxing/kernel_lambda.h:23 (libcaffe2_libtorch.so+0x19667b3)
>     #27 c10::guts::infer_function_traits<...>::type::return_type c10::detail::call_functor_with_args_from_stack_<...>(c10::detail::WrapRuntimeKernelFunctor_<...>*, std::vector<...>*, std::integer_sequence<...>) caffe2/aten/src/ATen/core/boxing/kernel_functor.h:194 (libcaffe2_libtorch.so+0x1966257)
>     #28 c10::guts::infer_function_traits<...>::type::return_type c10::detail::call_functor_with_args_from_stack<...>(c10::detail::WrapRuntimeKernelFunctor_<...>*, std::vector<...>*) caffe2/aten/src/ATen/core/boxing/kernel_functor.h:202 (libcaffe2_libtorch.so+0x1965e5f)
>     #29 c10::detail::wrap_kernel_functor_boxed<...>::call(c10::OperatorKernel*, std::vector<...>*) caffe2/aten/src/ATen/core/boxing/kernel_functor.h:234 (libcaffe2_libtorch.so+0x196586c)
>     #30 c10::KernelFunction::callBoxed(std::vector<...>*) const caffe2/aten/src/ATen/core/boxing/KernelFunction.h:65 (libcaffe2_libtorch.so+0x15d5e25)
>     #31 c10::impl::OperatorEntry::callBoxed(std::vector<...>*) const::'lambda'(c10::DispatchTable const&)::operator()(c10::DispatchTable const&) const caffe2/aten/src/ATen/core/dispatch/OperatorEntry.h:74 (libcaffe2_libtorch.so+0x15d59f8)
>     #32 std::result_of<...>::type c10::LeftRight<...>::read<...>(c10::impl::OperatorEntry::callBoxed(std::vector<...>*) const::'lambda'(c10::DispatchTable const&)&&) const caffe2/c10/util/LeftRight.h:74 (libcaffe2_libtorch.so+0x15d591d)
>     #33 c10::impl::OperatorEntry::callBoxed(std::vector<...>*) const caffe2/aten/src/ATen/core/dispatch/OperatorEntry.h:73 (libcaffe2_libtorch.so+0x15d55aa)
>     #34 c10::Dispatcher::callBoxed(c10::OperatorHandle const&, std::vector<...>*) const caffe2/aten/src/ATen/core/dispatch/Dispatcher.h:181 (libcaffe2_libtorch.so+0x15d4fec)
>     #35 torch::jit::mobile::InterpreterState::run(std::vector<...>&) caffe2/torch/csrc/jit/mobile/interpreter.cpp:40 (libcaffe2_libtorch.so+0x15d436d)
>     #36 torch::jit::mobile::Function::run(std::vector<...>&) const caffe2/torch/csrc/jit/mobile/function.cpp:89 (libcaffe2_libtorch.so+0x14e1906)
>     #37 torch::jit::mobile::Module::run_method(std::__cxx11::basic_string<...> const&, std::vector<...>&) caffe2/torch/csrc/jit/mobile/module.cpp:25 (libcaffe2_libtorch.so+0x167695f)
>     #38 torch::jit::testLiteInterpreterConv() caffe2/test/cpp/jit/test_lite_interpreter.cpp:67 (libcaffe2_test_cpp_jit_test_lib.so+0x1d5527)
>     #39 torch::jit::JitTest_LiteInterpreterConv_Test::TestBody() caffe2/test/cpp/jit/gtest.cpp:12 (jit+0x58f24):29 (libgtest.so+0x3a3de)
>     #41 main caffe2/test/cpp/common/main.cpp:31 (libcaffe2_test_cpp_common_main.so+0x2f5b)
> 
>   Thread T15 (tid=3219390, running) created by main thread at:
>     #0 pthread_create <...> (jit+0x90b56):13 (libgomp.so.1+0x17bd6) (libcaffe2_aten_ATen-cpu.so+0x5f5326) (libcaffe2_aten_ATen-cpu.so+0x5f51ec) (libcaffe2_aten_ATen-cpu.so+0x5ec131) (libcaffe2_aten_ATen-cpu.so+0x5e2155) (libcaffe2_aten_ATen-cpu.so+0x5dfb4a) (libcaffe2_aten_ATen-cpu.so+0x5c7539)
>     #8 at::native::_mkldnn_conv2d(ideep::tensor const&, ideep::tensor const&, c10::optional<...> const&, c10::ArrayRef<...>, c10::ArrayRef<...>, c10::ArrayRef<...>, long) caffe2/aten/src/ATen/native/mkldnn/Conv.cpp:89 (libcaffe2_aten_ATen-cpu.so+0x5c5fe6)
>     #9 at::native::mkldnn_convolution(at::Tensor const&, at::Tensor const&, at::Tensor const&, c10::ArrayRef<...>, c10::ArrayRef<...>, c10::ArrayRef<...>, long) caffe2/aten/src/ATen/native/mkldnn/Conv.cpp:136 (libcaffe2_aten_ATen-cpu.so+0x5c7d44)
>     #10 at::TypeDefault::mkldnn_convolution(at::Tensor const&, at::Tensor const&, at::Tensor const&, c10::ArrayRef<...>, c10::ArrayRef<...>, c10::ArrayRef<...>, long) buck-out/dev/gen/caffe2/aten/gen_aten=TypeDefault.cpp/TypeDefault.cpp:2683 (libcaffe2_aten_ATen-cpu.so+0x1d4db7e)
>     #11 at::Tensor at::ATenOpTable::callUnboxed<...>(at::Tensor const&, at::Tensor const&, at::Tensor const&, c10::ArrayRef<...>, c10::ArrayRef<...>, c10::ArrayRef<...>, long) const caffe2/aten/src/ATen/core/ATenDispatch.h:242 (libcaffe2_libtorch.so+0x750661)
>     #12 at::mkldnn_convolution(at::Tensor const&, at::Tensor const&, at::Tensor const&, c10::ArrayRef<...>, c10::ArrayRef<...>, c10::ArrayRef<...>, long) buck-out/dev/gen/caffe2/aten/generated-aten-headers-cpu#header-mode-symlink-tree-with-header-map,headers/ATen/Functions.h:5702 (libcaffe2_libtorch.so+0x750080)
>     #13 torch::autograd::VariableType::(anonymous namespace)::mkldnn_convolution(at::Tensor const&, at::Tensor const&, at::Tensor const&, c10::ArrayRef<...>, c10::ArrayRef<...>, c10::ArrayRef<...>, long)::$_70::operator()() const buck-out/dev/gen/caffe2/generate-code=VariableType_0.cpp/VariableType_0.cpp:7731 (libcaffe2_libtorch.so+0x74ea91)
>     #14 torch::autograd::VariableType::(anonymous namespace)::mkldnn_convolution(at::Tensor const&, at::Tensor const&, at::Tensor const&, c10::ArrayRef<...>, c10::ArrayRef<...>, c10::ArrayRef<...>, long) buck-out/dev/gen/caffe2/generate-code=VariableType_0.cpp/VariableType_0.cpp:7729 (libcaffe2_libtorch.so+0x74d161)
>     #15 at::Tensor at::ATenOpTable::callUnboxed<...>(at::Tensor const&, at::Tensor const&, at::Tensor const&, c10::ArrayRef<...>, c10::ArrayRef<...>, c10::ArrayRef<...>, long) const caffe2/aten/src/ATen/core/ATenDispatch.h:219 (libcaffe2_aten_ATen-cpu.so+0x624c94)
>     #16 at::mkldnn_convolution(at::Tensor const&, at::Tensor const&, at::Tensor const&, c10::ArrayRef<...>, c10::ArrayRef<...>, c10::ArrayRef<...>, long) buck-out/dev/gen/caffe2/aten/generated-aten-headers-cpu#header-mode-symlink-tree-with-header-map,headers/ATen/Functions.h:5702 (libcaffe2_aten_ATen-cpu.so+0x60d9a6)
>     #17 at::native::_convolution(at::Tensor const&, at::Tensor const&, at::Tensor const&, c10::ArrayRef<...>, c10::ArrayRef<...>, c10::ArrayRef<...>, bool, c10::ArrayRef<...>, long, bool, bool, bool) caffe2/aten/src/ATen/native/Convolution.cpp:640 (libcaffe2_aten_ATen-cpu.so+0x607491)
>     #18 at::TypeDefault::_convolution(at::Tensor const&, at::Tensor const&, at::Tensor const&, c10::ArrayRef<...>, c10::ArrayRef<...>, c10::ArrayRef<...>, bool, c10::ArrayRef<...>, long, bool, bool, bool) buck-out/dev/gen/caffe2/aten/gen_aten=TypeDefault.cpp/TypeDefault.cpp:1118 (libcaffe2_aten_ATen-cpu.so+0x1d35dab)
>     #19 torch::autograd::VariableType::(anonymous namespace)::_convolution(at::Tensor const&, at::Tensor const&, at::Tensor const&, c10::ArrayRef<...>, c10::ArrayRef<...>, c10::ArrayRef<...>, bool, c10::ArrayRef<...>, long, bool, bool, bool) buck-out/dev/gen/caffe2/generate-code=VariableType_1.cpp/VariableType_1.cpp:696 (libcaffe2_libtorch.so+0x8de2fb)
>     #20 at::Tensor at::ATenOpTable::callUnboxed<...>(at::Tensor const&, at::Tensor const&, at::Tensor const&, c10::ArrayRef<...>, c10::ArrayRef<...>, c10::ArrayRef<...>, bool, c10::ArrayRef<...>, long, bool, bool, bool) const caffe2/aten/src/ATen/core/ATenDispatch.h:219 (libcaffe2_libtorch.so+0x1771e38)
>     #21 at::_convolution(at::Tensor const&, at::Tensor const&, at::Tensor const&, c10::ArrayRef<...>, c10::ArrayRef<...>, c10::ArrayRef<...>, bool, c10::ArrayRef<...>, long, bool, bool, bool) buck-out/dev/gen/caffe2/aten/generated-aten-headers-cpu#header-mode-symlink-tree-with-header-map,headers/ATen/Functions.h:2858 (libcaffe2_libtorch.so+0x177189f)
>     #22 torch::jit::(anonymous namespace)::$_16::operator()(std::vector<...>&) const buck-out/dev/gen/caffe2/generate-code=register_aten_ops_0.cpp/register_aten_ops_0.cpp:368 (libcaffe2_libtorch.so+0x1771468)
>     #23 torch::jit::(anonymous namespace)::$_16::__invoke(std::vector<...>&) buck-out/dev/gen/caffe2/generate-code=register_aten_ops_0.cpp/register_aten_ops_0.cpp:363 (libcaffe2_libtorch.so+0x1771028) (libcaffe2_libtorch.so+0x176a123) (libcaffe2_libtorch.so+0x137c74a)
>     #26 torch::jit::InterpreterStateImpl::runImpl(std::vector<...>&) caffe2/torch/csrc/jit/interpreter.cpp:853 (libcaffe2_libtorch.so+0x15c68ee)
>     #27 torch::jit::InterpreterStateImpl::run(std::vector<...>&) caffe2/torch/csrc/jit/interpreter.cpp:1090 (libcaffe2_libtorch.so+0x15aa1c2)
>     #28 torch::jit::InterpreterState::run(std::vector<...>&) caffe2/torch/csrc/jit/interpreter.cpp:1148 (libcaffe2_libtorch.so+0x15aa100)
>     #29 torch::jit::GraphExecutorImplBase::run(std::vector<...>&) caffe2/torch/csrc/jit/graph_executor.cpp:480 (libcaffe2_libtorch.so+0x14f84a7)
>     #30 torch::jit::GraphExecutor::run(std::vector<...>&) caffe2/torch/csrc/jit/graph_executor.cpp:630 (libcaffe2_libtorch.so+0x14f8c80)
>     #31 torch::jit::Function::run(std::vector<...>&) caffe2/torch/csrc/jit/function.cpp:33 (libcaffe2_libtorch.so+0x14d5aba)
>     #32 torch::jit::Function::operator()(std::vector<...>, std::unordered_map<...> const&) caffe2/torch/csrc/jit/function.cpp:44 (libcaffe2_libtorch.so+0x14d5d76)
>     #33 torch::jit::script::Method::operator()(std::vector<...>, std::unordered_map<...> const&) caffe2/torch/csrc/jit/script/module.cpp:250 (libcaffe2_libtorch.so+0x1660705)
>     #34 torch::jit::script::Module::forward(std::vector<...>) caffe2/torch/csrc/jit/script/module.h:139 (libcaffe2_test_cpp_jit_test_lib.so+0x1d6910)
>     #35 torch::jit::testLiteInterpreterConv() caffe2/test/cpp/jit/test_lite_interpreter.cpp:59 (libcaffe2_test_cpp_jit_test_lib.so+0x1d5394)
>     #36 torch::jit::JitTest_LiteInterpreterConv_Test::TestBody() caffe2/test/cpp/jit/gtest.cpp:12 (jit+0x58f24):29 (libgtest.so+0x3a3de)
>     #38 main caffe2/test/cpp/common/main.cpp:31 (libcaffe2_test_cpp_common_main.so+0x2f5b)
> 
> SUMMARY: ThreadSanitizer: data race (/data/users/myuan/fbsource/fbcode/buck-out/dev/gen/caffe2/test/cpp/jit/jit+0xb669b) in memset
```

cc @suo @gujinghui @PenghuiCheng @XiaobingSuper @jianyuh