Skip to content

Commit

Permalink
[vulkan][ez] fix always printing out a warning when retrieving the gl…
Browse files Browse the repository at this point in the history
…obal context (pytorch#86697)

Summary: D40151818 (pytorch@82ed5ca) replaces the `TORCH_CHECK` with a `TORCH_WARN` but since it does not check if the context is valid the message gets printed every time. This diff fixes that.

Test Plan:
Referring to [Pytorch Vulkan Testing Procedures](https://fb.quip.com/fZALAc9zhlcU)

On Mac:
1. `vulkan_api_test` on Mac
2. model comparison binary on Mac

On Android:
1. `vulkan_api_test` on Android
2. benchmark binary on Android

Reviewed By: salilsdesai

Differential Revision: D40266820

Pull Request resolved: pytorch#86697
Approved by: https://github.com/kirklandsign
  • Loading branch information
SS-JIA authored and pytorchmergebot committed Oct 11, 2022
1 parent f32aeea commit 5ffe24f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions aten/src/ATen/native/vulkan/api/Context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,11 @@ Context* context() {
return nullptr;
}());

TORCH_WARN(
"Pytorch Vulkan Context: The global context could not be retrieved "
"because it failed to initialize.");
if (!context) {
TORCH_WARN(
"Pytorch Vulkan Context: The global context could not be retrieved "
"because it failed to initialize.");
}

return context.get();
}
Expand Down

0 comments on commit 5ffe24f

Please sign in to comment.