-
Notifications
You must be signed in to change notification settings - Fork 25.6k
[scan] support gen_schema for scan #158864
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
[ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/158864
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit a9f4e34 with merge base 96bd33b ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
[ghstack-poisoned]
[ghstack-poisoned]
We don't want to allow scan's combine_fn to mutate its inputs. The semantic of the mutation can be confusing. For example: ```python def combine_fn(init, x): ``` If combine_fn mutates init, only first iteration mutates init, the rest of the iterations mutates the previous carry, which is an intermediate result. This is kind of a weird semantic because the only observable mutation is for init, which can be done outside of the combine_fn. If combine_fn mutates x, where x is a slice of scanned inputs (i.e. xs), this pattern is more meaningful but we've not seen any use case yet. [ghstack-poisoned]
We don't want to allow scan's combine_fn to mutate its inputs. The semantic of the mutation can be confusing. For example: ```python def combine_fn(init, x): ``` If combine_fn mutates init, only first iteration mutates init, the rest of the iterations mutates the previous carry, which is an intermediate result. This is kind of a weird semantic because the only observable mutation is for init, which can be done outside of the combine_fn. If combine_fn mutates x, where x is a slice of scanned inputs (i.e. xs), this pattern is more meaningful but we've not seen any use case yet. [ghstack-poisoned]
We don't want to allow scan's combine_fn to mutate its inputs. The semantic of the mutation can be confusing. For example: ```python def combine_fn(init, x): ``` If combine_fn mutates init, only first iteration mutates init, the rest of the iterations mutates the previous carry, which is an intermediate result. This is kind of a weird semantic because the only observable mutation is for init, which can be done outside of the combine_fn. If combine_fn mutates x, where x is a slice of scanned inputs (i.e. xs), this pattern is more meaningful but we've not seen any use case yet. [ghstack-poisoned]
We don't want to allow scan's combine_fn to mutate its inputs. The semantic of the mutation can be confusing. For example: ```python def combine_fn(init, x): ``` If combine_fn mutates init, only first iteration mutates init, the rest of the iterations mutates the previous carry, which is an intermediate result. This is kind of a weird semantic because the only observable mutation is for init, which can be done outside of the combine_fn. If combine_fn mutates x, where x is a slice of scanned inputs (i.e. xs), this pattern is more meaningful but we've not seen any use case yet. [ghstack-poisoned]
We don't want to allow scan's combine_fn to mutate its inputs. The semantic of the mutation can be confusing. For example: ```python def combine_fn(init, x): ``` If combine_fn mutates init, only first iteration mutates init, the rest of the iterations mutates the previous carry, which is an intermediate result. This is kind of a weird semantic because the only observable mutation is for init, which can be done outside of the combine_fn. If combine_fn mutates x, where x is a slice of scanned inputs (i.e. xs), this pattern is more meaningful but we've not seen any use case yet. [ghstack-poisoned]
Starting merge as part of PR stack under #158883 |
3 similar comments
Starting merge as part of PR stack under #158883 |
Starting merge as part of PR stack under #158883 |
Starting merge as part of PR stack under #158883 |
We don't want to allow scan's combine_fn to mutate its inputs. The semantic of the mutation can be confusing. For example: ```python def combine_fn(init, x): ``` If combine_fn mutates init, only first iteration mutates init, the rest of the iterations mutates the previous carry, which is an intermediate result. This is kind of a weird semantic because the only observable mutation is for init, which can be done outside of the combine_fn. If combine_fn mutates x, where x is a slice of scanned inputs (i.e. xs), this pattern is more meaningful but we've not seen any use case yet. [ghstack-poisoned]
Starting merge as part of PR stack under #158883 |
We don't want to allow scan's combine_fn to mutate its inputs. The semantic of the mutation can be confusing. For example: ```python def combine_fn(init, x): ``` If combine_fn mutates init, only first iteration mutates init, the rest of the iterations mutates the previous carry, which is an intermediate result. This is kind of a weird semantic because the only observable mutation is for init, which can be done outside of the combine_fn. If combine_fn mutates x, where x is a slice of scanned inputs (i.e. xs), this pattern is more meaningful but we've not seen any use case yet. Pull Request resolved: pytorch#158864 Approved by: https://github.com/zou3519 ghstack dependencies: pytorch#154193, pytorch#158965, pytorch#158863
…58883) In-place mutation may create inter-loop dependency that breaks the parallelism we have for associative_scan so we ban input mutations. Pull Request resolved: pytorch#158883 Approved by: https://github.com/zou3519 ghstack dependencies: pytorch#154193, pytorch#158965, pytorch#158863, pytorch#158864
We don't want to allow scan's combine_fn to mutate its inputs. The semantic of the mutation can be confusing. For example: ```python def combine_fn(init, x): ``` If combine_fn mutates init, only first iteration mutates init, the rest of the iterations mutates the previous carry, which is an intermediate result. This is kind of a weird semantic because the only observable mutation is for init, which can be done outside of the combine_fn. If combine_fn mutates x, where x is a slice of scanned inputs (i.e. xs), this pattern is more meaningful but we've not seen any use case yet. Pull Request resolved: pytorch#158864 Approved by: https://github.com/zou3519 ghstack dependencies: pytorch#154193, pytorch#158965, pytorch#158863
…58883) In-place mutation may create inter-loop dependency that breaks the parallelism we have for associative_scan so we ban input mutations. Pull Request resolved: pytorch#158883 Approved by: https://github.com/zou3519 ghstack dependencies: pytorch#154193, pytorch#158965, pytorch#158863, pytorch#158864
Stack from ghstack (oldest at bottom):
We don't want to allow scan's combine_fn to mutate its inputs. The semantic of the mutation can be confusing. For example:
If combine_fn mutates init, only first iteration mutates init, the rest of the iterations mutates the previous carry, which is an intermediate result. This is kind of a weird semantic because the only observable mutation is for init, which can be done outside of the combine_fn.
If combine_fn mutates x, where x is a slice of scanned inputs (i.e. xs), this pattern is more meaningful but we've not seen any use case yet.