Skip to content

Unbacked SymInt support for pointwise and multiple boolean masks#94790

Closed
ezyang wants to merge 9 commits intogh/ezyang/1815/basefrom
gh/ezyang/1815/head
Closed

Unbacked SymInt support for pointwise and multiple boolean masks#94790
ezyang wants to merge 9 commits intogh/ezyang/1815/basefrom
gh/ezyang/1815/head

Conversation

@ezyang
Copy link
Copy Markdown
Contributor

@ezyang ezyang commented Feb 14, 2023

Stack from ghstack (oldest at bottom):

This PR adds support for some more unbacked SymInt cases extracted from CrystalDPR

  • You can do pointwise operations with tensors that have unbacked SymInts; fixes involve making broadcasting avoid touching unbacked SymInts if not necessary (in both PrimTorch and the fake tensor fastpath), switching PrimTorch decomp for elementwise operations to use empty_permuted and short circuiting if inputs are contiguous. I added definitely_true and parallel_or helpers to handle this case elegantly; see docblocks for more discussion.
    • The is_contiguous change requires me to update PrimTorch to let is_contiguous through directly, which seems fine.
  • Add a new constrain_unify helper which lets you specify that two unbacked SymInts are the same. This addresses the case when you use the same boolean mask to index into different tensors; the resulting slices have the same shapes but we do not currently know this statically.

Signed-off-by: Edward Z. Yang ezyang@meta.com

Signed-off-by: Edward Z. Yang <ezyang@meta.com>

[ghstack-poisoned]
@pytorch-bot
Copy link
Copy Markdown

pytorch-bot bot commented Feb 14, 2023

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/94790

Note: Links to docs will display an error until the docs builds have been completed.

This comment was automatically generated by Dr. CI and updates every 15 minutes.

Signed-off-by: Edward Z. Yang <ezyangmeta.com>

[ghstack-poisoned]
Signed-off-by: Edward Z. Yang <ezyangmeta.com>

[ghstack-poisoned]
@ezyang ezyang changed the title Unbacked SymInt support for CrystalDPR Unbacked SymInt support for pointwise and multiple boolean masks Feb 20, 2023
@ezyang ezyang requested a review from ngimel February 20, 2023 21:37
… masks"


This PR adds support for some more unbacked SymInt cases extracted from CrystalDPR

* You can do pointwise operations with tensors that have unbacked SymInts; fixes involve making broadcasting avoid touching unbacked SymInts if not necessary (in both PrimTorch and the fake tensor fastpath), switching PrimTorch decomp for elementwise operations to use `empty_permuted and short circuiting if inputs are contiguous. I added `definitely_true` and `parallel_or` helpers to handle this case elegantly; see docblocks for more discussion.
  * The `is_contiguous` change requires me to update PrimTorch to let `is_contiguous` through directly, which seems fine.
* Add a new `constrain_unify` helper which lets you specify that two unbacked SymInts are the same. This addresses the case when you use the same boolean mask to index into different tensors; the resulting slices have the same shapes but we do not currently know this statically.

Signed-off-by: Edward Z. Yang <ezyangmeta.com>

[ghstack-poisoned]
@ezyang ezyang mentioned this pull request Feb 20, 2023
ezyang added a commit that referenced this pull request Feb 20, 2023
Signed-off-by: Edward Z. Yang <ezyangmeta.com>

ghstack-source-id: c0f6751
Pull Request resolved: #94790
… masks"


This PR adds support for some more unbacked SymInt cases extracted from CrystalDPR

* You can do pointwise operations with tensors that have unbacked SymInts; fixes involve making broadcasting avoid touching unbacked SymInts if not necessary (in both PrimTorch and the fake tensor fastpath), switching PrimTorch decomp for elementwise operations to use `empty_permuted and short circuiting if inputs are contiguous. I added `definitely_true` and `parallel_or` helpers to handle this case elegantly; see docblocks for more discussion.
  * The `is_contiguous` change requires me to update PrimTorch to let `is_contiguous` through directly, which seems fine.
* Add a new `constrain_unify` helper which lets you specify that two unbacked SymInts are the same. This addresses the case when you use the same boolean mask to index into different tensors; the resulting slices have the same shapes but we do not currently know this statically.

Signed-off-by: Edward Z. Yang <ezyangmeta.com>

