Isuru Fernando
edcd968b51
Add out wrappers to some decompositions ( #115437 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/115437
Approved by: https://github.com/lezcano
2024-04-23 06:26:11 +00:00
chilli
e0c5113dec
Add support for capturing tensors with score_mod ( #124444 )
...
```
import torch
from torch import nn
import torch.nn.functional as F
import torch._inductor.config as config
# torch.set_default_device('cuda')
import torch
from torch.nn.attention._templated_attention import _templated_attention as templated_attention
from triton.testing import do_bench
from torch.nn.attention import SDPBackend, sdpa_kernel
index = torch.ops.aten
torch.manual_seed(0)
B = 16
H = 16
S = 2048
D = 64
head_scale = torch.randn(H, device='cuda')
def alibi(score, batch, head, token_q, token_kv):
return score + torch.ops.aten.index(head_scale, [head]) * (token_q - token_kv)
bias = torch.randn(H, S, S, dtype=torch.float16, device='cuda')
query = torch.randn(B, H, S, D, device="cuda", dtype=torch.float16)
key = torch.randn(B, H, S, D, device="cuda", dtype=torch.float16)
value = torch.randn(B, H, S, D, device="cuda", dtype=torch.float16)
compiled = torch.compile(templated_attention)
out = compiled(query, key, value, score_mod=alibi)
out2 = templated_attention(query, key, value,score_mod=alibi)
print((out - out2).abs().mean())
assert (out - out2).abs().mean() < 1e-3
print("Flash (no mask): ", do_bench(lambda: F.scaled_dot_product_attention(query, key, value)))
print("Flash (mask): ", do_bench(lambda: F.scaled_dot_product_attention(query, key, value, attn_mask=bias)))
print("flexattention: ", do_bench(lambda: compiled(query, key, value, score_mod=alibi)))
```
<img width="324" alt="image" src="https://github.com/pytorch/pytorch/assets/6355099/18c175d0-2720-4dfd-8747-85b8a8f609f5 ">
Pull Request resolved: https://github.com/pytorch/pytorch/pull/124444
Approved by: https://github.com/jansel , https://github.com/drisspg
2024-04-23 06:20:13 +00:00
Mikayla Gawarecki
c82fcb7b30
Add testing and fix weights_only load for quantized types and nn.Parameters with python attrs ( #124330 )
...
Adds the following to allowed globals for the `weights_only` unpickler
- [x] `torch._utils._rebuild_qtensor` and qtensor related types
- [x] `torch._utils._rebuild_parameter_with_state` (used deserializing a parameter that has user-defined attributes like `Param.foo`)
The remaining rebuild functions that have not been allowlisted are
- [x] `torch._utils._rebuild_wrapper_subclass` (allowlisted in above PR)
- [ ] `torch._utils._rebuild_device_tensor_from_numpy`
- [ ] `torch._utils._rebuild_xla_tensor` (legacy)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/124330
Approved by: https://github.com/albanD
2024-04-23 04:13:26 +00:00
Nikita Shulga
de5d689cf9
[EZ] Update pillow to 10.3.0 ( #124614 )
...
As older versions as subject to [CVE-2024-28219](https://nvd.nist.gov/vuln/detail/CVE-2024-28219 ), although it's not super important from CI PoV
Modernize `torch/utils/tensorboard/summary.py` to use Pillow-9+ APIs (is this file even used for anything anymore?)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/124614
Approved by: https://github.com/Skylion007 , https://github.com/ZainRizvi
2024-04-23 03:22:23 +00:00
Edward Z. Yang
660db767ef
Don't clean up fresh inductor cache on error ( #124620 )
...
Useful for local debugging.
Signed-off-by: Edward Z. Yang <ezyang@meta.com>
Pull Request resolved: https://github.com/pytorch/pytorch/pull/124620
Approved by: https://github.com/oulgen , https://github.com/desertfire , https://github.com/jansel
2024-04-23 02:13:05 +00:00
Fadi Botros
375ec25f55
Add missing aten::sort.any op for assistant lm models ( #123982 )
...
Differential Revision: D56084098
Pull Request resolved: https://github.com/pytorch/pytorch/pull/123982
Approved by: https://github.com/JacobSzwejbka
2024-04-23 01:35:07 +00:00
cyy
ea61c9cb29
[Distributed] [5/N] Fix clang-tidy warnings in torch/csrc/distributed/c10d ( #124043 )
...
This PR continues to fix some clang-tidy warnings in distributed/c10d code, following https://github.com/pytorch/pytorch/pull/124032 .
Pull Request resolved: https://github.com/pytorch/pytorch/pull/124043
Approved by: https://github.com/ezyang
2024-04-23 00:43:50 +00:00
Ashwin Hari
5f5778476a
rename ort to maia ( #123265 )
...
Fixes #123264
Pull Request resolved: https://github.com/pytorch/pytorch/pull/123265
Approved by: https://github.com/albanD
2024-04-23 00:33:25 +00:00
leslie-fang-intel
bffecb5aff
[Inductor] Enable VecMask store ( #123710 )
...
**Summary**
Enable the vectorization of store with `bool` dtype.
**Test Plan**
```
python -u -m pytest -s -v inductor/test_cpu_repro.py -k test_decomposed_fake_quant_per_channel
```
Pull Request resolved: https://github.com/pytorch/pytorch/pull/123710
Approved by: https://github.com/jgong5 , https://github.com/lezcano
ghstack dependencies: #123512
2024-04-23 00:29:47 +00:00
leslie-fang-intel
dd440ac734
Add Matmul recipe into x86_inductor_quantizer ( #122776 )
...
**Summary**
Add `matmul` in the quantization recipes, noting that it's not a general recipe but tailored to meet accuracy criteria for specific models. `matmul` recipe is disabled by default.
**Test Plan**
```
python -m pytest quantization/pt2e/test_x86inductor_quantizer.py -k test_attention_block
```
Differential Revision: [D56288468](https://our.internmc.facebook.com/intern/diff/D56288468 )
Pull Request resolved: https://github.com/pytorch/pytorch/pull/122776
Approved by: https://github.com/jgong5 , https://github.com/jerryzh168
2024-04-23 00:25:41 +00:00
soulitzer
1fcdea8cd6
Do not import transformers when import torch._dynamo ( #124634 )
...
Fixes https://github.com/pytorch/pytorch/issues/123954
Pull Request resolved: https://github.com/pytorch/pytorch/pull/124634
Approved by: https://github.com/thiagocrepaldi , https://github.com/Chillee
ghstack dependencies: #124343
2024-04-23 00:25:20 +00:00
nopperl
0c21161488
Add meta function for torch.histc ( #124548 )
...
Registers a meta function for the `aten.histc.default` and `aten.histc.out` ops to support `torch.compile(dynamic=True)`. Fixes #124512 .
Pull Request resolved: https://github.com/pytorch/pytorch/pull/124548
Approved by: https://github.com/lezcano , https://github.com/peterbell10
2024-04-23 00:24:59 +00:00
Yanbo Liang
72a34eeb99
Dynamo x autograd.Function supports non-{Tensor, symnode, constant} inputs ( #124360 )
...
Fixes #118395
Pull Request resolved: https://github.com/pytorch/pytorch/pull/124360
Approved by: https://github.com/zou3519
2024-04-22 23:32:54 +00:00
Shuqiang Zhang
87a35d5a29
Use new function to log one cluster per line ( #124628 )
...
Summary:
For motivation behind the overall stack of diffs see D56218385 summary.
This particular diff makes cpp_dumper take a custom printer function to log callstacks one-group-at-a-time and as such no longer running into 30K characters limit of `LOG(INFO)`.
Test Plan:
```
[romanmal@46150.od /data/sandcastle/boxes/fbsource/fbcode (520a7b7b5)]$ buck2 test //caffe2/torch/csrc/distributed/c10d/...
File changed: fbcode//common/base/ThreadStackTrace.cpp
File changed: fbsource//xplat/caffe2/torch/csrc/distributed/c10d/fb/TraceUtils.cpp
File changed: fbcode//caffe2/torch/csrc/distributed/c10d/ProcessGroupNCCL.hpp
4 additional file change events
Buck UI: https://www.internalfb.com/buck2/d8ceae86-7d6f-4779-ad0c-8e37eddcff98
Network: Up: 0B Down: 0B
Jobs completed: 2. Time elapsed: 1.5s.
Tests finished: Pass 0. Fail 0. Fatal 0. Skip 0. Build failure 0
NO TESTS RAN
[romanmal@46150.od /data/sandcastle/boxes/fbsource/fbcode (520a7b7b5)]$
```
Tested to print the stack trace:
P1220109730
Differential Revision: D56218360
Pull Request resolved: https://github.com/pytorch/pytorch/pull/124628
Approved by: https://github.com/wconstab
2024-04-22 21:57:39 +00:00
IvanKobzarev
c01499ecc6
[sym_shapes][perf] Cache ShapeEnv constrain_symbol_range calls ( #124610 )
...
Differential Revision: [D56422688](https://our.internmc.facebook.com/intern/diff/D56422688 )
Pull Request resolved: https://github.com/pytorch/pytorch/pull/124610
Approved by: https://github.com/ezyang , https://github.com/lezcano
2024-04-22 21:49:08 +00:00
Wanchao Liang
05addd5658
[tp] add kwargs support to prepare_module_input ( #124114 )
...
as titled, this PR adds kwargs support to PrepareModuleInput style,
where there might be modules who have only kwargs inputs but no
positional args, so we should support this
Pull Request resolved: https://github.com/pytorch/pytorch/pull/124114
Approved by: https://github.com/XilunWu
2024-04-22 21:46:31 +00:00
Bin Bao
bb37910e30
[AOTI] Fixes ScatterFallback codegen ( #124580 )
...
Summary: For https://github.com/pytorch/pytorch/issues/123184 . ScatterFallback currently relies on op name matching for codegen, which makes its cpp codegen fragile. Refactor to use op_overload and fix the relevant unit test failures.
Differential Revision: [D56417815](https://our.internmc.facebook.com/intern/diff/D56417815 )
Pull Request resolved: https://github.com/pytorch/pytorch/pull/124580
Approved by: https://github.com/chenyang78
2024-04-22 20:47:26 +00:00
Edward Z. Yang
0bbbc754dd
Add AOTInductor generated cpp code to TORCH_TRACE ( #124617 )
...
Signed-off-by: Edward Z. Yang <ezyang@meta.com>
Pull Request resolved: https://github.com/pytorch/pytorch/pull/124617
Approved by: https://github.com/albanD
2024-04-22 19:25:20 +00:00
Jason Ansel
0093735ccd
[inductor] Use compile time config values in runtime ( #124561 )
...
This removes usage of torch._inductor.config from `torch._inductor.runtime`. Fixing two issues:
1) If configs change we should really use the compile time ones
2) In compile workers, we want to use the parent process config
Pull Request resolved: https://github.com/pytorch/pytorch/pull/124561
Approved by: https://github.com/yanboliang
ghstack dependencies: #124552 , #124553 , #124557 , #124559 , #124560 , #124569
2024-04-22 18:46:40 +00:00
Jason Ansel
cb9fe91f5c
[inductor] Remove config check for 3D tiling ( #124569 )
...
This makes the check per-kernel (if 3D tiling is used), rather than
global config.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/124569
Approved by: https://github.com/yanboliang
ghstack dependencies: #124552 , #124553 , #124557 , #124559 , #124560
2024-04-22 18:46:40 +00:00
Jason Ansel
4620a45542
[inductor] Refactor runtime files into torch._inductor.runtime (part 5) ( #124560 )
...
I am planning to make the compile_worker process not import torch so it can start up much faster. This stack is prep for that.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/124560
Approved by: https://github.com/yanboliang
ghstack dependencies: #124552 , #124553 , #124557 , #124559
2024-04-22 18:46:35 +00:00
Jason Ansel
0cc0e60e30
[inductor] Refactor runtime files into torch._inductor.runtime (part 4) ( #124559 )
...
I am planning to make the compile_worker process not import torch so it can start up much faster. This stack is prep for that.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/124559
Approved by: https://github.com/yanboliang
ghstack dependencies: #124552 , #124553 , #124557
2024-04-22 18:46:29 +00:00
Jason Ansel
7fd8870e6b
[inductor] Refactor runtime files into torch._inductor.runtime (part 3) ( #124557 )
...
I am planning to make the compile_worker process not import torch so it can start up much faster. This stack is prep for that.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/124557
Approved by: https://github.com/yanboliang
ghstack dependencies: #124552 , #124553
2024-04-22 18:46:24 +00:00
Jason Ansel
bb8815bc31
[inductor] Refactor runtime files into torch._inductor.runtime (part 2) ( #124553 )
...
I am planning to make the compile_worker process not import torch so it can start up much faster. This stack is prep for that.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/124553
Approved by: https://github.com/yanboliang
ghstack dependencies: #124552
2024-04-22 18:46:20 +00:00
Jason Ansel
480585fd2b
[inductor] Refactor runtime files into torch._inductor.runtime (part 1) ( #124552 )
...
I am planning to make the compile_worker process not import torch so it can start up much faster. This stack is prep for that.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/124552
Approved by: https://github.com/yanboliang
2024-04-22 18:41:12 +00:00
PyTorch MergeBot
16eea7c6a5
Revert "[inductor] Refactor runtime files into torch._inductor.runtime (part 1) ( #124552 )"
...
This reverts commit a7035cc11a .
Reverted https://github.com/pytorch/pytorch/pull/124552 on behalf of https://github.com/jeanschmidt due to There are internal breakages, already discussed with author and he'll FF ([comment](https://github.com/pytorch/pytorch/pull/124552#issuecomment-2070548223 ))
2024-04-22 18:28:05 +00:00
PyTorch MergeBot
56714cb497
Revert "[inductor] Refactor runtime files into torch._inductor.runtime (part 2) ( #124553 )"
...
This reverts commit f4d47f5bbb .
Reverted https://github.com/pytorch/pytorch/pull/124553 on behalf of https://github.com/jeanschmidt due to There are internal breakages, already discussed with author and he'll FF ([comment](https://github.com/pytorch/pytorch/pull/124552#issuecomment-2070548223 ))
2024-04-22 18:28:05 +00:00
PyTorch MergeBot
0b90af0bf5
Revert "[inductor] Refactor runtime files into torch._inductor.runtime (part 3) ( #124557 )"
...
This reverts commit fcf28b0ad5 .
Reverted https://github.com/pytorch/pytorch/pull/124557 on behalf of https://github.com/jeanschmidt due to There are internal breakages, already discussed with author and he'll FF ([comment](https://github.com/pytorch/pytorch/pull/124552#issuecomment-2070548223 ))
2024-04-22 18:28:05 +00:00
PyTorch MergeBot
b3d6c2fe9b
Revert "[inductor] Refactor runtime files into torch._inductor.runtime (part 4) ( #124559 )"
...
This reverts commit 9ea2a09510 .
Reverted https://github.com/pytorch/pytorch/pull/124559 on behalf of https://github.com/jeanschmidt due to There are internal breakages, already discussed with author and he'll FF ([comment](https://github.com/pytorch/pytorch/pull/124552#issuecomment-2070548223 ))
2024-04-22 18:28:05 +00:00
PyTorch MergeBot
0f44ef93ab
Revert "[inductor] Refactor runtime files into torch._inductor.runtime (part 5) ( #124560 )"
...
This reverts commit 3ac30bc32a .
Reverted https://github.com/pytorch/pytorch/pull/124560 on behalf of https://github.com/jeanschmidt due to There are internal breakages, already discussed with author and he'll FF ([comment](https://github.com/pytorch/pytorch/pull/124552#issuecomment-2070548223 ))
2024-04-22 18:28:05 +00:00
PyTorch MergeBot
8973c5b846
Revert "[inductor] Remove config check for 3D tiling ( #124569 )"
...
This reverts commit 317c0af149 .
Reverted https://github.com/pytorch/pytorch/pull/124569 on behalf of https://github.com/jeanschmidt due to There are internal breakages, already discussed with author and he'll FF ([comment](https://github.com/pytorch/pytorch/pull/124552#issuecomment-2070548223 ))
2024-04-22 18:28:05 +00:00
PyTorch MergeBot
30dec1da84
Revert "[inductor] Use compile time config values in runtime ( #124561 )"
...
This reverts commit 3af12447f8 .
Reverted https://github.com/pytorch/pytorch/pull/124561 on behalf of https://github.com/jeanschmidt due to There are internal breakages, already discussed with author and he'll FF ([comment](https://github.com/pytorch/pytorch/pull/124561#issuecomment-2070537634 ))
2024-04-22 18:24:38 +00:00
Isuru Fernando
c2f8bfae9c
Make torch._inductor.dependencies.Dep a proper class ( #124407 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/124407
Approved by: https://github.com/peterbell10
2024-04-22 17:09:34 +00:00
Thiago Crepaldi
9c2ac4476c
Allow ONNX models without parameters ( #121904 )
...
Currently, if initializers are available, they are included in the ONNX model. If they are not available, the model is serialized without them.
However, there are times in which the initializers are avaialable, but the user prefers not to include them in the model, say for visualizing it on Netron or because the initialziers will be specified along with the inputs in the onnx runtime of choice.
This PR allow users to pass `include_initializers` to `ONNXProgram.save()` API.
Fixes #100996
Pull Request resolved: https://github.com/pytorch/pytorch/pull/121904
Approved by: https://github.com/titaiwangms
2024-04-22 15:53:38 +00:00
Jeff Daily
6ede882c0b
preferred blas library; cublaslt gemm implementation ( #122106 )
...
Following the example of PyTorch supporting a preferred Linalg library (cusolver or magma), this PR introduces a preferred blas library selector of either cublas or cublaslt for CUDA and hipblas or hipblaslt for ROCm via normal hipification of sources.
The default blas implementation remains cublas or hipblas. cublaslt or hipblaslt can be enabled using environment variable TORCH_BLAS_PREFER_CUBLASLT=1 (or TORCH_BLAS_PREFER_HIPBLASLT=1 as an alias) or by calling `torch.backends.cuda.preferred_blas_library(backend="cublaslt")` or as an alias `backend="hipblaslt"`.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/122106
Approved by: https://github.com/lezcano
2024-04-22 15:38:22 +00:00
Adnan Akhundov
9a322ba1b0
[user triton] Return unbacked SymInts used in the grid ( #124594 )
...
Summary: When unbacked SymInts are used only in a grid of a user-written Triton kernel call, there is no dependency between the Triton kernel's buffer and those unbacked SymInts. As a result, definition of the unbacked SymInts are not codegen-end and the code using them in the grid definition breaks.
Here we add the unbacked SymInts used in the grid to the `get_unbacked_symbol_uses` returned by the `UserDefinedTritonKernel` alongside those used in the `kwargs` (returned by `ExternKernel`).
Test Plan:
```
$ python test/inductor/test_aot_inductor.py -k test_triton_kernel_unbacked_symint
...
----------------------------------------------------------------------
Ran 24 tests in 155.764s
OK (skipped=16)
```
Reviewers:
Subscribers:
Tasks:
Tags:
Differential Revision: [D56406991](https://our.internmc.facebook.com/intern/diff/D56406991 )
Pull Request resolved: https://github.com/pytorch/pytorch/pull/124594
Approved by: https://github.com/oulgen
2024-04-22 15:33:30 +00:00
Kai Londenberg
42bd1abc62
[Inductor Cutlass backend] Tolerate dynamic shapes ( #121497 )
...
Previously, when the Cutlass backend was enabled, using dynamic shapes could lead to exceptions during JIT.
With this change, there are guards in place to just disable the Cutlass backend if dynamic dimensions are involved.
In addition, if no choices for a GEMM are available using the selected backends, then an ATen Kernel is used as fallback, even if the ATen backend is not enabled.
Test:
CI
Additional unit test in test_cutlass_backend.py
Pull Request resolved: https://github.com/pytorch/pytorch/pull/121497
Approved by: https://github.com/jansel
2024-04-22 12:05:50 +00:00
PyTorch MergeBot
34bce27f0d
Revert "fix Invalid call to aoti_torch_tensor_copy_ #123039 ( #124037 )"
...
This reverts commit 6e24cc012b .
Reverted https://github.com/pytorch/pytorch/pull/124037 on behalf of https://github.com/jeanschmidt due to seems to have introduced a regression in pull / linux-focal-cuda12.1-py3.10-gcc9 / test (default, 3, 5, linux.4xlarge.nvidia.gpu) ([comment](https://github.com/pytorch/pytorch/pull/124037#issuecomment-2068659093 ))
2024-04-22 07:20:10 +00:00
Jason Ansel
3af12447f8
[inductor] Use compile time config values in runtime ( #124561 )
...
This removes usage of torch._inductor.config from `torch._inductor.runtime`. Fixing two issues:
1) If configs change we should really use the compile time ones
2) In compile workers, we want to use the parent process config
Pull Request resolved: https://github.com/pytorch/pytorch/pull/124561
Approved by: https://github.com/yanboliang
ghstack dependencies: #124552 , #124553 , #124557 , #124559 , #124560 , #124569
2024-04-22 04:51:30 +00:00
Jason Ansel
317c0af149
[inductor] Remove config check for 3D tiling ( #124569 )
...
This makes the check per-kernel (if 3D tiling is used), rather than
global config.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/124569
Approved by: https://github.com/yanboliang
ghstack dependencies: #124552 , #124553 , #124557 , #124559 , #124560
2024-04-22 04:51:30 +00:00
Jason Ansel
3ac30bc32a
[inductor] Refactor runtime files into torch._inductor.runtime (part 5) ( #124560 )
...
I am planning to make the compile_worker process not import torch so it can start up much faster. This stack is prep for that.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/124560
Approved by: https://github.com/yanboliang
ghstack dependencies: #124552 , #124553 , #124557 , #124559
2024-04-22 04:51:24 +00:00
Jason Ansel
9ea2a09510
[inductor] Refactor runtime files into torch._inductor.runtime (part 4) ( #124559 )
...
I am planning to make the compile_worker process not import torch so it can start up much faster. This stack is prep for that.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/124559
Approved by: https://github.com/yanboliang
ghstack dependencies: #124552 , #124553 , #124557
2024-04-22 04:51:20 +00:00
Jason Ansel
fcf28b0ad5
[inductor] Refactor runtime files into torch._inductor.runtime (part 3) ( #124557 )
...
I am planning to make the compile_worker process not import torch so it can start up much faster. This stack is prep for that.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/124557
Approved by: https://github.com/yanboliang
ghstack dependencies: #124552 , #124553
2024-04-22 04:51:15 +00:00
Jason Ansel
f4d47f5bbb
[inductor] Refactor runtime files into torch._inductor.runtime (part 2) ( #124553 )
...
I am planning to make the compile_worker process not import torch so it can start up much faster. This stack is prep for that.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/124553
Approved by: https://github.com/yanboliang
ghstack dependencies: #124552
2024-04-22 04:51:09 +00:00
Jason Ansel
a7035cc11a
[inductor] Refactor runtime files into torch._inductor.runtime (part 1) ( #124552 )
...
I am planning to make the compile_worker process not import torch so it can start up much faster. This stack is prep for that.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/124552
Approved by: https://github.com/yanboliang
2024-04-22 04:51:05 +00:00
Tuan Trieu
6e24cc012b
fix Invalid call to aoti_torch_tensor_copy_ #123039 ( #124037 )
...
fixes #123039
In abi mode, ExternKernelSchedulerNode generates code using `aoti_torch_tensor_copy_` which requires `AtenTensorHandle`, but the allocation generates ArrayRefTensor to allocate mem in stack. To fix this issue, this PR prevents ExternKernelSchedulerNode from using stack-mem-allocation in abi, and creates AtenTensorHandle instead.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/124037
Approved by: https://github.com/desertfire
2024-04-22 01:34:22 +00:00
Chen, Zejun
b1984237a0
[Profiler] Unify the device(CUDA, XPU, PrivateUse1) in torch profiler post processing ( #123247 )
...
This PR unifies the CUDA, XPU and PrivateUse1 in the torch profiler. Now CUDA, XPU and PrivateUse1 can together use string object `use_device` to distinguish each other and share one device path for calculating kineto time durations and memory statistics for post processing.
#suppress-api-compatibility-check
Co-authored-by: Aaron Enye Shi <enye.shi@gmail.com>
Pull Request resolved: https://github.com/pytorch/pytorch/pull/123247
Approved by: https://github.com/aaronenyeshi
2024-04-22 01:26:55 +00:00
Aaron Gokaslan
c5fafe9f48
[BE]: TRY002 - Ban raising vanilla exceptions ( #124570 )
...
Adds a ruff lint rule to ban raising raw exceptions. Most of these should at the very least be runtime exception, value errors, type errors or some other errors. There are hundreds of instance of these bad exception types already in the codebase, so I have noqa'd most of them. Hopefully this error code will get commiters to rethink what exception type they should raise when they submit a PR.
I also encourage people to gradually go and fix all the existing noqas that have been added so they can be removed overtime and our exception typing can be improved.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/124570
Approved by: https://github.com/ezyang
2024-04-21 22:26:40 +00:00
Chirag Pandya
fd90991790
[rfc] opentelemetry in pytorch ( #122999 )
...
1. Add current latest version (opentelemetry-cpp version v1.14.2) to PyTorch library.
Steps:
```
$cd pytorch
$git submodule add https://github.com/open-telemetry/opentelemetry-cpp.git third_party/opentelemetry-cpp
$cd third_party/opentelemetry-cpp
$git checkout v1.14.2
$git add third_party/opentelemetry-cpp .gitmodules
$git commit
```
Expected change in checkout size:
```
(/home/cpio/local/a/pytorch-env) [cpio@devvm17556.vll0 ~/local/pytorch (gh/c-p-i-o/otel)]$ git count-objects -vH
count: 654
size: 3.59 MiB
in-pack: 1229701
packs: 17
size-pack: 1.17 GiB
prune-packable: 76
garbage: 0
size-garbage: 0 bytes
```
2.
TODO
- [x] Figure out how dynamic linking works. App builders will somehow need to `target_include` opentelemetry-cpp at runtime.
- [ ] Examples on how to use opentelemetry + pytorch
- [ ] Tests + documentation (e.g. using null opentelemetry implementation).
Pull Request resolved: https://github.com/pytorch/pytorch/pull/122999
Approved by: https://github.com/ezyang
2024-04-21 15:20:21 +00:00
Aaron Gokaslan
29cc293725
[BE]: FURB142 - Remove set mutations. Use set update ( #124551 )
...
Uses set mutation methods instead of manually reimplementing (update, set_difference etc).
Pull Request resolved: https://github.com/pytorch/pytorch/pull/124551
Approved by: https://github.com/ezyang
2024-04-21 14:12:33 +00:00