Guard concurrent scratch_buffer and gemmlowp::GemmContext access
- scrach_buffer is a file scoped static intended to minimize the
allocation cost for Conv2D computations when possible.
- In order to make it thread safe for multi-threaded execution,
we need to make sure no concucrrent access to it.
- Similarly for gemmlowp::GemmContext used in Conv2D and
FullyConnected.
- The mutex lock is added to prevent concurrent executions that may
access the static scratch buffer and static gemmlowp::GemmContext.
Bug: 80430825
Bug: 80465406
Test: NeuralNetworksTest_mt_static
Test: NeuralNetworksApiBenchmark no visible performance impact
Merged-In: I6b0df63a03d1f16a1e43a0c1062a997bfbe8f3f2
Change-Id: I6b0df63a03d1f16a1e43a0c1062a997bfbe8f3f2
(cherry picked from commit 9c63a9c428e5489bc8d118f52687a12206967208)
2 files changed