Closed huningxin closed 1 year ago
Please hold the review of this PR. There is on-going discussion at Chromium side that may not need this PR. I'll update once the design is finalized. Thanks!
With Chromium CL-4608520 merged, there are no required changes of pthreadpool. I am closing this issue. Thanks!
The pthreadpool library is used by Chromium 1 for XNNPACK library which in turn supports TFLite and WebNN. Chromium has a Jobs API that is able to schedule a single worker task and request that ThreadPool workers invoke it in parallel 2.
This PR introduces changes wrapped by the
PTHREADPOOL_USE_JOBS
macro that support the integration with Chromium's Jobs API. In particular, this PR uses Chromium'sbase::Lock
basedexecution_lock
forpthreadpool
struct. This lock will be used by Chromium's implementation ofpthreadpool_parallelize()
to serialize concurrent calls from different threads. Chromium's implementation ofpthreadpool_parallelize()
3 is submitted to Chromium's repo and uses Jobs API to schedule parallel tasks with Chromium's ThreadPool workers.To allow running pthreadpool unit tests with Chromium's Jobs API integration, this PR also introduces
PthreadPoolTestBase
as the base class of all test cases which sets up the test environment for Chromium's ThreadPool testing.@Maratyszcza , PTAL, thanks!