KEMBAR78
NJT binary pointwise broadcasting support via jagged <-> padded dense conversion by jbschlosser · Pull Request #133021 · pytorch/pytorch · GitHub
Skip to content

Conversation

@jbschlosser
Copy link
Contributor

@jbschlosser jbschlosser commented Aug 8, 2024

Stack from ghstack (oldest at bottom):

Related: #132695

This PR uses padded dense <-> jagged conversions to handle binary pointwise broadcasting of (NT, T) and (T, NT). This includes:

  • (B, j0, D) + (1, 1, 1)
  • (B, j0, D) + (B, 1, 1)
  • (B, j0, D) + (B, 1, D)
  • etc.

This PR also adds (hacky) support for bool inputs to the jagged <-> padded dense conversions. The underlying CUDA kernels do not support integer / bool inputs; so the following workaround is employed: convert input -> half, run conversion kernel, convert output -> bool. Note that this bool support is needed specifically for the backward formula of fmax, and likely others.

cc @cpuhrsch @bhosmer @drisspg @soulitzer @davidberard98 @YuqingJ

@pytorch-bot
Copy link

pytorch-bot bot commented Aug 8, 2024

🔗 Helpful Links

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

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

✅ No Failures

As of commit 6a17e36 with merge base fd182b9 (image):
💚 Looks good so far! There are no failures yet. 💚

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

@jbschlosser jbschlosser requested review from YuqingJ, davidberard98 and soulitzer and removed request for soulitzer August 8, 2024 18:24
…added dense conversion"


Related: #132695

This PR uses padded dense <-> jagged conversions to handle binary pointwise broadcasting of (NT, T) and (T, NT). This includes:
* `(B, j0, D) + (1, 1, 1)`
* `(B, j0, D) + (B, 1, 1)`
* `(B, j0, D) + (B, 1, D)`
* etc.

[ghstack-poisoned]
jbschlosser added a commit that referenced this pull request Aug 8, 2024
… conversion

ghstack-source-id: 532782d
Pull Request resolved: #133021
…added dense conversion"


Related: #132695

This PR uses padded dense <-> jagged conversions to handle binary pointwise broadcasting of (NT, T) and (T, NT). This includes:
* `(B, j0, D) + (1, 1, 1)`
* `(B, j0, D) + (B, 1, 1)`
* `(B, j0, D) + (B, 1, D)`
* etc.

[ghstack-poisoned]
jbschlosser added a commit that referenced this pull request Aug 9, 2024
… conversion

ghstack-source-id: f49eef5
Pull Request resolved: #133021
…added dense conversion"


Related: #132695

This PR uses padded dense <-> jagged conversions to handle binary pointwise broadcasting of (NT, T) and (T, NT). This includes:
* `(B, j0, D) + (1, 1, 1)`
* `(B, j0, D) + (B, 1, 1)`
* `(B, j0, D) + (B, 1, D)`
* etc.

[ghstack-poisoned]
…added dense conversion"


Related: #132695

This PR uses padded dense <-> jagged conversions to handle binary pointwise broadcasting of (NT, T) and (T, NT). This includes:
* `(B, j0, D) + (1, 1, 1)`
* `(B, j0, D) + (B, 1, 1)`
* `(B, j0, D) + (B, 1, D)`
* etc.

[ghstack-poisoned]
jbschlosser added a commit that referenced this pull request Sep 5, 2024
… conversion

ghstack-source-id: 205b218
Pull Request resolved: #133021
…added dense conversion"


Related: #132695

This PR uses padded dense <-> jagged conversions to handle binary pointwise broadcasting of (NT, T) and (T, NT). This includes:
* `(B, j0, D) + (1, 1, 1)`
* `(B, j0, D) + (B, 1, 1)`
* `(B, j0, D) + (B, 1, D)`
* etc.

[ghstack-poisoned]
jbschlosser added a commit that referenced this pull request Sep 6, 2024
… conversion

ghstack-source-id: 92076b4
Pull Request resolved: #133021
…added dense conversion"


Related: #132695

