Reland "Reland "Reland "pthreadpool: Integrate with Jobs API"""

This is a reland of commit bbef2b40c9e20a4c8ad121ddac95abe6347389f9

This reland fixes pthreadpool cfi-call check failures in XNNPACK tests,
such as [1]. The root cause is XNNPACK casts function pointer with
incorrect signature, such as `xnn_compute_igemm` [2], to pthreadpool
task function type, such as `pthreadpool_task_2d_tile_2d_t` [3]. This
reland fixes this issue by listing related pthreadpool files in the
tools/cfi/ignores.txt instead of disabling cfi-icall build config for
pthreadpool. This fix would allow pthreadpool_unittests still be checked
by `base::PostJob` for cfi enabled build.

[1]: https://ci.chromium.org/ui/p/chromium/builders/ci/Linux%20CFI/25375/test-results?sortby=&groupby=
[2]: https://source.chromium.org/chromium/chromium/src/+/main:third_party/xnnpack/src/src/operator-run.c;l=462
[3]: https://source.chromium.org/chromium/chromium/src/+/refs/heads/main:third_party/pthreadpool/src/include/pthreadpool.h;l=13

Original change's description:
> Reland "Reland "pthreadpool: Integrate with Jobs API""
>
> This is a reland of commit 9fd417a399dfb28ace5add2fa7df714f70de5bb6
>
> The pthreadpoool library is built with "sanitizers:cfi_icall_disable"
> config that would cause pthreadpool_unittests failure on the Linux CFI
> bot, such as [1]. This reland enables the cfi-icall sanitizer flag by
> removing this config. It also fixes a pointer cast issue in
> pthreadpool_unittests.
>
> [1]: https://ci.chromium.org/ui/p/chromium/builders/ci/Linux%20CFI/25348/overview
>
> Original change's description:
> > Reland "pthreadpool: Integrate with Jobs API"
> >
> > This is a reland of commit e29465230b2f97fc64d51395bf9353e2ab266570
> >
> > This reland fixes the build issue on win-arm64 bots, such as [1], by
> > declaring the missing arm64 intrinsics if the arm64intr.h is not
> > included correctly due to LLVM issue [2]. Once the LLVM issue is
> > resolved, this work-around should be removed.
> >
> > [1]: https://ci.chromium.org/b/8779781271284246545
> > [2]: https://github.com/llvm/llvm-project/issues/62942
> >
> > Original change's description:
> > > 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}
> >
> > Bug: 1228275,1273291
> > Change-Id: Icab18064790a70164e47b52939add5774bf49ec7
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4571505
> > Commit-Queue: ningxin hu <ningxin.hu@intel.com>
> > Reviewed-by: Robert Ogden <robertogden@chromium.org>
> > Reviewed-by: danakj <danakj@chromium.org>
> > Reviewed-by: Austin Sullivan <asully@chromium.org>
> > Reviewed-by: Brian Sheedy <bsheedy@chromium.org>
> > Reviewed-by: Gabriel Charette <gab@chromium.org>
> > Reviewed-by: Nico Weber <thakis@chromium.org>
> > Cr-Commit-Position: refs/heads/main@{#1153620}
>
> Bug: 1228275,1273291
> Change-Id: Ib238c05d703c1f8ac191ea89cb353c39a90804d7
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4593640
> Reviewed-by: Gabriel Charette <gab@chromium.org>
> Reviewed-by: Robert Ogden <robertogden@chromium.org>
> Reviewed-by: Austin Sullivan <asully@chromium.org>
> Reviewed-by: Brian Sheedy <bsheedy@chromium.org>
> Commit-Queue: ningxin hu <ningxin.hu@intel.com>
> Cr-Commit-Position: refs/heads/main@{#1155813}

Bug: 1228275,1273291,1454009
Cq-Include-Trybots: luci.chromium.try:linux_chromium_cfi_rel_ng
Change-Id: I4e7912f799d49cb24f624e1ab685a615fe30ab03
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4608520
Reviewed-by: Brian Sheedy <bsheedy@chromium.org>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Reviewed-by: Robert Ogden <robertogden@chromium.org>
Commit-Queue: ningxin hu <ningxin.hu@intel.com>
Reviewed-by: Austin Sullivan <asully@chromium.org>
Reviewed-by: Peter Collingbourne <pcc@chromium.org>
Reviewed-by: Michael Crouse <mcrouse@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1160748}
NOKEYCHECK=True
GitOrigin-RevId: 430f0b48b46930c2689342632e8a7c5efd26eadf
1 file changed
tree: 50cc1ae0f6d926be325746282aa426d0cdb8461f
  1. ignores.txt
  2. OWNERS