Update mkl_verbose return value check due to API change in mkl (#96283)

As title.
Originally `mkl_verbose()` function returned `0` and `1`, indicating failure and success respectively. However, the version that PyTorch uses now changed the output of `mkl_verbose()` to reflect its input level. Thus, the check logic needs to be changed to compare output of the `mkl_verbose()` function with -1.
https://www.intel.com/content/www/us/en/develop/documentation/onemkl-developer-reference-c/top/support-functions/miscellaneous/mkl-verbose.html

Pull Request resolved: https://github.com/pytorch/pytorch/pull/96283
Approved by: https://github.com/jgong5, https://github.com/malfet
This commit is contained in:
Jing Xu
2023-03-18 20:30:07 +00:00
committed by PyTorch MergeBot
parent 5ee5a164ff
commit c1214ce5c2

View File

@ -14,8 +14,13 @@ namespace verbose {
TORCH_API int _mkl_set_verbose(int enable) {
#if AT_MKL_ENABLED()
return mkl_verbose(enable);
int ret = mkl_verbose(enable);
// Return 0 when the mkl_verbose function fails to set verbose level.
// Return 1 on success.
return ret != -1;
#else
// Return 0 since oneMKL is not enabled.
return 0;
#endif
}