Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[dynamo] Turn on guard_nn_modules (pytorch#125202)
Turning on guard_nn_modules adds large number of guards, so we are bound to take a perf hit. But the perf hit is small. These are the numbers ![image](https://github.com/pytorch/pytorch/assets/13822661/c8793906-c8c7-432b-9af4-4594713067be) First we observe that compared to Python guards, C++ guards give around 6x speedup. This reduces the total time spent in guards. This is shown in the last column (cpp_guards/inductor_optimized_latency). The worst model is around 1.61%, with most of the models below 1%. I think this is good enough signal to turn the config on. One might also wonder how much guard slowdown occurs with `guard_nn_modules=True`. This is the table ![image](https://github.com/pytorch/pytorch/assets/13822661/932a885b-1c03-424b-8405-5bc8fd35dd39) For most models, the guard overhead with nn module guards is under 2x. There are a few outliers, where the slowdown is really high and for those models we spend 1%-2% time in C++ guards as shown in first table. Pull Request resolved: pytorch#125202 Approved by: https://github.com/ezyang
- Loading branch information