Skip to content

Commit 0654d37

Browse files
authored
Don't run torch.compile on runtime images in docker validations (#1858)
* Don't run torch.compile on runtime images * test
1 parent 1645a37 commit 0654d37

File tree

2 files changed

+27
-5
lines changed

2 files changed

+27
-5
lines changed

.github/workflows/validate_docker_images.yml renamed to .github/workflows/validate-docker-images.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Validate Docker Images (with Matrix Generation)
1+
name: Validate Nightly Docker Images
22
on:
33
workflow_call:
44
inputs:
@@ -12,6 +12,11 @@ on:
1212
default: false
1313
required: false
1414
type: boolean
15+
ref:
16+
description: 'Reference to checkout, defaults to empty'
17+
default: ""
18+
required: false
19+
type: string
1520
workflow_dispatch:
1621
inputs:
1722
channel:
@@ -28,6 +33,11 @@ on:
2833
default: false
2934
required: false
3035
type: boolean
36+
ref:
37+
description: 'Reference to checkout, defaults to empty'
38+
default: ""
39+
required: false
40+
type: string
3141

3242
jobs:
3343
generate-matrix:
@@ -54,5 +64,10 @@ jobs:
5464
set -ex
5565
export MATRIX_GPU_ARCH_TYPE="cuda"
5666
export MATRIX_GPU_ARCH_VERSION="${{ matrix.cuda }}"
67+
export MATRIX_IMAGE_TYPE="${{ matrix.image_type }}"
5768
export TARGET_OS="linux"
58-
python test/smoke_test/smoke_test.py --package torchonly --runtime-error-check enabled
69+
TORCH_COMPILE_CHECK="--torch-compile-check enabled"
70+
if[[ ${MATRIX_IMAGE_TYPE} == "runtime" ]]; then
71+
TORCH_COMPILE_CHECK="--torch-compile-check disabled"
72+
fi
73+
python test/smoke_test/smoke_test.py --package torchonly --runtime-error-check enabled ${TORCH_COMPILE_CHECK}

test/smoke_test/smoke_test.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ def test_cuda_runtime_errors_captured() -> None:
146146
raise RuntimeError("Expected CUDA RuntimeError but have not received!")
147147

148148

149-
def smoke_test_cuda(package: str, runtime_error_check: str) -> None:
149+
def smoke_test_cuda(package: str, runtime_error_check: str, torch_compile_check: str) -> None:
150150
if not torch.cuda.is_available() and is_cuda_system:
151151
raise RuntimeError(f"Expected CUDA {gpu_arch_ver}. However CUDA is not loaded.")
152152

@@ -163,7 +163,7 @@ def smoke_test_cuda(package: str, runtime_error_check: str) -> None:
163163
print(f"{module['name']} CUDA: {version}")
164164

165165
# torch.compile is available on macos-arm64 and Linux for python 3.8-3.11
166-
if sys.version_info < (3, 12, 0) and (
166+
if torch_compile_check == "enabled" and sys.version_info < (3, 12, 0) and (
167167
(target_os == "linux" and torch.cuda.is_available()) or
168168
target_os == "macos-arm64"):
169169
smoke_test_compile()
@@ -310,6 +310,13 @@ def main() -> None:
310310
choices=["enabled", "disabled"],
311311
default="enabled",
312312
)
313+
parser.add_argument(
314+
"--torch-compile-check",
315+
help="Check torch compile",
316+
type=str,
317+
choices=["enabled", "disabled"],
318+
default="enabled",
319+
)
313320
options = parser.parse_args()
314321
print(f"torch: {torch.__version__}")
315322

@@ -323,7 +330,7 @@ def main() -> None:
323330
if options.package == "all":
324331
smoke_test_modules()
325332

326-
smoke_test_cuda(options.package, options.runtime_error_check)
333+
smoke_test_cuda(options.package, options.runtime_error_check, options.torch_compile_check)
327334

328335

329336
if __name__ == "__main__":

0 commit comments

Comments
 (0)