Skip to content

Commit a874e5e

Browse files
committed
Address review: check rendered names, honor include/exclude, drop LD_LIBRARY_PATH
- The test renders each row's check name from the template and requires the names to be unique and at most 100 characters. An explicit name stops GitHub appending matrix values, so a prefix check alone let six rows share a name. - _matrix_cuda_versions adds include values to the axis and removes exclude values, so an exclude that drops a train fails the coverage test. - Drop the LD_LIBRARY_PATH export from the toolkit switch, matching the wheel pipeline's copy: nvcc finds its own libraries, and the export links nothing against the Linux runtime. - Comment wording: bin\x64 goes ahead of bin on PATH; only the export has its own torch; the gate test is named per row.
1 parent fec953f commit a874e5e

2 files changed

Lines changed: 31 additions & 12 deletions

File tree

‎.ci/scripts/tests/test_cuda_workflow.py‎

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,22 @@ def _matrix_cuda_versions(job):
3333
assert expression, job["with"]["gpu-arch-version"]
3434
key = expression.group(1)
3535
matrix = job["strategy"]["matrix"]
36-
if key in matrix:
37-
assert isinstance(matrix[key], list), matrix[key]
38-
return list(matrix[key])
39-
return [row[key] for row in matrix["include"]]
36+
versions = list(matrix.get(key, []))
37+
versions += [row[key] for row in matrix.get("include", []) if key in row]
38+
excluded = {row[key] for row in matrix.get("exclude", []) if key in row}
39+
return [version for version in versions if version not in excluded]
40+
41+
42+
def _rendered_names(job):
43+
"""The check names GitHub gives a job's include rows, with each row's values filled in."""
44+
names = []
45+
for row in job["strategy"]["matrix"]["include"]:
46+
name = job["name"]
47+
for key, value in row.items():
48+
name = name.replace(f"${{{{ matrix.{key} }}}}", str(value))
49+
assert "${{" not in name, name
50+
names.append(name)
51+
return names
4052

4153

4254
WINDOWS_TRAIN_JOBS = (
@@ -104,6 +116,13 @@ def test_windows_jobs_cover_every_supported_train(self):
104116
job["name"].startswith(f"{name}-${{{{ matrix.cuda-version }}}}"),
105117
job["name"],
106118
)
119+
# An explicit name stops GitHub appending the matrix values, so the name
120+
# itself has to tell every row apart, within the 100 characters.
121+
if "include" in job["strategy"]["matrix"]:
122+
rendered = _rendered_names(job)
123+
self.assertEqual(len(set(rendered)), len(rendered), rendered)
124+
for check in rendered:
125+
self.assertLessEqual(len(check), 100, check)
107126
self.assertEqual(
108127
sorted(set(_matrix_cuda_versions(job))),
109128
sorted(_supported_cuda_versions()),
@@ -113,9 +132,9 @@ def test_windows_jobs_cover_every_supported_train(self):
113132
script = jobs[name]["with"]["script"]
114133
self.assertIn("CUDA\\v${{ matrix.cuda-version }}'", script)
115134
self.assertNotRegex(script, r"CUDA\\v\d")
116-
# The 13.x Windows toolkits keep their DLLs in bin\x64, ahead of bin, and
117-
# the toolkit has to lead PATH before setup, since setup.py builds the
118-
# CUDA extension with the first nvcc on PATH.
135+
# The 13.x Windows toolkits keep their DLLs in bin\x64, so bin\x64 goes
136+
# ahead of bin on PATH. The toolkit has to lead PATH before setup, since
137+
# setup.py builds the CUDA extension with the first nvcc on PATH.
119138
path = script.index(
120139
r"PATH = \"\$env:CUDA_HOME\bin\x64;\$env:CUDA_HOME\bin;"
121140
)
@@ -134,7 +153,7 @@ def test_windows_jobs_cover_every_supported_train(self):
134153
)
135154
)
136155

137-
def test_one_train_failing_its_export_does_not_skip_the_others(self):
156+
def test_one_failed_export_row_does_not_skip_the_others(self):
138157
jobs = yaml.safe_load(
139158
(ROOT / ".github" / "workflows" / "cuda-windows.yml").read_text()
140159
)["jobs"]

‎.github/workflows/cuda-windows.yml‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,10 @@ jobs:
112112
model_name: "dinov2-small-imagenet1k-1-layer"
113113
quant: "non-quantized"
114114
cuda-version: "13.2"
115-
# Each train installs its own toolkit and its own torch, so the remaining trains
116-
# get the smallest model plus the tile-packed int4 model, the only quant here that
117-
# lowers to _weight_int4pack_mm and so runs the int4mm shim that train's nvcc built.
115+
# Each train installs its own toolkit and, for the export, its own torch, so each
116+
# needs rows of its own. The other trains get only the smallest model and the
117+
# tile-packed int4 model, the only quant here that lowers to _weight_int4pack_mm
118+
# and so runs the int4mm shim that train's nvcc built.
118119
- model_repo: "facebook"
119120
model_name: "dinov2-small-imagenet1k-1-layer"
120121
quant: "non-quantized"
@@ -166,7 +167,6 @@ jobs:
166167
export CUDA_HOME="${TOOLKITS}/cuda-${{ matrix.cuda-version }}"
167168
export PATH="${CUDA_HOME}/bin:${PATH}"
168169
export CUDACXX="${CUDA_HOME}/bin/nvcc"
169-
export LD_LIBRARY_PATH="${CUDA_HOME}/lib64:${LD_LIBRARY_PATH:-}"
170170
python .ci/scripts/wheel/install_cuda_redist.py --train "${{ matrix.cuda-version }}" \
171171
--platform windows-x86_64 --dest "${TOOLKITS}/cuda-windows-${{ matrix.cuda-version }}" --components cuda_cudart
172172
export WINDOWS_CUDA_HOME="${TOOLKITS}/cuda-windows-${{ matrix.cuda-version }}"

0 commit comments

Comments
 (0)