ci: locate Visual Studio with vswhere in the MSVC CUDA setup#797
Open
zkasuran wants to merge 1 commit into
Open
ci: locate Visual Studio with vswhere in the MSVC CUDA setup#797zkasuran wants to merge 1 commit into
zkasuran wants to merge 1 commit into
Conversation
The Windows + CUDA jobs fail in the "Setup CUDA (MSVC)" step. setup_cuda.ps1 copies the CUDA MSBuild integration into Visual Studio's BuildCustomizations folder, found by globbing a hard-coded C:\Program Files\Microsoft Visual Studio\2022 path. That path no longer exists on the current windows-latest runner image, so the step exits 1 with "Cannot find path ... 2022" before anything compiles. Resolve the VS install path with vswhere, the supported version-independent way to locate Visual Studio, so the integration is copied wherever VS lives. vswhere ships at a stable path on every GitHub Windows image, so this survives runner image bumps.
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
The Windows + CUDA CI jobs fail in the "Setup CUDA (MSVC)" step.
setup_cuda.ps1copies the CUDA MSBuild integration into Visual Studio'sBuildCustomizationsfolder, found by globbing a hard-codedC:\Program Files\Microsoft Visual Studio\2022\*path. That path no longer exists on the currentwindows-latestrunner image, so the step exits 1 with "Cannot find path 'C:\Program Files\Microsoft Visual Studio\2022' because it does not exist" before anything compiles.This is hitting the whole repo's Windows CUDA matrix right now (for example #785 and #791), not one branch.
Fix
Resolve the VS install path with
vswhere, the supported version-independent way to locate Visual Studio, then globMSBuild\Microsoft\VC\*\BuildCustomizationsunder it.vswhereships at a stable location on every GitHub Windows image, so this keeps working across runner image bumps.One file, the MSVC CUDA setup script. It only runs for the Windows MSVC CUDA matrix, so it cannot affect the Linux, macOS or non-CUDA builds.
I do not have a Windows runner locally, so the proof is this PR's own Windows CUDA matrix. If the vswhere call needs adjusting I will iterate here.
AI disclosure: drafted with help from Claude (Anthropic). I traced the failure to the "Setup CUDA (MSVC)" step (the VS2022 path drift) across the failing jobs and an unrelated PR before writing the change. Verified by CI.