mirror of
https://github.com/Comfy-Org/comfy-kitchen.git
synced 2026-11-04 23:37:42 +00:00
[PR #246] Linux CUDA runtime interoperability: matched shared CUDART and relocatable wheels #252
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Comfy-Org/comfy-kitchen#252
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Comfy-Org/comfy-kitchen/pull/246
Author: @xmarre
Created: 10/12/2026
Status: 🔄 Open
Base:
main← Head:experiment/issue245-shared-cudart-linux-20261012📝 Commits (1)
6803e41Fix Linux CUDA runtime selection and ensure wheel RPATH is relocatable📊 Changes
4 files changed (+205 additions, -11 deletions)
View changed files
📝
.github/workflows/build-wheels.yml(+10 -0)📝
comfy_kitchen/backends/cuda/CMakeLists.txt(+52 -11)➕
tests/check_cuda_wheel_elf.py(+51 -0)➕
tests/manual_cuda_runtime_interop.py(+92 -0)📄 Description
Summary
Fix #245 on Linux: a Kitchen native CUDA call (even non-Sol
quantize_int8_rowwiseand Sol withtoken_aug=0) synchronized successfully, but a subsequent PyTorchfill_launch raisedcudaErrorInvalidResourceHandleon the owner's WSL Blackwell / PyTorch2.10.0+cu130environment. The failure reproduced across import orders, streams, allocator modes and workspace lifetimes.This PR does not modify any CUDA kernel or Sol algorithm. It changes Linux runtime selection/linking and tests. Windows retains existing static-CUDART behavior. Companion #244 separately fixes stale FindCUDAToolkit/Python CMake caches; #242 separately fixes actual Sol over-budget token nondeterminism.
Root-cause isolation
libcudart.so.11.0; both non-Sol and Sol interop tests still failed. This invalidated that A/B. The mismatch was confirmed via ELFDT_NEEDEDand/proc/self/maps.libcudart.so.13instead, and excluded the host CUDA 11 runtime. The previously deterministic failures disappeared: 3/3 consecutive native quantization + PyTorch operations and 3/3 consecutive native Sol + PyTorch operations passed. Owner subsequently passed 7/7 CUDA numerical tests and a complete H3 run 01907 with a real 12-group overflow and bitwise A/A′ low-source replay. Interop evidence. This demonstrates a working matched shared-CUDA13 configuration, not that static CUDART is categorically broken.Changes
libcudart.so.<selected toolkit major>inside the explicitly selectedCUDAToolkit_ROOT; fail CMake configure rather than accidentally using an unrelated host CUDA runtime. Link the selected shared soname and set CUDA runtime modeShared. Preserve static CUDART on Windows.setup.pyemits the CMake build output directly to the wheel, useBUILD_WITH_INSTALL_RPATH TRUE,INSTALL_RPATH "$ORIGIN"andINSTALL_RPATH_USE_LINK_PATH FALSE. CUDA runtime remains an external dependency as required by existingauditwheel --exclude libcudart.so.13wheel policy; the consumer must provide a compatible CUDA13 runtime (normally via its PyTorch environment).tests/manual_cuda_runtime_interop.pychecks ELFDT_NEEDED, rejects wrong CUDA major and absolute ELF search paths, then exercises non-Sol or plain Sol across multiple native/PyTorch calls.tests/check_cuda_wheel_elf.pychecks the built wheel artifact for CUDA13DT_NEEDEDand rejects absolute RPATH/RUNPATH. Apply it to both x86_64 and ARM64 Linux wheel jobs in.github/workflows/build-wheels.yml.Validation and limitations
cd624cfapassed owner RTX PRO 6000 Blackwell native interop 3/3 + 3/3, and full run 01907. That old build still contained an absolute toolkit RPATH.6803e41bremoves that RPATH and adds wheel-level checks. Fork wheel CI 38213413185 is running; x86_64/ARM64 artifact checks and updated installed-wheel GPU interop on this new head are pending. Do not present it as fully wheel or runtime qualified until both succeed.Patch structure: one commit on upstream
mainbe9985bf2977133fb5a48aac4a9df8b6760194c8. Changes to numerical PR #242 or user model settings are intentionally excluded. No merge/release performed.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.