Fix flaky profiler and test_callback_simple RPC tests (#41287)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/41287
Profiler tests that test profiling with builtin functions and `test_callback_simple` test has been broken for a while. This diff fixes that by preferring c10 ops to non-c10 ops in our operation matching logic.
The result of this is that these ops go through the c10 dispatch and thus have profiling enabled. For `test_callback_simple` this results in the effect that we choose `aten::add.Tensor` over `aten::add.Int` which fixes the type issue.
Test Plan:
Ensured that the tests are no longer flaky by running them a bunch
of times.
Reviewed By: vincentqb
Differential Revision: D22489197
fbshipit-source-id: 8452b93e4d45703453f77d968350c0d32f3f63fe