[ghstack-poisoned]
ezyang added a commit that referenced this pull request Feb 21, 2023
Signed-off-by: Edward Z. Yang <ezyangmeta.com>

ghstack-source-id: b7c8f7c
Pull Request resolved: #94790
… masks"


This PR adds support for some more unbacked SymInt cases extracted from CrystalDPR

* You can do pointwise operations with tensors that have unbacked SymInts; fixes involve making broadcasting avoid touching unbacked SymInts if not necessary (in both PrimTorch and the fake tensor fastpath), switching PrimTorch decomp for elementwise operations to use `empty_permuted and short circuiting if inputs are contiguous. I added `definitely_true` and `parallel_or` helpers to handle this case elegantly; see docblocks for more discussion.
  * The `is_contiguous` change requires me to update PrimTorch to let `is_contiguous` through directly, which seems fine.
* Add a new `constrain_unify` helper which lets you specify that two unbacked SymInts are the same. This addresses the case when you use the same boolean mask to index into different tensors; the resulting slices have the same shapes but we do not currently know this statically.

Signed-off-by: Edward Z. Yang <ezyangmeta.com>

[ghstack-poisoned]
… masks"


This PR adds support for some more unbacked SymInt cases extracted from CrystalDPR

* You can do pointwise operations with tensors that have unbacked SymInts; fixes involve making broadcasting avoid touching unbacked SymInts if not necessary (in both PrimTorch and the fake tensor fastpath), switching PrimTorch decomp for elementwise operations to use `empty_permuted and short circuiting if inputs are contiguous. I added `definitely_true` and `parallel_or` helpers to handle this case elegantly; see docblocks for more discussion.
  * The `is_contiguous` change requires me to update PrimTorch to let `is_contiguous` through directly, which seems fine.
* Add a new `constrain_unify` helper which lets you specify that two unbacked SymInts are the same. This addresses the case when you use the same boolean mask to index into different tensors; the resulting slices have the same shapes but we do not currently know this statically.

Signed-off-by: Edward Z. Yang <ezyangmeta.com>

[ghstack-poisoned]
… masks"


This PR adds support for some more unbacked SymInt cases extracted from CrystalDPR

* You can do pointwise operations with tensors that have unbacked SymInts; fixes involve making broadcasting avoid touching unbacked SymInts if not necessary (in both PrimTorch and the fake tensor fastpath), switching PrimTorch decomp for elementwise operations to use `empty_permuted and short circuiting if inputs are contiguous. I added `definitely_true` and `parallel_or` helpers to handle this case elegantly; see docblocks for more discussion.
  * The `is_contiguous` change requires me to update PrimTorch to let `is_contiguous` through directly, which seems fine.
* Add a new `constrain_unify` helper which lets you specify that two unbacked SymInts are the same. This addresses the case when you use the same boolean mask to index into different tensors; the resulting slices have the same shapes but we do not currently know this statically.

Signed-off-by: Edward Z. Yang <ezyangmeta.com>

[ghstack-poisoned]
… masks"


This PR adds support for some more unbacked SymInt cases extracted from CrystalDPR

* You can do pointwise operations with tensors that have unbacked SymInts; fixes involve making broadcasting avoid touching unbacked SymInts if not necessary (in both PrimTorch and the fake tensor fastpath), switching PrimTorch decomp for elementwise operations to use `empty_permuted and short circuiting if inputs are contiguous. I added `definitely_true` and `parallel_or` helpers to handle this case elegantly; see docblocks for more discussion.
  * The `is_contiguous` change requires me to update PrimTorch to let `is_contiguous` through directly, which seems fine.
* Add a new `constrain_unify` helper which lets you specify that two unbacked SymInts are the same. This addresses the case when you use the same boolean mask to index into different tensors; the resulting slices have the same shapes but we do not currently know this statically.

Signed-off-by: Edward Z. Yang <ezyangmeta.com>

[ghstack-poisoned]
ezyang added a commit that referenced this pull request Feb 21, 2023
Signed-off-by: Edward Z. Yang <ezyangmeta.com>

ghstack-source-id: 9591449
Pull Request resolved: #94790
@ezyang ezyang requested a review from suo February 21, 2023 15:39
@ezyang ezyang closed this Feb 23, 2023
@facebook-github-bot facebook-github-bot deleted the gh/ezyang/1815/head branch June 8, 2023 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/inductor ciflow/trunk Trigger trunk jobs on your pull request release notes: fx release notes category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants