diff --git a/crates/metal2vulkan-runtime/README.md b/crates/metal2vulkan-runtime/README.md index 21384a475..cec61d242 100644 --- a/crates/metal2vulkan-runtime/README.md +++ b/crates/metal2vulkan-runtime/README.md @@ -233,6 +233,14 @@ program's, returns once that is done: it stops the runtime's own background work check of textures over host pages, its warm pass) and waits for it, at most a round of the check or the record the pass is making. +**At the process's exit.** On NVIDIA's proprietary driver, drop the runtime's devices before the +process exits. A device kept to the exit can end it with `SIGSEGV` inside the driver's own exit +handler, which tears the driver's SPIR-V compiler down while a worker thread of the driver's still +runs in it, where the device's check of textures over host pages ended a few seconds or less before +the exit: on an RTX 3090 (620.70.06), 6 of 80 exits right after the check, 0 of 80 three seconds +after it, and 0 of 80 with the device dropped first +([HOWTO](../../docs/HOWTO.md#8-check-the-integration)). + **The Vulkan objects underneath** (no Metal counterpart; each call is `unsafe`): - `Device::raw()` gives the entry, instance, physical device, `ash::Device`, queue families, and diff --git a/crates/metal2vulkan-runtime/src/exit_guard.rs b/crates/metal2vulkan-runtime/src/exit_guard.rs index 1b4b753ea..6a02da05e 100644 --- a/crates/metal2vulkan-runtime/src/exit_guard.rs +++ b/crates/metal2vulkan-runtime/src/exit_guard.rs @@ -114,7 +114,12 @@ //! process ended //! with `SIGSEGV` at `0x18` inside `libnvidia-glvkspirv.so`, the driver's SPIR-V compiler, on a //! thread the test's had started, during its exit after its test passed: one test of a whole -//! run under load, which passed alone. A load is where the first call counts +//! run under load, which passed alone. The same fault ends an exit with no making in progress +//! too, which no hook orders: on an RTX 3090 (620.70.06), the exit handler of `libEGL_nvidia.so` +//! tore the compiler down while a worker thread of the driver's (started from the thread that +//! made the device, whose name it carries) still ran in it, in 6 of 80 exits right after the +//! device's in-place check ended, and none with the device dropped first (docs/FAST-PATHS.md, +//! known gaps). A load is where the first call counts //! from: the Vulkan loader unloads the layers with the last instance and loads them again with //! the next, which make their statics again at each entry point's first call after the device //! that registered at the load; so that device forgets the entry points called before diff --git a/crates/metal2vulkan-runtime/src/tests/exit_guard.rs b/crates/metal2vulkan-runtime/src/tests/exit_guard.rs index efb03038b..c6ca12d77 100644 --- a/crates/metal2vulkan-runtime/src/tests/exit_guard.rs +++ b/crates/metal2vulkan-runtime/src/tests/exit_guard.rs @@ -849,8 +849,9 @@ fn a_pipeline_making_that_returned_registers_the_hook_again() { /// first and waits for the making, and the destructor runs once it ended. The destructor ends the /// child with 42 when the making had ended, 43 when it ran beside it. That is an exit mid-compile: /// on an RTX 5080 a consumer's test process ended with `SIGSEGV` at `0x18` inside -/// `libnvidia-glvkspirv.so`, the driver's SPIR-V compiler, on a thread of the runtime's during its -/// exit after its test passed (one test of a whole run under load; it passed alone). +/// `libnvidia-glvkspirv.so`, the driver's SPIR-V compiler, on a thread the test's had started, +/// during its exit after its test passed (one test of a whole run under load; it passed alone). The +/// same fault also comes with no making in progress (`exit_guard.rs`). #[cfg(unix)] #[test] fn an_exit_mid_making_waits_for_it_before_an_earlier_making_s_destructor() { diff --git a/docs/API.md b/docs/API.md index b450043bd..26b179553 100644 --- a/docs/API.md +++ b/docs/API.md @@ -5169,6 +5169,12 @@ each item named states the rule in full. thread left running, ended a consumer's process with `SIGSEGV` inside NVIDIA's SPIR-V compiler (`libnvidia-glvkspirv.so`, RTX 5080). A program that ends its making threads before it exits leaves only the 2 ms window. +- **On NVIDIA's proprietary driver, an exit with a device live can fault in the driver's own exit + handler** with no making in progress, where Metal's exit is clean: the handler tears the driver's + SPIR-V compiler down while a worker thread of the driver's still runs in it (a null dereference + at `0x18` in `libnvidia-glvkspirv.so`, the fault above), on an RTX 3090 (620.70.06) in 6 of 80 + exits right after the device's check of textures over host pages ended, and none three seconds + after it. A device dropped before the exit leaves none ([FAST-PATHS](FAST-PATHS.md), known gaps). **Two-plane YCbCr textures** diff --git a/docs/FAST-PATHS.md b/docs/FAST-PATHS.md index 15b84d39d..00cc9d9c5 100644 --- a/docs/FAST-PATHS.md +++ b/docs/FAST-PATHS.md @@ -1425,8 +1425,18 @@ driver's. Each is open work. **unaudited** past the shapes measured there. - **On NVIDIA's proprietary driver, a process that exits with a device live can fault in the - driver's own worker thread during its exit handler**: about 1 in 100 test processes beside other - GPU work. The cause is not found. + driver's own worker thread during its exit handler**: the exit handler of `libEGL_nvidia.so` + tears the driver's SPIR-V compiler down while a worker thread of the driver's still runs in it, a + null dereference at `0x18` in `libnvidia-glvkspirv.so` (`SIGSEGV`, `SEGV_MAPERR`) on a thread the + driver started from the thread that made the device, so it carries that thread's name. No thread + or call of the runtime's is in the driver then, and Vulkan has no call that waits for the + driver's worker. Measured on an RTX 3090 (620.70.06), 8 processes at once, each making a device + with no record of its in-place check (`Device::settle_in_place_checks`) and keeping it to the + exit: 6 of 80 exits right after the check ended faulted, 0 of 80 three seconds after it, 0 of 80 + where the device was dropped before the exit, and 0 of 160 with no check (exits right after the + device's creation and 6 s after it). What other work leaves the worker running is unaudited. + Drop the runtime's devices before the process exits on that driver + ([HOWTO](HOWTO.md#8-check-the-integration)). - **Reflection after a compute descriptor reset on RADV**: `max_total_threads_per_threadgroup` answers 0 where Metal answers 96, `required_threads_per_threadgroup` `0x0x0` where Metal answers diff --git a/docs/HOWTO.md b/docs/HOWTO.md index 8b4ffda1e..610628649 100644 --- a/docs/HOWTO.md +++ b/docs/HOWTO.md @@ -968,3 +968,16 @@ A host note: on a laptop whose NVIDIA GPU powers down when idle (the driver's ru 1 second while the GPU wakes (970 to 980 ms on an RTX 5080 Laptop GPU, driver 615.71.09). A host that wants no wake can keep the GPU powered (`on` in its PCI device's `power/control`); the runtime never needs it. + +A host note: on NVIDIA's proprietary driver, drop the runtime's devices before the process exits. +A device kept to the exit (in a static, as Metal's device lives for the process) can end the exit +with `SIGSEGV` inside the driver's own exit handler, which tears the driver's SPIR-V compiler down +while a worker thread of the driver's still runs in it: a null dereference at `0x18` in +`libnvidia-glvkspirv.so`, on a thread the driver started from the thread that made the device (so +it carries that thread's name, a test's under a test harness). No call of the runtime's is in the +driver then, and Vulkan has no call that waits for that worker. On an RTX 3090 (620.70.06), 8 +processes at once, each making a device whose in-place check had no record yet +(`Device::settle_in_place_checks`, run once per driver) and keeping it: 6 of 80 exits right after +the check ended faulted, 0 of 80 three seconds after it, and 0 of 80 with the device dropped first; +with no check, 0 of 160. Which other work leaves the worker running is unaudited +([FAST-PATHS](FAST-PATHS.md), known gaps).