The test_int8_woq_mm test checks for using a woq CppTemplate being used with
self.assertEqual(counters["inductor"]["cpp_templated_kernel_counter"], 1)
However when MKLDNN is not available or not enabled the lowerings are not registered and the test fails:
https://github.com/pytorch/pytorch/blob/1011d3f1cda51fec9156cc4d879bacf1edd509a3/torch/_inductor/fx_passes/mkldnn_fusion.py#L1568-L1583
A similar issue affects most other tests that are currently only guarded with TEST_MKL which seems to assume that MKL implies MKLDNN.
Running a test with MKL but without MKLDNN shows 3 types of errors:
- Access to
torch.ops.mkldnn.fooyieldsAttributeError - Unexpected value for
counters["inductor"]["cpp_epilogue_fusion_counter"] - Unexpected value for
counters["inductor"]["cpp_templated_kernel_counter"]
This yields "failures=241, errors=298" from 10 test templates
This introduces 2 skip decorators: requires_mkl and requires_onednn. The former replaces the C&P `skipIf(not TEST_MKL``, then some are replaced by the latter as indicated by the failures
Note: Even when building with MKL & MKLDNN I get failures in the test_bmm_self_square test where counters["inductor"]["cpp_templated_kernel_counter"] is 0 instead of 1
Pull Request resolved: #177387
Approved by: https://github.com/jansel