diff --git a/docs/design/debug_vllm_compile.md b/docs/design/debug_vllm_compile.md index e565f17da..731e542a0 100644 --- a/docs/design/debug_vllm_compile.md +++ b/docs/design/debug_vllm_compile.md @@ -86,7 +86,7 @@ LLM(model, enforce_eager=True) ``` To turn off just torch.compile, pass `mode = NONE` to the compilation config. -(`-cc` is short for `--compilation_config`; `-O.*` dotted syntax is deprecated): +(`-cc` is short for `--compilation_config`): ```sh # Online diff --git a/tests/utils_/test_argparse_utils.py b/tests/utils_/test_argparse_utils.py index 2d969b8c9..6f24c77e0 100644 --- a/tests/utils_/test_argparse_utils.py +++ b/tests/utils_/test_argparse_utils.py @@ -460,23 +460,20 @@ def test_flat_product(): ] -def test_o_legacy_syntax_deprecation(caplog_vllm): - """Test that -O.* dotted syntax emits warnings and converts correctly to -cc syntax.""" +def test_o_dotted_syntax_error(): + """Test that -O.* dotted syntax raises a clear error message.""" parser = FlexibleArgumentParser() parser.add_argument("-cc", "--compilation-config", type=json.loads) - # Test that -O.backend gets converted correctly AND emits warning - args = parser.parse_args(["-O.backend=eager"]) - assert args.compilation_config == {"backend": "eager"} + # Test that -O.* syntax raises a clear ValueError + with pytest.raises(ValueError, match=r"The -O\.\* syntax is no longer supported"): + parser.parse_args(["-O.backend=eager"]) - # Check that deprecation warning was logged - assert len(caplog_vllm.records) >= 1 - assert ( - "The -O.* dotted syntax for --compilation-config is deprecated" - in caplog_vllm.text - ) + with pytest.raises(ValueError, match=r"Please use -cc\.\* instead"): + parser.parse_args(["-O.mode=2"]) - # Test that -O.mode gets converted correctly - # Note: warning_once won't emit again in same session - args = parser.parse_args(["-O.mode=2"]) - assert args.compilation_config == {"mode": 2} + with pytest.raises( + ValueError, + match=r"replace '-O\.cudagraph_mode=NONE' with '-cc\.cudagraph_mode=NONE'", + ): + parser.parse_args(["-O.cudagraph_mode=NONE"]) diff --git a/vllm/utils/argparse_utils.py b/vllm/utils/argparse_utils.py index 555fcfea4..356f383cc 100644 --- a/vllm/utils/argparse_utils.py +++ b/vllm/utils/argparse_utils.py @@ -244,9 +244,15 @@ class FlexibleArgumentParser(ArgumentParser): else: key = pattern.sub(repl, arg, count=1) processed_args.append(key) - elif arg.startswith("-O") and arg != "-O" and arg[2] != ".": + elif arg.startswith("-O."): + # Provide clear error for deprecated -O.* syntax + raise ValueError( + f"The -O.* syntax is no longer supported. " + f"Please use -cc.* instead. " + f"For example, replace '{arg}' with '{arg.replace('-O', '-cc', 1)}'" + ) + elif arg.startswith("-O") and arg != "-O": # allow -O flag to be used without space, e.g. -O3 or -Odecode - # -O.<...> handled later # also handle -O= here optimization_level = arg[3:] if arg[2] == "=" else arg[2:] processed_args += ["--optimization-level", optimization_level] @@ -257,17 +263,6 @@ class FlexibleArgumentParser(ArgumentParser): ): # Convert -O to --optimization-level processed_args.append("--optimization-level") - elif arg.startswith("-O."): - # Handle -O.* dotted syntax - ALL dotted syntax is deprecated - logger.warning_once( - "The -O.* dotted syntax for --compilation-config is " - "deprecated and will be removed in v0.13.0 or v1.0.0" - ", whichever is earlier. Please use -cc.* instead. " - "Example: -cc.backend=eager instead of " - "-O.backend=eager." - ) - converted_arg = arg.replace("-O", "-cc", 1) - processed_args.append(converted_arg) else: processed_args.append(arg)