Include the resolved CPU runtime thread count in the FX graph cache key when C++ codegen may specialize on it, including no-input CPU factory graphs, so cached serial kernels are not reused under a different thread count. Making the resolved thread count part of the FX graph cache key fixes all reported cases where a CPU graph compiled under one torch.set_num_threads() value was incorrectly served from cache after the thread count changed.
Fixes #110611
Fixes #167463
Fixes #160812
Generated by my agent
Pull Request resolved: #184444
Approved by: https://github.com/oulgen