This PR uses padded dense <-> jagged conversions to handle binary pointwise broadcasting of (NT, T) and (T, NT). This includes:
* `(B, j0, D) + (1, 1, 1)`
* `(B, j0, D) + (B, 1, 1)`
* `(B, j0, D) + (B, 1, D)`
* etc.

[ghstack-poisoned]
jbschlosser added a commit that referenced this pull request Sep 9, 2024
… conversion

ghstack-source-id: 0c83e03
Pull Request resolved: #133021
@jbschlosser jbschlosser added module: nestedtensor NestedTensor tag see issue #25032 topic: improvements topic category release notes: nested tensor Changes that have a direct impact on nested tensors labels Sep 9, 2024
…added dense conversion"


Related: #132695

This PR uses padded dense <-> jagged conversions to handle binary pointwise broadcasting of (NT, T) and (T, NT). This includes:
* `(B, j0, D) + (1, 1, 1)`
* `(B, j0, D) + (B, 1, 1)`
* `(B, j0, D) + (B, 1, D)`
* etc.

cc cpuhrsch bhosmer drisspg soulitzer davidberard98 YuqingJ

[ghstack-poisoned]
…added dense conversion"


Related: #132695

This PR uses padded dense <-> jagged conversions to handle binary pointwise broadcasting of (NT, T) and (T, NT). This includes:
* `(B, j0, D) + (1, 1, 1)`
* `(B, j0, D) + (B, 1, 1)`
* `(B, j0, D) + (B, 1, D)`
* etc.

cc cpuhrsch bhosmer drisspg soulitzer davidberard98 YuqingJ

[ghstack-poisoned]
…added dense conversion"


Related: #132695

This PR uses padded dense <-> jagged conversions to handle binary pointwise broadcasting of (NT, T) and (T, NT). This includes:
* `(B, j0, D) + (1, 1, 1)`
* `(B, j0, D) + (B, 1, 1)`
* `(B, j0, D) + (B, 1, D)`
* etc.

cc cpuhrsch bhosmer drisspg soulitzer davidberard98 YuqingJ

[ghstack-poisoned]
…added dense conversion"


Related: #132695

This PR uses padded dense <-> jagged conversions to handle binary pointwise broadcasting of (NT, T) and (T, NT). This includes:
* `(B, j0, D) + (1, 1, 1)`
* `(B, j0, D) + (B, 1, 1)`
* `(B, j0, D) + (B, 1, D)`
* etc.

cc cpuhrsch bhosmer drisspg soulitzer davidberard98 YuqingJ

[ghstack-poisoned]
jbschlosser added a commit that referenced this pull request Sep 17, 2024
… conversion

ghstack-source-id: eec2c7d
Pull Request resolved: #133021
…added dense conversion"


Related: #132695

This PR uses padded dense <-> jagged conversions to handle binary pointwise broadcasting of (NT, T) and (T, NT). This includes:
* `(B, j0, D) + (1, 1, 1)`
* `(B, j0, D) + (B, 1, 1)`
* `(B, j0, D) + (B, 1, D)`
* etc.

cc cpuhrsch bhosmer drisspg soulitzer davidberard98 YuqingJ

[ghstack-poisoned]
…added dense conversion"


Related: #132695

This PR uses padded dense <-> jagged conversions to handle binary pointwise broadcasting of (NT, T) and (T, NT). This includes:
* `(B, j0, D) + (1, 1, 1)`
* `(B, j0, D) + (B, 1, 1)`
* `(B, j0, D) + (B, 1, D)`
* etc.

cc cpuhrsch bhosmer drisspg soulitzer davidberard98 YuqingJ

[ghstack-poisoned]
jbschlosser added a commit that referenced this pull request Sep 18, 2024
… conversion

ghstack-source-id: 36d6fb7
Pull Request resolved: #133021
…added dense conversion"


Related: #132695

This PR uses padded dense <-> jagged conversions to handle binary pointwise broadcasting of (NT, T) and (T, NT). This includes:
* `(B, j0, D) + (1, 1, 1)`
* `(B, j0, D) + (B, 1, 1)`
* `(B, j0, D) + (B, 1, D)`
* etc.

