Repository navigation
glm: resolve TF_NCCL_LIB in the shared NCCL library loader - #3106
Conversation
|
Thanks @vdalesandro, this is a clean fix. Routing One thing before it can land:
Optional:
|
… re-pinned Review follow-up for ashhart#3106. - zig/tests/fixtures/gradient-serving.tsv: the zig/src/cuda/nccl.zig row carries the new hash and this PR's number, so test-gradient-serving passes again. - Library.pathFrom(raw) holds the one rule (a path is kept as written; unset, empty and blank keep libnccl.so.2; a control byte is refused). Library.open applies it to the process environment as before, and fabric/tp/config.zig applies it to its own getter, so a set-but-blank TF_NCCL_LIB no longer opens a blank path there. A malformed value is error.BadSetting, like the other TP settings. Checked on a CPU-only host with Zig 0.17.0: test-gradient-serving (fails before the re-pin with "serving source changed: zig/src/cuda/nccl.zig", passes after), test-tp (the new config test fails on the old line and passes on the new one), test-runtime-host, test-environment-host, the nccl.zig tests, zig fmt --check and the lean check (0 new). No device run.
|
Thanks for the follow-up. The override now runs through one shared rule, so the native callers and the tensor-parallel session resolve the library the same way: a set path is kept exactly as written, an unset or blank value keeps the standard default, and a value with control characters is refused before anything is loaded. The serving pin now names the final bytes of the loader, and the blank-value gap on the tensor-parallel side is closed through that same rule, with a malformed value refused like the other settings. Nothing here changes the default or touches tokens, prompts, sampling or any timing path; the only behaviour that moves is an override someone sets on purpose. The check suite has not reported green at this head, so that is the remaining gate.
|
|
Thanks @vdalesandro. We re-read this head against current main and it is ready from our side.
Nothing here reaches tokens, so no device run is needed. It goes to the landing train with CI green at this head.
|
f20d0af to
7158a8c
Compare
|
Thanks @vdalesandro. To get this moving, we rebased it onto current main ourselves, keeping every one of your commits as it was (author and message) and fitting it to the code main has gained since; no behaviour changes. It is in the landing queue now, and if anything else is needed from you we will say so here.
|
… re-pinned Review follow-up for ashhart#3106. - zig/tests/fixtures/gradient-serving.tsv: the zig/src/cuda/nccl.zig row carries the new hash and this PR's number, so test-gradient-serving passes again. - Library.pathFrom(raw) holds the one rule (a path is kept as written; unset, empty and blank keep libnccl.so.2; a control byte is refused). Library.open applies it to the process environment as before, and fabric/tp/config.zig applies it to its own getter, so a set-but-blank TF_NCCL_LIB no longer opens a blank path there. A malformed value is error.BadSetting, like the other TP settings. Checked on a CPU-only host with Zig 0.17.0: test-gradient-serving (fails before the re-pin with "serving source changed: zig/src/cuda/nccl.zig", passes after), test-tp (the new config test fails on the old line and passes on the new one), test-runtime-host, test-environment-host, the nccl.zig tests, zig fmt --check and the lean check (0 new). No device run.
… re-pinned Review follow-up for ashhart#3106. - zig/tests/fixtures/gradient-serving.tsv: the zig/src/cuda/nccl.zig row carries the new hash and this PR's number, so test-gradient-serving passes again. - Library.pathFrom(raw) holds the one rule (a path is kept as written; unset, empty and blank keep libnccl.so.2; a control byte is refused). Library.open applies it to the process environment as before, and fabric/tp/config.zig applies it to its own getter, so a set-but-blank TF_NCCL_LIB no longer opens a blank path there. A malformed value is error.BadSetting, like the other TP settings. Checked on a CPU-only host with Zig 0.17.0: test-gradient-serving (fails before the re-pin with "serving source changed: zig/src/cuda/nccl.zig", passes after), test-tp (the new config test fails on the old line and passes on the new one), test-runtime-host, test-environment-host, the nccl.zig tests, zig fmt --check and the lean check (0 new). No device run.
7158a8c to
778cd79
Compare
… re-pinned Review follow-up for #3106. - zig/tests/fixtures/gradient-serving.tsv: the zig/src/cuda/nccl.zig row carries the new hash and this PR's number, so test-gradient-serving passes again. - Library.pathFrom(raw) holds the one rule (a path is kept as written; unset, empty and blank keep libnccl.so.2; a control byte is refused). Library.open applies it to the process environment as before, and fabric/tp/config.zig applies it to its own getter, so a set-but-blank TF_NCCL_LIB no longer opens a blank path there. A malformed value is error.BadSetting, like the other TP settings. Checked on a CPU-only host with Zig 0.17.0: test-gradient-serving (fails before the re-pin with "serving source changed: zig/src/cuda/nccl.zig", passes after), test-tp (the new config test fails on the old line and passes on the new one), test-runtime-host, test-environment-host, the nccl.zig tests, zig fmt --check and the lean check (0 new). No device run.
|
Thank you @vdalesandro. This is merged into main with your commits under your own name, so you're listed as a TensorFold contributor. It ships in the next release, credited to you in the changelog and the release notes. |
Requested separately in #2993 (review by @ashhart).
Change
Native GLM called the shared
cuda.nccl.Library.open(), which always openedlibnccl.so.2, while fabric/tp already selectedTF_NCCL_LIB. Resolve the override in the shared loader so GLM and its sibling callers use the same explicit selection.Callers of
nccl.Library.open()(zig/src/cuda/nccl.zig:80), all verified at these lines in this checkout:zig/src/families/glm/cuda_native.zig:264--tp 2collective:zig/src/families/flashnext/cuda_collective.zig:25zig/src/families/minimax_m3/cuda_native.zig:159zig/src/cuda/tp_group.zig:35Reuse the native environment path validator: unset, empty and whitespace-only values keep
libnccl.so.2; nonblank paths retain their exact bytes; control characters are refused before loading.openPath, required-symbol resolution, cleanup, minimum-version checks and communicator behavior are unchanged.Three existing files change: the loader and its inline CPU regression; one environment rule; one entry in the existing environment valid-case table. No new dependencies or GPU work.
Verification
With the repository's exact Zig 0.17.0, CPU-only:
zig build test-runtime-host: 328/328 tests passed.zig build test-environment-host: 23/23 tests passed.zig build native: 8/8 build steps succeeded; the built executable reportstensorfold-native 1.2.7.zig fmt --checkandgit diff --check: passed.The successful native executable build contains the final production changes. A later rebuild after adding only the environment test's valid-case row exceeded the local 180-second time limit; final runtime/environment tests and formatting/lean replay passed after that row was added. Initial missing sparse-checkout inputs and the test-table coverage failure were corrected; their failing receipts are retained locally.
No GPU, actual NCCL runtime, checkpoint inference, performance, complete no-GPU CI or release qualification is claimed. Native host checks prove path selection and validation, not device execution.
Once this lands, the switchless-ring recipe in #2993 can point at
TF_NCCL_LIBin place ofLD_LIBRARY_PATH.