Enable threadpool threads to greedily acquire new tasks if available. (#17808)
authorOwen Anderson <owen.anderson@oculus.com>
Wed, 13 Mar 2019 01:00:23 +0000 (18:00 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Wed, 13 Mar 2019 01:05:55 +0000 (18:05 -0700)
commite34abe03a8f432675db2df5ee9975c594fd1815a
treec3a611626af66e8f74ccac6c509491fc98d3833b
parent552f903c63355906ce46ca6cdba91d70589db501
Enable threadpool threads to greedily acquire new tasks if available. (#17808)

Summary:
This improves locality and affinity by keeping work on the same
threads preferentially to starting work on new ones, and reduces
contention on the threadpool lock more generally.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/17808

Differential Revision: D14391282

Pulled By: resistor

fbshipit-source-id: 3aec81656a50460a725aa4187c61864295d4f46e
c10/core/thread_pool.cpp