[Docs] Add notice about pthread sync fallbacks (#24618)
The generic platform with IREE_ENABLE_THREADING OFF requires pthread
types/functions:
`pthread_once_t` / `pthread_once`
`pthread_mutex_t` / `pthread_mutex_*`
`pthread_cond_t` / `pthread_cond_*`
Added a notice in the bare metal runtime documentation about the
dependency.
relates to #24604
---------
Signed-off-by: Mike Interlandi <43190101+Minterl@users.noreply.github.com>
Co-authored-by: Tobias Fuchs <9053039+devtbi@users.noreply.github.com>
diff --git a/docs/website/docs/guides/deployment-configurations/bare-metal.md b/docs/website/docs/guides/deployment-configurations/bare-metal.md
index 35e3f84..af7d03f 100644
--- a/docs/website/docs/guides/deployment-configurations/bare-metal.md
+++ b/docs/website/docs/guides/deployment-configurations/bare-metal.md
@@ -124,6 +124,24 @@
Clean the list up after [#6353](https://github.com/iree-org/iree/issues/6353)
is fixed.
+!!! info
+ Disabling threading (`IREE_ENABLE_THREADING OFF`) does not eliminate the
+ need for all synchronization primitives. IREE still relies on the
+ implementation of some internal synchronization primitives, and thus
+ retains its dependency on a threading library. For the generic platform,
+ the runtime base threading layer (found in
+ [`runtime/src/iree/base/threading`](https://github.com/iree-org/iree/tree/main/runtime/src/iree/base/threading))
+ falls back on primitives from `<pthread.h>`.
+
+ Depending on your environment, you have two choices:
+
+ - **Strictly single-threaded use**: compile with `IREE_SYNCHRONIZATION_DISABLE_UNSAFE=ON`.
+ - **With custom synchronization**: provide a small pthread surface to be used by the runtime base threading layer.
+ Run the following from the root of the IREE repository for details:
+ ```bash
+ cd runtime/src/iree/base/threading && grep -iC 1 pthread *.h
+ ```
+
Also, set the toolchain-specific cmake file to match the tool path, target
architecture, target abi, linker script, system library path, etc.