Enable all SIM rules except disabled ones (#164645)

`SIM` rules are useful for simplifying boolean expressions and enhances code readability.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/164645
Approved by: https://github.com/ezyang
This commit is contained in:
Yuanyuan Chen
2025-10-05 07:38:25 +00:00
committed by PyTorch MergeBot
parent 3c5ca685d6
commit 321e602692
97 changed files with 182 additions and 255 deletions

View File

@ -150,7 +150,7 @@ def gen_vmap_inplace_plumbing(native_function: NativeFunction) -> str | None:
assert schema.kind() == SchemaKind.inplace
if not is_mutated_arg(schema.arguments.flat_all[0]):
return None
if not len([arg for arg in schema.arguments.flat_all if is_mutated_arg(arg)]) == 1:
if len([arg for arg in schema.arguments.flat_all if is_mutated_arg(arg)]) != 1:
return None
# Only support cases where all returns are Tensors or vector<Tensor>