Skip to content

Don't run torch.compile on runtime images in docker validations #1858

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Validate Docker Images (with Matrix Generation)
name: Validate Nightly Docker Images
on:
workflow_call:
inputs:
Expand All @@ -12,6 +12,11 @@ on:
default: false
required: false
type: boolean
ref:
description: 'Reference to checkout, defaults to empty'
default: ""
required: false
type: string
workflow_dispatch:
inputs:
channel:
Expand All @@ -28,6 +33,11 @@ on:
default: false
required: false
type: boolean
ref:
description: 'Reference to checkout, defaults to empty'
default: ""
required: false
type: string

jobs:
generate-matrix:
Expand All @@ -54,5 +64,10 @@ jobs:
set -ex
export MATRIX_GPU_ARCH_TYPE="cuda"
export MATRIX_GPU_ARCH_VERSION="${{ matrix.cuda }}"
export MATRIX_IMAGE_TYPE="${{ matrix.image_type }}"
export TARGET_OS="linux"
python test/smoke_test/smoke_test.py --package torchonly --runtime-error-check enabled
TORCH_COMPILE_CHECK="--torch-compile-check enabled"
if[[ ${MATRIX_IMAGE_TYPE} == "runtime" ]]; then
TORCH_COMPILE_CHECK="--torch-compile-check disabled"
fi
python test/smoke_test/smoke_test.py --package torchonly --runtime-error-check enabled ${TORCH_COMPILE_CHECK}
13 changes: 10 additions & 3 deletions test/smoke_test/smoke_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def test_cuda_runtime_errors_captured() -> None:
raise RuntimeError("Expected CUDA RuntimeError but have not received!")


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

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

# torch.compile is available on macos-arm64 and Linux for python 3.8-3.11
if sys.version_info < (3, 12, 0) and (
if torch_compile_check == "enabled" and sys.version_info < (3, 12, 0) and (
(target_os == "linux" and torch.cuda.is_available()) or
target_os == "macos-arm64"):
smoke_test_compile()
Expand Down Expand Up @@ -310,6 +310,13 @@ def main() -> None:
choices=["enabled", "disabled"],
default="enabled",
)
parser.add_argument(
"--torch-compile-check",
help="Check torch compile",
type=str,
choices=["enabled", "disabled"],
default="enabled",
)
options = parser.parse_args()
print(f"torch: {torch.__version__}")

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

smoke_test_cuda(options.package, options.runtime_error_check)
smoke_test_cuda(options.package, options.runtime_error_check, options.torch_compile_check)


if __name__ == "__main__":
Expand Down