Skip to content

Commit a97d059

Browse files
ezyangfacebook-github-bot
authored andcommitted
Get TestTorch.test_empty_meta working again (#48113)
Summary: Pull Request resolved: #48113 Fix is simple: just treat Meta as a backend covered by AutogradOther. This semantically makes sense, since meta kernels are just like regular CPU/CUDA kernels, they just don't do any compute. Signed-off-by: Edward Z. Yang <ezyang@fb.com> Test Plan: Imported from OSS Reviewed By: zhangguanheng66 Differential Revision: D25056641 Pulled By: ezyang fbshipit-source-id: 7b68911982352b3e0ee8616b38cd9c70bd58a740
1 parent 4c9eb57 commit a97d059

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

c10/core/DispatchKeySet.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ C10_API std::ostream& operator<<(std::ostream&, DispatchKeySet);
188188

189189
// autograd_dispatch_keyset should include all runtime autograd keys.
190190
// Alias key DispatchKey::Autograd maps to autograd_dispatch_keyset.
191+
// NB: keys in this set also get associated with Math
191192
constexpr DispatchKeySet autograd_dispatch_keyset = DispatchKeySet({
192193
DispatchKey::AutogradCPU,
193194
DispatchKey::AutogradCUDA,
@@ -200,6 +201,7 @@ constexpr DispatchKeySet autograd_dispatch_keyset = DispatchKeySet({
200201
});
201202

202203
// backend dispatch keys that map to DispatchKey::AutogradOther
204+
// NB: keys in this set also get associated with Math
203205
constexpr DispatchKeySet autogradother_backends = DispatchKeySet({
204206
DispatchKey::HIP,
205207
DispatchKey::FPGA,
@@ -219,6 +221,7 @@ constexpr DispatchKeySet autogradother_backends = DispatchKeySet({
219221
DispatchKey::SparseCPU,
220222
DispatchKey::SparseCUDA,
221223
DispatchKey::SparseHIP,
224+
DispatchKey::Meta,
222225
});
223226

224227
// true if t is a backend dispatch key

test/test_torch.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4472,7 +4472,6 @@ def test_batch_norm_cpu_inference(self):
44724472
self.assertEqual(output3, output1)
44734473
self.assertEqual(output3, output2)
44744474

4475-
@unittest.skipIf(True, "Skip due to catchAll -> Math")
44764475
def test_empty_meta(self):
44774476
x = torch.empty_meta(2 ** 20, 2 ** 20)
44784477
y = torch.empty_meta(2 ** 20)

0 commit comments

Comments
 (0)