Skip to content

Commit

Permalink
race condition fix of using mutable_data inside OPENMP region for bat…
Browse files Browse the repository at this point in the history
…ched matmul (pytorch#15371)

Summary:
Pull Request resolved: pytorch#15371

Similar to D13387692:

Never call mutable_data from an OpenMP region!!!

Reviewed By: jspark1105

Differential Revision: D13511259

fbshipit-source-id: 100812d2a547c0a1d5018749d5fdc88162375673
  • Loading branch information
jianyuh authored and facebook-github-bot committed Dec 19, 2018
1 parent 6ca1d93 commit cd8dd49
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions caffe2/quantization/server/batch_matmul_dnnlowp_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,8 @@ bool BatchMatMulDNNLowPOp<T>::RunOnDevice() {
#endif

if (!dequantize_output_) {
auto Y_data = Y->template mutable_data<T>();

auto row_offset_len_per_thread =
PackAWithRowOffset<uint8_t>::rowOffsetBufferSize();
row_offsets_.resize(
Expand Down Expand Up @@ -463,8 +465,7 @@ bool BatchMatMulDNNLowPOp<T>::RunOnDevice() {
fbgemmPacked(
packA,
*Bq_packed_[B_batch_idx],
reinterpret_cast<uint8_t*>(Y->template mutable_data<T>()) +
p * Y_stride + i * M * N,
reinterpret_cast<uint8_t*>(Y_data) + p * Y_stride + i * M * N,
Y_int32_.data() + p * Y_stride + i * M * N,
N,
outputProcObj,
Expand Down

0 comments on commit cd8dd49

Please sign in to comment.