-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pthreadpool: Integrate with Jobs API
pthreadpool is used by XNNPACK which in turns supports TFLite and WebNN to execute each neural network operator of a model by multiple threads in parallel. To avoid creating an unmanaged thread pool owned by pthreadpool implementation, this CL implements a shim of `pthreadpool_parallelize()` that maps the pthreadpool thread tasks to work items and uses Jobs API (`base::PostJob`) to schedule these work items with Chromium's `base::ThreadPool` workers. According to the test result on a multi-core device, when scheduling 4 work items with `base::ThreadPool`, XNNPACK model inference performance could get ~1.9X speedup for MobileNet V2 and ~2.8X speedup for ResNet50 V2 compared to single thread execution. And the test result also shows using Jobs API shim could achieve 85% and 97% performance of using pthreadpool own thread pool implementation for MobileNet V2 and ResNet50 V2 respectively. This CL also enables pthreadpool_unittests with Jobs API integration on Windows and Linux bots that aligns with the `build_tflite_with_xnnpack` build flag. Bug: 1228275,1273291 Change-Id: I1152d1e93885399b453c87be18a432e6c118054e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4467727 Reviewed-by: danakj <danakj@chromium.org> Commit-Queue: ningxin hu <ningxin.hu@intel.com> Reviewed-by: Brian Sheedy <bsheedy@chromium.org> Reviewed-by: Robert Ogden <robertogden@chromium.org> Reviewed-by: Sami Kyöstilä <skyostil@chromium.org> Reviewed-by: Austin Sullivan <asully@chromium.org> Cr-Commit-Position: refs/heads/main@{#1150206}
- Loading branch information
Showing
20 changed files
with
1,422 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.