Repository navigation
Add support for full uint64 range + tensor data to fold_in() - #189767
jbschlosser wants to merge 4 commits into
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/189767
Note: Links to docs will display an error until the docs builds have been completed. ✅ You can merge normally! (1 Unrelated Failure)As of commit a0f6a7e with merge base 20aa640 ( BROKEN TRUNK - The following job failed but were present on the merge base:👉 Rebase onto the `viable/strict` branch to avoid these failures
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
Attention! native_functions.yaml was changedIf you are adding a new function or defaulted argument to native_functions.yaml, you cannot use it from pre-existing Python frontend code until our FC window passes (two weeks). Split your PR into two PRs, one which adds the new C++ functionality, and one that makes use of it from Python, and land them two weeks apart. See https://github.com/pytorch/pytorch/wiki/PyTorch's-Python-Frontend-Backward-and-Forward-Compatibility-Policy#forwards-compatibility-fc for more info. |
| auto key_contig = key.contiguous(); | ||
|
|
||
| constexpr int block_size = 256; | ||
| int num_blocks = std::min( |
There was a problem hiding this comment.
ooc, why grid-stride loop here? You can just launch as many blocks as you need?
There was a problem hiding this comment.
yeah good point, I moved over to this paradigm already for the generation kernels. I think I'll do the same here (in a follow-up PR if that's okay)
|
@pytorchbot merge |
Merge startedYour 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 |
Merge failedReason: 1 jobs have failed, first few of them are: trunk / linux-jammy-rocm-py3.10-mi350 / test (distributed, 1, 3, linux.rocm.gpu.gfx950.2) Details for Dev Infra teamRaised by workflow job |
|
AFAICT the revert was spurious so I'm relanding after a rebase |
|
@pytorchbot merge |
Merge startedYour 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 |
|
Starting merge as part of PR stack under #189735 |
…kernels (#189735) Original repro in P2415048693. Found to affect the `_philox_uniform` / `_philox_normal` ops in practice, which currently utilize `FallbackKernel` and are re-inplaced as of #188495. `FallbackKernel` previously did not record that the returned buffer aliases the input for re-inplaced ops. As a result, memory planning treated the input buffer as dead after the op and wrongly reused its storage while the aliasing output was still live, corrupting results. This PR fixes this by recording the output <-> first-arg alias in `FallbackKernel` so memory planning keeps the buffer live. Pull Request resolved: #189735 Approved by: https://github.com/eellison ghstack dependencies: #189767
…#189767) This PR addresses beta user feedback on `fold_in(key, data)`: * Tightens up the support regarding dtype for `data`; we now explicitly support ints in the range `[-2**63, 2**64 - 1]` (i.e. all signed int64 AND uint64 values) with negative values reinterpreted as two's complement of uint64 values, following the precedent set by [`manual_seed()`](https://docs.pytorch.org/docs/2.13/generated/torch.manual_seed.html). This requires some python-side gymnastics since we utilize the standard ATen op parsing logic that treats ints as int64. Docs were also updated to indicate this. * Adds a Tensor `data` ATen op overload that can be used to avoid baking in `data` to captured CUDAGraphs. Note that, for simplicity, we only allow a single item Tensor `data` for now. In the future, if necessary, we can support folding broadcastable data across a batched set of keys. Pull Request resolved: pytorch#189767 Approved by: https://github.com/ngimel ghstack dependencies: pytorch#189768
…ytorch#189767)" This reverts commit fb14ce5. Reverted pytorch#189767 on behalf of https://github.com/meta-codesync due to Diff reverted internally ([comment](pytorch#189767 (comment)))
| - func: _philox_key_fold_in.Tensor(Tensor key, Tensor data) -> Tensor | ||
| variants: function | ||
| dispatch: | ||
| CUDA: _philox_key_fold_in_tensor_cuda |
…#189767) This PR addresses beta user feedback on `fold_in(key, data)`: * Tightens up the support regarding dtype for `data`; we now explicitly support ints in the range `[-2**63, 2**64 - 1]` (i.e. all signed int64 AND uint64 values) with negative values reinterpreted as two's complement of uint64 values, following the precedent set by [`manual_seed()`](https://docs.pytorch.org/docs/2.13/generated/torch.manual_seed.html). This requires some python-side gymnastics since we utilize the standard ATen op parsing logic that treats ints as int64. Docs were also updated to indicate this. * Adds a Tensor `data` ATen op overload that can be used to avoid baking in `data` to captured CUDAGraphs. Note that, for simplicity, we only allow a single item Tensor `data` for now. In the future, if necessary, we can support folding broadcastable data across a batched set of keys. Pull Request resolved: pytorch#189767 Approved by: https://github.com/ngimel ghstack dependencies: pytorch#189768
…ytorch#189767)" This reverts commit fb14ce5. Reverted pytorch#189767 on behalf of https://github.com/meta-codesync due to Diff reverted internally ([comment](pytorch#189767 (comment)))
…#189767) This PR addresses beta user feedback on `fold_in(key, data)`: * Tightens up the support regarding dtype for `data`; we now explicitly support ints in the range `[-2**63, 2**64 - 1]` (i.e. all signed int64 AND uint64 values) with negative values reinterpreted as two's complement of uint64 values, following the precedent set by [`manual_seed()`](https://docs.pytorch.org/docs/2.13/generated/torch.manual_seed.html). This requires some python-side gymnastics since we utilize the standard ATen op parsing logic that treats ints as int64. Docs were also updated to indicate this. * Adds a Tensor `data` ATen op overload that can be used to avoid baking in `data` to captured CUDAGraphs. Note that, for simplicity, we only allow a single item Tensor `data` for now. In the future, if necessary, we can support folding broadcastable data across a batched set of keys. Pull Request resolved: pytorch#189767 Approved by: https://github.com/ngimel
…kernels (pytorch#189735) Original repro in P2415048693. Found to affect the `_philox_uniform` / `_philox_normal` ops in practice, which currently utilize `FallbackKernel` and are re-inplaced as of pytorch#188495. `FallbackKernel` previously did not record that the returned buffer aliases the input for re-inplaced ops. As a result, memory planning treated the input buffer as dead after the op and wrongly reused its storage while the aliasing output was still live, corrupting results. This PR fixes this by recording the output <-> first-arg alias in `FallbackKernel` so memory planning keeps the buffer live. Pull Request resolved: pytorch#189735 Approved by: https://github.com/eellison ghstack dependencies: pytorch#189767
…#189767) This PR addresses beta user feedback on `fold_in(key, data)`: * Tightens up the support regarding dtype for `data`; we now explicitly support ints in the range `[-2**63, 2**64 - 1]` (i.e. all signed int64 AND uint64 values) with negative values reinterpreted as two's complement of uint64 values, following the precedent set by [`manual_seed()`](https://docs.pytorch.org/docs/2.13/generated/torch.manual_seed.html). This requires some python-side gymnastics since we utilize the standard ATen op parsing logic that treats ints as int64. Docs were also updated to indicate this. * Adds a Tensor `data` ATen op overload that can be used to avoid baking in `data` to captured CUDAGraphs. Note that, for simplicity, we only allow a single item Tensor `data` for now. In the future, if necessary, we can support folding broadcastable data across a batched set of keys. Pull Request resolved: pytorch#189767 Approved by: https://github.com/ngimel ghstack dependencies: pytorch#189768
…ytorch#189767)" This reverts commit fb14ce5. Reverted pytorch#189767 on behalf of https://github.com/meta-codesync due to Diff reverted internally ([comment](pytorch#189767 (comment)))
…#189767) This PR addresses beta user feedback on `fold_in(key, data)`: * Tightens up the support regarding dtype for `data`; we now explicitly support ints in the range `[-2**63, 2**64 - 1]` (i.e. all signed int64 AND uint64 values) with negative values reinterpreted as two's complement of uint64 values, following the precedent set by [`manual_seed()`](https://docs.pytorch.org/docs/2.13/generated/torch.manual_seed.html). This requires some python-side gymnastics since we utilize the standard ATen op parsing logic that treats ints as int64. Docs were also updated to indicate this. * Adds a Tensor `data` ATen op overload that can be used to avoid baking in `data` to captured CUDAGraphs. Note that, for simplicity, we only allow a single item Tensor `data` for now. In the future, if necessary, we can support folding broadcastable data across a batched set of keys. Pull Request resolved: pytorch#189767 Approved by: https://github.com/ngimel
…kernels (pytorch#189735) Original repro in P2415048693. Found to affect the `_philox_uniform` / `_philox_normal` ops in practice, which currently utilize `FallbackKernel` and are re-inplaced as of pytorch#188495. `FallbackKernel` previously did not record that the returned buffer aliases the input for re-inplaced ops. As a result, memory planning treated the input buffer as dead after the op and wrongly reused its storage while the aliasing output was still live, corrupting results. This PR fixes this by recording the output <-> first-arg alias in `FallbackKernel` so memory planning keeps the buffer live. Pull Request resolved: pytorch#189735 Approved by: https://github.com/eellison ghstack dependencies: pytorch#189767
…#189767) This PR addresses beta user feedback on `fold_in(key, data)`: * Tightens up the support regarding dtype for `data`; we now explicitly support ints in the range `[-2**63, 2**64 - 1]` (i.e. all signed int64 AND uint64 values) with negative values reinterpreted as two's complement of uint64 values, following the precedent set by [`manual_seed()`](https://docs.pytorch.org/docs/2.13/generated/torch.manual_seed.html). This requires some python-side gymnastics since we utilize the standard ATen op parsing logic that treats ints as int64. Docs were also updated to indicate this. * Adds a Tensor `data` ATen op overload that can be used to avoid baking in `data` to captured CUDAGraphs. Note that, for simplicity, we only allow a single item Tensor `data` for now. In the future, if necessary, we can support folding broadcastable data across a batched set of keys. Pull Request resolved: pytorch#189767 Approved by: https://github.com/ngimel ghstack dependencies: pytorch#189768
…ytorch#189767)" This reverts commit fb14ce5. Reverted pytorch#189767 on behalf of https://github.com/meta-codesync due to Diff reverted internally ([comment](pytorch#189767 (comment)))
…#189767) This PR addresses beta user feedback on `fold_in(key, data)`: * Tightens up the support regarding dtype for `data`; we now explicitly support ints in the range `[-2**63, 2**64 - 1]` (i.e. all signed int64 AND uint64 values) with negative values reinterpreted as two's complement of uint64 values, following the precedent set by [`manual_seed()`](https://docs.pytorch.org/docs/2.13/generated/torch.manual_seed.html). This requires some python-side gymnastics since we utilize the standard ATen op parsing logic that treats ints as int64. Docs were also updated to indicate this. * Adds a Tensor `data` ATen op overload that can be used to avoid baking in `data` to captured CUDAGraphs. Note that, for simplicity, we only allow a single item Tensor `data` for now. In the future, if necessary, we can support folding broadcastable data across a batched set of keys. Pull Request resolved: pytorch#189767 Approved by: https://github.com/ngimel
…kernels (pytorch#189735) Original repro in P2415048693. Found to affect the `_philox_uniform` / `_philox_normal` ops in practice, which currently utilize `FallbackKernel` and are re-inplaced as of pytorch#188495. `FallbackKernel` previously did not record that the returned buffer aliases the input for re-inplaced ops. As a result, memory planning treated the input buffer as dead after the op and wrongly reused its storage while the aliasing output was still live, corrupting results. This PR fixes this by recording the output <-> first-arg alias in `FallbackKernel` so memory planning keeps the buffer live. Pull Request resolved: pytorch#189735 Approved by: https://github.com/eellison ghstack dependencies: pytorch#189767
…kernels (pytorch#189735) Original repro in P2415048693. Found to affect the `_philox_uniform` / `_philox_normal` ops in practice, which currently utilize `FallbackKernel` and are re-inplaced as of pytorch#188495. `FallbackKernel` previously did not record that the returned buffer aliases the input for re-inplaced ops. As a result, memory planning treated the input buffer as dead after the op and wrongly reused its storage while the aliasing output was still live, corrupting results. This PR fixes this by recording the output <-> first-arg alias in `FallbackKernel` so memory planning keeps the buffer live. Pull Request resolved: pytorch#189735 Approved by: https://github.com/eellison ghstack dependencies: pytorch#189767
…e loop (#190036) Follow-up from #189767 to reduce complexity of `split()` / `fold_in()` kernels. On an H100, this generally results in neutral perf or speedups, with some exceptions: ``` split() ┌─────┬────────────┬─────────────┬────────────┬─────────┐ │ num │ n │ before (µs) │ after (µs) │ speedup │ ├─────┼────────────┼─────────────┼────────────┼─────────┤ │ 2 │ 1 │ 6.63 │ 6.51 │ 1.02x │ ├─────┼────────────┼─────────────┼────────────┼─────────┤ │ 2 │ 1,024 │ 6.49 │ 6.58 │ 0.99x │ ├─────┼────────────┼─────────────┼────────────┼─────────┤ │ 2 │ 16,384 │ 6.51 │ 6.60 │ 0.99x │ ├─────┼────────────┼─────────────┼────────────┼─────────┤ │ 2 │ 65,536 │ 6.50 │ 6.68 │ 0.97x │ ├─────┼────────────┼─────────────┼────────────┼─────────┤ │ 2 │ 262,144 │ 6.49 │ 6.64 │ 0.98x │ ├─────┼────────────┼─────────────┼────────────┼─────────┤ │ 2 │ 1,048,576 │ 21.55 │ 21.19 │ 1.02x │ ├─────┼────────────┼─────────────┼────────────┼─────────┤ │ 2 │ 4,194,304 │ 140.07 │ 127.49 │ 1.10x │ ├─────┼────────────┼─────────────┼────────────┼─────────┤ │ 2 │ 16,777,216 │ 533.07 │ 492.19 │ 1.08x │ ├─────┼────────────┼─────────────┼────────────┼─────────┤ │ 16 │ 1 │ 6.50 │ 6.43 │ 1.01x │ ├─────┼────────────┼─────────────┼────────────┼─────────┤ │ 16 │ 1,024 │ 6.47 │ 6.60 │ 0.98x │ ├─────┼────────────┼─────────────┼────────────┼─────────┤ │ 16 │ 16,384 │ 6.55 │ 6.52 │ 1.00x │ ├─────┼────────────┼─────────────┼────────────┼─────────┤ │ 16 │ 65,536 │ 8.89 │ 8.14 │ 1.09x │ ├─────┼────────────┼─────────────┼────────────┼─────────┤ │ 16 │ 262,144 │ 40.50 │ 33.04 │ 1.23x │ ├─────┼────────────┼─────────────┼────────────┼─────────┤ │ 16 │ 1,048,576 │ 183.46 │ 182.13 │ 1.01x │ ├─────┼────────────┼─────────────┼────────────┼─────────┤ │ 16 │ 4,194,304 │ 953.47 │ 975.40 │ 0.98x │ ├─────┼────────────┼─────────────┼────────────┼─────────┤ │ 128 │ 1 │ 6.38 │ 6.51 │ 0.98x │ ├─────┼────────────┼─────────────┼────────────┼─────────┤ │ 128 │ 1,024 │ 6.43 │ 6.61 │ 0.97x │ ├─────┼────────────┼─────────────┼────────────┼─────────┤ │ 128 │ 16,384 │ 14.32 │ 13.95 │ 1.03x │ ├─────┼────────────┼─────────────┼────────────┼─────────┤ │ 128 │ 65,536 │ 70.55 │ 58.48 │ 1.21x │ ├─────┼────────────┼─────────────┼────────────┼─────────┤ │ 128 │ 262,144 │ 299.95 │ 241.81 │ 1.24x │ ├─────┼────────────┼─────────────┼────────────┼─────────┤ │ 128 │ 1,048,576 │ 1312.20 │ 1419.08 │ 0.92x │ └─────┴────────────┴─────────────┴────────────┴─────────┘ fold_in() ┌─────────┬────────────┬─────────────┬────────────┬─────────┐ │ variant │ n │ before (µs) │ after (µs) │ speedup │ ├─────────┼────────────┼─────────────┼────────────┼─────────┤ │ int │ 1 │ 7.22 │ 6.96 │ 1.04x │ ├─────────┼────────────┼─────────────┼────────────┼─────────┤ │ int │ 1,024 │ 6.93 │ 6.91 │ 1.00x │ ├─────────┼────────────┼─────────────┼────────────┼─────────┤ │ int │ 16,384 │ 7.01 │ 6.99 │ 1.00x │ ├─────────┼────────────┼─────────────┼────────────┼─────────┤ │ int │ 65,536 │ 6.93 │ 6.96 │ 1.00x │ ├─────────┼────────────┼─────────────┼────────────┼─────────┤ │ int │ 262,144 │ 6.93 │ 7.02 │ 0.99x │ ├─────────┼────────────┼─────────────┼────────────┼─────────┤ │ int │ 1,048,576 │ 7.63 │ 7.04 │ 1.09x │ ├─────────┼────────────┼─────────────┼────────────┼─────────┤ │ int │ 4,194,304 │ 70.33 │ 66.66 │ 1.06x │ ├─────────┼────────────┼─────────────┼────────────┼─────────┤ │ int │ 16,777,216 │ 272.30 │ 249.00 │ 1.09x │ ├─────────┼────────────┼─────────────┼────────────┼─────────┤ │ tensor │ 1 │ 6.98 │ 6.58 │ 1.06x │ ├─────────┼────────────┼─────────────┼────────────┼─────────┤ │ tensor │ 1,024 │ 6.74 │ 6.74 │ 1.00x │ ├─────────┼────────────┼─────────────┼────────────┼─────────┤ │ tensor │ 16,384 │ 6.79 │ 6.64 │ 1.02x │ ├─────────┼────────────┼─────────────┼────────────┼─────────┤ │ tensor │ 65,536 │ 6.68 │ 6.61 │ 1.01x │ ├─────────┼────────────┼─────────────┼────────────┼─────────┤ │ tensor │ 262,144 │ 6.70 │ 6.70 │ 1.00x │ ├─────────┼────────────┼─────────────┼────────────┼─────────┤ │ tensor │ 1,048,576 │ 7.12 │ 6.77 │ 1.05x │ ├─────────┼────────────┼─────────────┼────────────┼─────────┤ │ tensor │ 4,194,304 │ 70.29 │ 66.66 │ 1.06x │ ├─────────┼────────────┼─────────────┼────────────┼─────────┤ │ tensor │ 16,777,216 │ 272.57 │ 248.86 │ 1.10x │ └─────────┴────────────┴─────────────┴────────────┴─────────┘ ``` Pull Request resolved: #190036 Approved by: https://github.com/ngimel ghstack dependencies: #190253
…e loop (pytorch#190036) Follow-up from pytorch#189767 to reduce complexity of `split()` / `fold_in()` kernels. On an H100, this generally results in neutral perf or speedups, with some exceptions: ``` split() ┌─────┬────────────┬─────────────┬────────────┬─────────┐ │ num │ n │ before (µs) │ after (µs) │ speedup │ ├─────┼────────────┼─────────────┼────────────┼─────────┤ │ 2 │ 1 │ 6.63 │ 6.51 │ 1.02x │ ├─────┼────────────┼─────────────┼────────────┼─────────┤ │ 2 │ 1,024 │ 6.49 │ 6.58 │ 0.99x │ ├─────┼────────────┼─────────────┼────────────┼─────────┤ │ 2 │ 16,384 │ 6.51 │ 6.60 │ 0.99x │ ├─────┼────────────┼─────────────┼────────────┼─────────┤ │ 2 │ 65,536 │ 6.50 │ 6.68 │ 0.97x │ ├─────┼────────────┼─────────────┼────────────┼─────────┤ │ 2 │ 262,144 │ 6.49 │ 6.64 │ 0.98x │ ├─────┼────────────┼─────────────┼────────────┼─────────┤ │ 2 │ 1,048,576 │ 21.55 │ 21.19 │ 1.02x │ ├─────┼────────────┼─────────────┼────────────┼─────────┤ │ 2 │ 4,194,304 │ 140.07 │ 127.49 │ 1.10x │ ├─────┼────────────┼─────────────┼────────────┼─────────┤ │ 2 │ 16,777,216 │ 533.07 │ 492.19 │ 1.08x │ ├─────┼────────────┼─────────────┼────────────┼─────────┤ │ 16 │ 1 │ 6.50 │ 6.43 │ 1.01x │ ├─────┼────────────┼─────────────┼────────────┼─────────┤ │ 16 │ 1,024 │ 6.47 │ 6.60 │ 0.98x │ ├─────┼────────────┼─────────────┼────────────┼─────────┤ │ 16 │ 16,384 │ 6.55 │ 6.52 │ 1.00x │ ├─────┼────────────┼─────────────┼────────────┼─────────┤ │ 16 │ 65,536 │ 8.89 │ 8.14 │ 1.09x │ ├─────┼────────────┼─────────────┼────────────┼─────────┤ │ 16 │ 262,144 │ 40.50 │ 33.04 │ 1.23x │ ├─────┼────────────┼─────────────┼────────────┼─────────┤ │ 16 │ 1,048,576 │ 183.46 │ 182.13 │ 1.01x │ ├─────┼────────────┼─────────────┼────────────┼─────────┤ │ 16 │ 4,194,304 │ 953.47 │ 975.40 │ 0.98x │ ├─────┼────────────┼─────────────┼────────────┼─────────┤ │ 128 │ 1 │ 6.38 │ 6.51 │ 0.98x │ ├─────┼────────────┼─────────────┼────────────┼─────────┤ │ 128 │ 1,024 │ 6.43 │ 6.61 │ 0.97x │ ├─────┼────────────┼─────────────┼────────────┼─────────┤ │ 128 │ 16,384 │ 14.32 │ 13.95 │ 1.03x │ ├─────┼────────────┼─────────────┼────────────┼─────────┤ │ 128 │ 65,536 │ 70.55 │ 58.48 │ 1.21x │ ├─────┼────────────┼─────────────┼────────────┼─────────┤ │ 128 │ 262,144 │ 299.95 │ 241.81 │ 1.24x │ ├─────┼────────────┼─────────────┼────────────┼─────────┤ │ 128 │ 1,048,576 │ 1312.20 │ 1419.08 │ 0.92x │ └─────┴────────────┴─────────────┴────────────┴─────────┘ fold_in() ┌─────────┬────────────┬─────────────┬────────────┬─────────┐ │ variant │ n │ before (µs) │ after (µs) │ speedup │ ├─────────┼────────────┼─────────────┼────────────┼─────────┤ │ int │ 1 │ 7.22 │ 6.96 │ 1.04x │ ├─────────┼────────────┼─────────────┼────────────┼─────────┤ │ int │ 1,024 │ 6.93 │ 6.91 │ 1.00x │ ├─────────┼────────────┼─────────────┼────────────┼─────────┤ │ int │ 16,384 │ 7.01 │ 6.99 │ 1.00x │ ├─────────┼────────────┼─────────────┼────────────┼─────────┤ │ int │ 65,536 │ 6.93 │ 6.96 │ 1.00x │ ├─────────┼────────────┼─────────────┼────────────┼─────────┤ │ int │ 262,144 │ 6.93 │ 7.02 │ 0.99x │ ├─────────┼────────────┼─────────────┼────────────┼─────────┤ │ int │ 1,048,576 │ 7.63 │ 7.04 │ 1.09x │ ├─────────┼────────────┼─────────────┼────────────┼─────────┤ │ int │ 4,194,304 │ 70.33 │ 66.66 │ 1.06x │ ├─────────┼────────────┼─────────────┼────────────┼─────────┤ │ int │ 16,777,216 │ 272.30 │ 249.00 │ 1.09x │ ├─────────┼────────────┼─────────────┼────────────┼─────────┤ │ tensor │ 1 │ 6.98 │ 6.58 │ 1.06x │ ├─────────┼────────────┼─────────────┼────────────┼─────────┤ │ tensor │ 1,024 │ 6.74 │ 6.74 │ 1.00x │ ├─────────┼────────────┼─────────────┼────────────┼─────────┤ │ tensor │ 16,384 │ 6.79 │ 6.64 │ 1.02x │ ├─────────┼────────────┼─────────────┼────────────┼─────────┤ │ tensor │ 65,536 │ 6.68 │ 6.61 │ 1.01x │ ├─────────┼────────────┼─────────────┼────────────┼─────────┤ │ tensor │ 262,144 │ 6.70 │ 6.70 │ 1.00x │ ├─────────┼────────────┼─────────────┼────────────┼─────────┤ │ tensor │ 1,048,576 │ 7.12 │ 6.77 │ 1.05x │ ├─────────┼────────────┼─────────────┼────────────┼─────────┤ │ tensor │ 4,194,304 │ 70.29 │ 66.66 │ 1.06x │ ├─────────┼────────────┼─────────────┼────────────┼─────────┤ │ tensor │ 16,777,216 │ 272.57 │ 248.86 │ 1.10x │ └─────────┴────────────┴─────────────┴────────────┴─────────┘ ``` Pull Request resolved: pytorch#190036 Approved by: https://github.com/ngimel ghstack dependencies: pytorch#190253
Stack from ghstack (oldest at bottom):
This PR addresses beta user feedback on
fold_in(key, data):data; we now explicitly support ints in the range[-2**63, 2**64 - 1](i.e. all signed int64 AND uint64 values) with negative values reinterpreted as two's complement of uint64 values, following the precedent set bymanual_seed(). This requires some python-side gymnastics since we utilize the standard ATen op parsing logic that treats ints as int64. Docs were also updated to indicate this.dataATen op overload that can be used to avoid baking indatato captured CUDAGraphs. Note that, for simplicity, we only allow a single item Tensordatafor now. In the future, if necessary, we can support folding broadcastable data across a batched set of keys.