Repository navigation
Windows: explicit instantiations repeat __restrict__, and GLM's NCCL defaults go through sys.c - #1213
Open
wesley4546 wants to merge 2 commits into
Open
wesley4546 wants to merge 2 commits into
wesley4546 wants to merge 2 commits into
Conversation
…nvcc with cl.exe compiles them
With cl.exe as nvcc's host compiler, an explicit instantiation whose pointer parameters lack the
definition's __restrict__ matches no template ("no instance of function template ... matches the
specified type"). 21 kernel files failed that way on Windows with nvcc 13.0 and 13.4; GCC hosts
accepted them. 103 instantiations in 20 files now name the same parameter types as their definitions.
Refs ashhart#1210
…tive links on Windows The Windows C runtime has no setenv. The declaration follows heat.zig and flashnext's cuda_lanes.zig: sys.c (win_clock.zig's _putenv_s wrapper) on Windows, the C library's setenv elsewhere. Refs ashhart#1210
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
Makes the native Windows build from
docs/WINDOWS.mdcompile and link again, in two commits. Explicit kernel instantiations now repeat their definitions'__restrict__, and GLM'sopenRanksets its NCCL defaults throughsys.c. Fixes #1210.cuda: explicit instantiations repeat their kernels' __restrict__, so nvcc with cl.exe compiles them: 103 instantiations in 20.cufiles, some inside#defines. Only parameter lists change; the lines are rewrapped where they passed 120 columns.exl3_block/x3ld_epi.cuis fixed through its includes.glm cuda: openRank's NCCL defaults go through sys.c, so tensorfold-native links on Windows:envis@import("sys").con Windows (the_putenv_swrapper inwin_clock.zig) and the existingextern "c" fn setenvelsewhere, the patternheat.zigandflashnext/cuda_lanes.zigalready use.On Linux the change is a no-op: all 125 release fatbins are byte-identical before and after (below).
Receipt
c9fab624plus these two commits.sm_120), driver 610.88, Zig 0.17.0, MSVC 19.44, CUDA 13.0.2 (V13.0.88). 13.4 (V13.4.59) was also checked for the kernel compile.V13.0.88), Zig 0.17.0.mlx-community/Qwen3.5-2B-MLX-4bit@93760be4f1f69842a46bc13dbdc0f19e291392a3.zig build fatbins fatbins-dsv41 -Dsm=80,86,120,121atc9fab624and at this branch, each in its own worktree and cache. Both give the same 125 fatbins, all byte-identical (cmp), including the 21 built from the changed files.--context 8192 --no-thinking, greedy, drafts on): for one prose and one code prompt, a repeated request and a"draft": falserequest return the same text as the drafted one.maincan't build on Windows, so there is no before.zig build test test-kernel-contract test-golden fuzz-cortheon: 283/283 steps, 3290 passed, 0 failed, 62 skipped.zig build: passes.zig fmt --checkandgit diff --check: clean.tools/zig/lean_check.py: 447 findings onc9fab624and 447 on this branch, none new.tf-cuda-teston the RTX 5090, all passing:infosm_120, 170 SMs, kernels embeddedsmokegraphlaunch-exptxsymbolscublasltnorms,norm-rowssamplegluequant-refaffine8modeloptexlr8kernel-contractonsm_120: not run yet. No kernel is added, and the bits don't change on Linux.Checklist
"draft": false, a resumed prompt equals a fresh one, and concurrent equals solo. (Linux images unchanged; drafted equals"draft": falsechecked on Windows.)SUMMARYline is in the receipt. (No new kernel, and the images don't change.sm_120not run, see above.)Notes
chain_kernel,hpattn_kernel,hpattn8_kernelandprefill_kernelwithout__restrict__, so they will need the same treatment.extern "c" fn unsetenvnext tosetenvand conflicts textually with this. The resolution is to declareunsetenvinside the non-Windowsenvstruct and callenv.unsetenv;sys.calready wraps it on Windows.tensorfold-nativewould catch both.cublasLt64_13.dllis inbin\x64, andtf-cuda-test cublasltreportsCublasLtUnavailableuntil that folder is onPATH.