@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 54a62a79f7
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 6, 14:30 UTC

[ROCm] Fix AttributeError for torch.compiler.skip_all_guards_unsafe on older PyTorch (#37219)

Signed-off-by: Andreas Karatzas <akaratza@amd.com>

Andreas Karatzas committed Mar 16, 2026 at 22:34 UTC 54a62a79f70982742a227c845b96148e6401d0e7
1 file changed +6 -1
vllm/compilation/wrapper.py
+6 -1
@@ -112,7 +112,12 @@ class TorchCompileWithNoGuardsWrapper:
112 entry.guard_type == "SHAPE_ENV" for entry in x
113 ]
114 else:
115 - options["guard_filter_fn"] = torch.compiler.skip_all_guards_unsafe
115 + if hasattr(torch.compiler, "skip_all_guards_unsafe"):
116 + # Torch 2.10+ provides skip_all_guards_unsafe
117 + options["guard_filter_fn"] = torch.compiler.skip_all_guards_unsafe
118 + else:
119 + # Equivalent fallback for older PyTorch: skip all guards
120 + options["guard_filter_fn"] = lambda x: [False for _ in x]
121
122 compiled_ptr: Any = self.forward
123 # Validate that unbacked dynamic shapes require VLLM_USE_BYTECODE_HOOK=False