Move blasLt SetBiasPointer call inside mutex lock

- This was not thread-safe before.
This commit is contained in:
Ben Barsdell 2020-10-20 12:39:47 +11:00
parent 0d71ed6157
commit 7b477b8752

View File

@ -3493,13 +3493,6 @@ bool CUDABlas::DoBlasLtMatmulInternal(
"epilogue for the given bias pointer.";
return false;
}
if (bias != nullptr) {
if (!cuda_plan.SetBiasPointer(bias.opaque())) {
VLOG(2) << "DoBlasLtMatmul returning false because setting the bias "
"pointer failed.";
return false;
}
}
const void *alpha_ptr = alpha.is_pointer() ? alpha.opaque_pointer().opaque()
: alpha.opaque_value();
const void *beta_ptr =
@ -3524,6 +3517,14 @@ bool CUDABlas::DoBlasLtMatmulInternal(
absl::MutexLock lock(&mu_);
if (bias != nullptr) {
if (!cuda_plan.SetBiasPointer(bias.opaque())) {
VLOG(2) << "DoBlasLtMatmul returning false because setting the bias "
"pointer failed.";
return false;
}
}
CHECK(blasLt_ != nullptr);
gpu::ScopedActivateExecutorContext sac{parent_};