cuda: stage shims for conda layouts and via SMOLVM_CUDA_STAGE_EXTRA_DIRS - #602
cuda: stage shims for conda layouts and via SMOLVM_CUDA_STAGE_EXTRA_DIRS#602NickyHeC wants to merge 6 commits into
Conversation
|
Ready to review this PR? Stage has broken it down into 3 individual chapters for you:
Chapters generated by Stage for commit f1b81c9 on Jul 15, 2026 6:07am UTC. |
e65c97a to
42a0560
Compare
|
Looks to be in the right direction - let's continue push for end to end validation |
Auto-staging only recognized the pip-wheel layout (site-packages/nvidia/), so conda images (pytorch/pytorch: libs at /opt/conda/lib/) and any vendored layout silently loaded the real NVIDIA libraries and failed at runtime. - Match the conda layout (/opt/conda/lib, /opt/conda/pkgs/*/lib) in addition to pip wheels. - Match symlinked sonames (conda ships libcublas.so.12 -> libcublas.so.12.x.y), resolving the link lexically to overlay the real target while keeping the rootfs-relative path stage_shims needs. - Add SMOLVM_CUDA_STAGE_EXTRA_DIRS as an escape hatch to point staging at arbitrary guest lib dirs. Tests cover the conda symlink and extra-dir paths. Refs smol-machines#598.
Collapse the strip_prefix chain onto one line to match `cargo fmt --all -- --check`, fixing the failing fmt CI job on this branch.
42a0560 to
f1b81c9
Compare
GPU e2e — conda staging validated; torch import blocked by cudart shim surfaceRebased onto current Staging discovery — PASSInside the guest after So Torch e2e without
|
| #602 piece | Result |
|---|---|
| Conda path discovery + overmount | PASS |
SMOLVM_CUDA_STAGE_EXTRA_DIRS |
accepted / smoke OK |
conda torch init / backward() sans LD_PRELOAD |
blocked on cudart shim API (cudaDeviceSetLimit at minimum) |
Happy to land discovery as-is if the follow-up is a shim stub (or selective interposition) for missing Runtime API symbols — otherwise conda “drop LD_PRELOAD” stays blocked after this change lands, and the old LD_PRELOAD escape hatch regresses for staged conda layouts.
Host note (orthogonal): stock v1.6.0 libkrun.so needs GLIBC_2.39; this 22.04 box used v1.5.2 host libs to boot.
Follow-up: conda torch e2e now PASS (with cudart stub PR)After the staging discovery above failed torch import on
Shipped as draft #638 ( Retest on Lambda A10 —
|
|
Evidence update (description rewritten). Staging alone: conda Torch without Land with #638; this PR alone regresses the old |
|
Following up on the end-to-end validation ask — that's now complete, so marking this ready for review. e2e status (A10, Ubuntu 22.04): conda Suggested landing: take the two together (I've marked both ready). Happy to reorder/rebase or fold the extra-dirs escape hatch however you'd prefer — just let me know. Separately, while stress-testing the remoting path at scale I filed #667 (intermittent cold-start guest wedge on the first large fp32 load) — unrelated to this PR, noted only so it's on your radar. |
Conda libtorch_cuda.so version-requires cudaDeviceSetLimit@libcudart.so.12 at import. After smol-machines#602 stages the shim over real cudart, that missing export breaks dynamic linking. Mirror the driver shim's cuCtxSetLimit no-op / GetLimit default.
Bind-mounting the incomplete cudart shim over conda sonames removes the old LD_PRELOAD fall-through. Stamp conda-overmount-v1 only after the packaged shim exports the Runtime surface conda torch needs, and leave conda/extra-dir libraries untouched otherwise.
Conda libtorch_cuda.so version-requires cudaDeviceSetLimit@libcudart.so.12 at import. After #602 stages the shim over real cudart, that missing export breaks dynamic linking. Mirror the driver shim's cuCtxSetLimit no-op / GetLimit default.
Refs #598. Complements #600. Safe to merge alone; full no-
LD_PRELOADconda torch still wants #638.Problem
find_rpath_pinned_libsonly matches pip-wheel paths (…/site-packages/nvidia/*/lib/<soname>). Conda (/opt/conda/lib, soname→versioned symlink) and vendored CUDA dirs miss staging → real cudart/cublas load.Change (
crates/smolvm-agent/src/cuda.rs,scripts/build-agent-rootfs.sh)/opt/conda/lib+/opt/conda/pkgs/*/libas staged layouts.canonicalizeescaping through host path).SMOLVM_CUDA_STAGE_EXTRA_DIRS(colon-separated guest paths) escape hatch.runtime-capabilitieswithconda-overmount-v1only afternmverifies the Runtime exports conda torch needs. Without that stamp, conda/extra-dir sonames are left untouched so the oldLD_PRELOADfall-through still works. Pip-wheel overmounts remain unconditional.Unit:
finds_conda_symlinked_libs,finds_extra_dir_libs,incomplete_runtime_preserves_conda_ld_preload_fallback,capable_runtime_stages_conda_without_ld_preload.Standalone vs combined behavior
LD_PRELOADfall-through preserved)LD_PRELOADpathProof — GPU (Lambda A10)
Image:
pytorch/pytorch:2.4.0-cuda12.4-cudnn9-runtime. Agent from this PR’s discovery commits. NoLD_PRELOAD.Tested commit set:
f1b81c94(conda/extra-dirs discovery)79d9ed52+8d7e0d66(equivalent to current cudart: stub Runtime exports required by conda libtorch_cuda #638731a60e6+07b04d2f)Staging (discovery alone, pre-gate): conda soname overmounted with ~901KB shim.
Torch import (discovery alone): FAIL —
undefined symbol: cudaDeviceSetLimit(motivates the capability gate above).Torch e2e (discovery + #638 stubs):
cuda: True→ matmul → tiny-Llamabackward ok.The capability gate itself is unit-tested; it was not re-run on A10.