fix synchronization problem in softmax_with_cross_entropy_op, test=develop (#21480)

paddle_tiny_install
Leo Chen 6 years ago committed by GitHub
parent 01fa4ead61
commit b3090ad406
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -200,6 +200,10 @@ static __global__ void RowReductionForDiffMaxSum(const T* logits_data,
softmax[beg_idx] -= diff_max_sum;
beg_idx += step;
}
// Note(zhiqiu): since different threads may use max_data[blockIdx.x] to
// calculate diff_max_sum, __syncthreads() is needed here.
__syncthreads();
if (threadIdx.x == 0) max_data[blockIdx.x] = 0;
}

Loading…
Cancel
Save