onnxruntime/onnxruntime/core/common
Tim Harris 5e44d25c5a
Support multi-loop parallel sections, use multi-loop sections in GRU (#5602)
This PR updates the ThreadPool API to support multi-loop parallel sections. As with the OpenMP "parallel" construct, this allows per-loop work to be amortized over a series of loops. For ORT, it also promotes locality between successive loops in the sense that iteration X of one loop will tend to run on the same worker thread as iteration X of preceding loops.

The change was developed while optimizing the implementation of a model that performed better with OpenMP. Profiling indicated that OpenMP was providing lower loop entry/exit costs and that, via OpenMP's static scheduling, it was leading to a lower L2 miss rate in the series of parallel loops used in GRU.

The main changes are:

- Addition of ThreadPool::ParallelSection and underlying support in the modified Eigen thread pool.

- In EigenNonBlockingThreadPool.h, refactoring the RunInParallel method to support two variants: one that takes an existing parallel section object created by the caller, and another (used by default) that creates its own parallel section.

- Simplify ThreadPool::LoopCounter (used by worker threads to claim loop iterations), basing it an ID supplied by the underlying Eigen thread pool for affinity in a series of loops.

- Fix a possible perf issue where a loop with iterations scheduled in batches would have more threads than batches available.

- Use of parallel sections in the GRU operator.

- Additional test cases in threadpool_test.h.

- Additional comments at the top of threadpool.h and EigenNonBlockingThreadPool.h.
2020-11-10 12:24:57 +00:00
..
logging Add Cmake config for onnxruntime_NO_EXCEPTIONS (#4975) 2020-09-01 10:17:50 -07:00
cpuid_info.cc Sunghcho/denormals (#5391) 2020-10-15 12:47:42 -07:00
cpuid_info.h Sunghcho/denormals (#5391) 2020-10-15 12:47:42 -07:00
denormal.cc Sunghcho/denormals (#5391) 2020-10-15 12:47:42 -07:00
path.cc adding concat logic when initial path is empty (#4525) 2020-07-16 23:46:12 -07:00
path.h adding concat logic when initial path is empty (#4525) 2020-07-16 23:46:12 -07:00
path_string.h Add support for loading TensorProtos with external data from optimizer Initializer (#3045) 2020-02-28 13:19:16 -08:00
path_utils.h adding concat logic when initial path is empty (#4525) 2020-07-16 23:46:12 -07:00
profiler.cc Introduce training changes. 2020-03-11 14:39:03 -07:00
profiler.h Add GetProfilingStartTimeNs() to Python/C# APIs (#5280) 2020-10-14 05:32:43 -07:00
safeint.h Add SafeInt bounds checking to memory allocation size calculations. (#3022) 2020-02-20 11:41:03 -08:00
status.cc Replace GSL with GSL-LITE submodule and fix up refs (#1920) 2019-10-01 12:43:29 -07:00
str_helper.cc Add option ORT_NO_EXCEPTIONS to disable most exception/throw in /onnxruntime/ (#4894) 2020-08-28 23:03:51 -07:00
threadpool.cc Support multi-loop parallel sections, use multi-loop sections in GRU (#5602) 2020-11-10 12:24:57 +00:00
utf8_util.h