aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/contrib/quantization
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2016-08-09 11:50:58 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2016-08-09 13:03:33 -0700
commit302462edd090611a793bfe20ad43fb4dc1dc718d (patch)
tree7c84f5f1aab3d1b6b43a0d8b8864cc89af0f753e /tensorflow/contrib/quantization
parentd8433ed84ef7e47b25edfcde9e39c2a4ac3f8e05 (diff)
Fix race in tensorflow's use of gemmlowp contexts.
Change: 129782045
Diffstat (limited to 'tensorflow/contrib/quantization')
-rw-r--r--tensorflow/contrib/quantization/kernels/quantization_utils.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/tensorflow/contrib/quantization/kernels/quantization_utils.h b/tensorflow/contrib/quantization/kernels/quantization_utils.h
index 45fda79ce5..3b6a4901ba 100644
--- a/tensorflow/contrib/quantization/kernels/quantization_utils.h
+++ b/tensorflow/contrib/quantization/kernels/quantization_utils.h
@@ -496,6 +496,13 @@ class TensorflowGemmlowpWorkersPool {
TensorflowGemmlowpWorkersPool(thread::ThreadPool* workers)
: workers_(workers) {}
+ ~TensorflowGemmlowpWorkersPool() {
+ // This workaround ensures that all worker tasks have exited methods in the
+ // BlockingCounter. Without this, there is a race where the context is torn
+ // down while the counter is in use.
+ counter_to_decrement_when_ready_.Reset(0);
+ }
+
void Prepare(int workers_count) {
counter_to_decrement_when_ready_.Reset(workers_count);
}