cc cpuhrsch bhosmer drisspg soulitzer davidberard98 YuqingJ

[ghstack-poisoned]
…added dense conversion"


Related: #132695

This PR uses padded dense <-> jagged conversions to handle binary pointwise broadcasting of (NT, T) and (T, NT). This includes:
* `(B, j0, D) + (1, 1, 1)`
* `(B, j0, D) + (B, 1, 1)`
* `(B, j0, D) + (B, 1, D)`
* etc.

cc cpuhrsch bhosmer drisspg soulitzer davidberard98 YuqingJ

[ghstack-poisoned]
jbschlosser added a commit that referenced this pull request Sep 23, 2024
… conversion

ghstack-source-id: 2668447
Pull Request resolved: #133021
…added dense conversion"


Related: #132695

This PR uses padded dense <-> jagged conversions to handle binary pointwise broadcasting of (NT, T) and (T, NT). This includes:
* `(B, j0, D) + (1, 1, 1)`
* `(B, j0, D) + (B, 1, 1)`
* `(B, j0, D) + (B, 1, D)`
* etc.

cc cpuhrsch bhosmer drisspg soulitzer davidberard98 YuqingJ

[ghstack-poisoned]
…added dense conversion"


Related: #132695

This PR uses padded dense <-> jagged conversions to handle binary pointwise broadcasting of (NT, T) and (T, NT). This includes:
* `(B, j0, D) + (1, 1, 1)`
* `(B, j0, D) + (B, 1, 1)`
* `(B, j0, D) + (B, 1, D)`
* etc.

cc cpuhrsch bhosmer drisspg soulitzer davidberard98 YuqingJ

[ghstack-poisoned]
…added dense conversion"


Related: #132695

This PR uses padded dense <-> jagged conversions to handle binary pointwise broadcasting of (NT, T) and (T, NT). This includes:
* `(B, j0, D) + (1, 1, 1)`
* `(B, j0, D) + (B, 1, 1)`
* `(B, j0, D) + (B, 1, D)`
* etc.

This PR also adds (hacky) support for bool inputs to the jagged <-> padded dense conversions. The underlying CUDA kernels do not support integer / bool inputs; so the following workaround is employed: `convert input -> half, run conversion kernel, convert output -> bool`. Note that this bool support is needed specifically for the backward formula of `fmax`, and likely others.

cc cpuhrsch bhosmer drisspg soulitzer davidberard98 YuqingJ

[ghstack-poisoned]
jbschlosser added a commit that referenced this pull request Sep 24, 2024
… conversion

ghstack-source-id: 192c040
Pull Request resolved: #133021
@jbschlosser
Copy link
Contributor Author

@pytorchbot merge

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Sep 24, 2024
@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

BoyuanFeng pushed a commit to BoyuanFeng/pytorch that referenced this pull request Sep 25, 2024
… conversion (pytorch#133021)

Related: pytorch#132695

This PR uses padded dense <-> jagged conversions to handle binary pointwise broadcasting of (NT, T) and (T, NT). This includes:
* `(B, j0, D) + (1, 1, 1)`
* `(B, j0, D) + (B, 1, 1)`
* `(B, j0, D) + (B, 1, D)`
* etc.

This PR also adds (hacky) support for bool inputs to the jagged <-> padded dense conversions. The underlying CUDA kernels do not support integer / bool inputs; so the following workaround is employed: `convert input -> half, run conversion kernel, convert output -> bool`. Note that this bool support is needed specifically for the backward formula of `fmax`, and likely others.

Pull Request resolved: pytorch#133021
Approved by: https://github.com/cpuhrsch
@github-actions github-actions bot deleted the gh/jbschlosser/172/head branch October 25, 2024 02:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk Trigger trunk jobs on your pull request Merged module: nestedtensor NestedTensor tag see issue #25032 release notes: nested tensor Changes that have a direct impact on nested tensors topic: improvements topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants