diff --git a/imperative/python/src/helper.h b/imperative/python/src/helper.h index 05650a3d68cfb11cba5488deb2d973f8e1908cce..05aaf922115e06591c464a556bbd3893f6e08fdb 100644 --- a/imperative/python/src/helper.h +++ b/imperative/python/src/helper.h @@ -69,6 +69,10 @@ class PyTaskDipatcher { pybind11::gil_scoped_acquire _; f(); } + + void on_async_queue_worker_thread_start() override { + mgb::sys::set_thread_name("py_task_worker"); + } }; Queue queue; bool finalized = false; diff --git a/imperative/src/impl/interpreter_impl.h b/imperative/src/impl/interpreter_impl.h index 6c894e952dd0b6c71ff1b1d72c2b16e8370053ff..5a8c974a4c0b872c9eb20715f368485be56e8711 100644 --- a/imperative/src/impl/interpreter_impl.h +++ b/imperative/src/impl/interpreter_impl.h @@ -143,10 +143,15 @@ private: size_t m_enable_evict = 0; struct WorkQueue : AsyncQueueSC { - WorkQueue(ChannelImpl* owner) : m_owner(owner) {} + WorkQueue(ChannelImpl* owner) : m_owner(owner) { + sys::set_thread_name("interpreter"); + } void process_one_task(Command& cmd) { m_owner->process_one_task(cmd); } + void on_async_queue_worker_thread_start() override { + sys::set_thread_name("worker"); + } private: ChannelImpl* m_owner; } m_worker; diff --git a/imperative/src/impl/physical_tensor.cpp b/imperative/src/impl/physical_tensor.cpp index 94a4219d51bc90654fb4a703e3b86a174949b348..13faadab9a5194f1ba5b80d2c71300045cdbe864 100644 --- a/imperative/src/impl/physical_tensor.cpp +++ b/imperative/src/impl/physical_tensor.cpp @@ -44,6 +44,9 @@ class AsyncReleaser : public CompNodeDepedentObject { std::this_thread::sleep_for(1us); add_task(std::move(param)); } + void on_async_queue_worker_thread_start() override { + sys::set_thread_name("releaser"); + } }; Waiter m_waiter{this};