In cases where we have multiple models or threadpools active, spinning around `sched_yield()` may not be desirable, as it prevents the OS from effectively scheduling other threads. Thus, allow users to conditionally disable this behaviour (via an environment variable `TVM_THREAD_POOL_SPIN_COUNT`, similar to existing environment flags for the thread pool such as `TVM_BIND_THREADS`, etc). This substantially improves tail latencies in some of our multi-tenant workloads in practice. Unit tests have been added - on my laptop, running: ``` TVM_THREAD_POOL_SPIN_COUNT=0 ./build/threading_backend_test; TVM_THREAD_POOL_SPIN_COUNT=1 ./build/threading_backend_test; ./build/threading_backend_test; ``` gives https://gist.github.com/ajtulloch/1805ca6cbaa27f5d442d23f9d0021ce6 (i.e. 97ms -> <1ms after this change)
Name |
Last commit
|
Last update |
---|---|---|
.. | ||
cuda | Loading commit data... | |
graph | Loading commit data... | |
metal | Loading commit data... | |
opencl | Loading commit data... | |
opengl | Loading commit data... | |
rocm | Loading commit data... | |
rpc | Loading commit data... | |
sgx | Loading commit data... | |
stackvm | Loading commit data... | |
vm | Loading commit data... | |
vulkan | Loading commit data... | |
builtin_fp16.cc | Loading commit data... | |
c_dsl_api.cc | Loading commit data... | |
c_runtime_api.cc | Loading commit data... | |
cpu_device_api.cc | Loading commit data... | |
dsl_api.h | Loading commit data... | |
dso_module.cc | Loading commit data... | |
file_util.cc | Loading commit data... | |
file_util.h | Loading commit data... | |
meta_data.h | Loading commit data... | |
module.cc | Loading commit data... | |
module_util.cc | Loading commit data... | |
module_util.h | Loading commit data... | |
ndarray.cc | Loading commit data... | |
pack_args.h | Loading commit data... | |
registry.cc | Loading commit data... | |
runtime_base.h | Loading commit data... | |
system_lib_module.cc | Loading commit data... | |
thread_pool.cc | Loading commit data... | |
thread_storage_scope.h | Loading commit data... | |
threading_backend.cc | Loading commit data... | |
workspace_pool.cc | Loading commit data... | |
workspace_pool.h | Loading commit data... |