[inductor] Reorder if check to avoid more expensive check. (#119817)
If `mkldnn` is not enabled or not available there is no point in performing a relatively expensive `all` check.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/119817
Approved by: https://github.com/Skylion007