pytorch
7eeb392e - [Inductor] Enable the item() and nonzero() codegen test on CPU (#110262)

Commit
1 year ago
[Inductor] Enable the item() and nonzero() codegen test on CPU (#110262) **Summary** Follow up https://github.com/pytorch/pytorch/pull/109893 which has issue in support of CPU as reported in https://github.com/pytorch/pytorch/issues/109897. This fix mainly includes 2 changes: - Current implementation of `rename_indexing` https://github.com/pytorch/pytorch/blob/10c646295d3512237cfb3ab44aa21dfcc9832441/torch/_inductor/codegen/common.py#L1023 only add symbol name start with `s` or `ps` into `kernel.args.sizevars`. However, `Unbacked symint` will start as `i`, so we extend the implementation of `rename_indexing` to support symbol start with `i`. - Currently, the internal loop index also name start as `i`. Since `i` has has been used as `Unbacked symint`, change the name to start with `x` which should align with trition. **Test Plan** ``` python -u -m pytest -s -v test_torchinductor_dynamic_shapes.py -k test_bool_mask_nobreak python -u -m pytest -s -v test_torchinductor_dynamic_shapes.py -k test_nonzero_size_factory_nobreak python -u -m pytest -s -v test_torchinductor_dynamic_shapes.py -k test_item_zeros_nobreak ``` Pull Request resolved: https://github.com/pytorch/pytorch/pull/110262 Approved by: https://github.com/ezyang, https://github.com/jgong5
Committer
Parents
Loading