Skip to content

Commit

Permalink
[fbsync] Register nms and roi_align Autocast policy for PyTorch Intel…
Browse files Browse the repository at this point in the history
… GPU backend (#8541)

Summary: Signed-off-by: Feng Yuan <feng1.yuan@intel.com>

Differential Revision: D60903715

fbshipit-source-id: c0919c6b0473432b7ef7a30599c3dc143e3da1cf

Co-authored-by: Nicolas Hug <nh.nicolas.hug@gmail.com>
  • Loading branch information
2 people authored and facebook-github-bot committed Aug 7, 2024
1 parent 850f45d commit 4076494
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions torchvision/csrc/ops/autocast/nms_kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,12 @@ TORCH_LIBRARY_IMPL(torchvision, AutocastCPU, m) {
(nms_autocast<c10::DispatchKey::AutocastCPU, c10::DeviceType::CPU>)));
}

TORCH_LIBRARY_IMPL(torchvision, AutocastXPU, m) {
m.impl(
TORCH_SELECTIVE_NAME("torchvision::nms"),
TORCH_FN(
(nms_autocast<c10::DispatchKey::AutocastXPU, c10::DeviceType::XPU>)));
}

} // namespace ops
} // namespace vision
8 changes: 8 additions & 0 deletions torchvision/csrc/ops/autocast/roi_align_kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,13 @@ TORCH_LIBRARY_IMPL(torchvision, AutocastCPU, m) {
c10::DeviceType::CPU>)));
}

TORCH_LIBRARY_IMPL(torchvision, AutocastXPU, m) {
m.impl(
TORCH_SELECTIVE_NAME("torchvision::roi_align"),
TORCH_FN((roi_align_autocast<
c10::DispatchKey::AutocastXPU,
c10::DeviceType::XPU>)));
}

} // namespace ops
} // namespace vision

0 comments on commit 4076494

Please sign in to comment.