Skip to content

Commit

Permalink
Add deprecation warning for torch.backends.cuda.sdp_kernel (#43)
Browse files Browse the repository at this point in the history
* only deprecation warning

* typo

* move to correct section in readme
  • Loading branch information
clee2000 authored Apr 22, 2024
1 parent 55da3d0 commit 86579eb
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 0 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,5 +103,12 @@ Migration guide:
`torch.nn.utils.parametrize.cached` before invoking the module
in question.

#### torch.backends.cuda.sdp_kernel

This function is deprecated. Use the `torch.nn.attention.sdpa_kernel` context manager instead.

Migration guide:
Each boolean input parameter (defaulting to true unless specified) of `sdp_kernel` corresponds to a `SDPBackened`. If the input parameter is true, the corresponding backend should be added to the input list of `sdpa_kernel`.

## License
TorchFix is BSD License licensed, as found in the LICENSE file.
12 changes: 12 additions & 0 deletions tests/fixtures/deprecated_symbols/checker/sdp_kernel.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import torch
from torch.backends import cuda
from torch.backends.cuda import sdp_kernel

with torch.backends.cuda.sdp_kernel() as context:
pass

with cuda.sdp_kernel() as context:
pass

with sdp_kernel() as context:
pass
4 changes: 4 additions & 0 deletions tests/fixtures/deprecated_symbols/checker/sdp_kernel.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
3:1 TOR103 Import of deprecated function torch.backends.cuda.sdp_kernel: https://github.com/pytorch-labs/torchfix#torchbackendscudasdp_kernel
5:6 TOR101 Use of deprecated function torch.backends.cuda.sdp_kernel: https://github.com/pytorch-labs/torchfix#torchbackendscudasdp_kernel
8:6 TOR101 Use of deprecated function torch.backends.cuda.sdp_kernel: https://github.com/pytorch-labs/torchfix#torchbackendscudasdp_kernel
11:6 TOR101 Use of deprecated function torch.backends.cuda.sdp_kernel: https://github.com/pytorch-labs/torchfix#torchbackendscudasdp_kernel
5 changes: 5 additions & 0 deletions torchfix/deprecated_symbols.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@
remove_pr:
reference: https://github.com/pytorch-labs/torchfix#torchnnutilsweight_norm

- name: torch.backends.cuda.sdp_kernel
deprecate_pr: https://github.com/pytorch/pytorch/pull/114689
remove_pr:
reference: https://github.com/pytorch-labs/torchfix#torchbackendscudasdp_kernel

# functorch
- name: functorch.vmap
deprecate_pr: TBA
Expand Down

0 comments on commit 86579eb

Please sign in to comment.