We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents acb75f3 + 0bb940d commit 79dbccdCopy full SHA for 79dbccd
src/infinicore/context/context_impl.cc
@@ -4,6 +4,8 @@
4
5
namespace infinicore {
6
7
+thread_local Runtime *ContextImpl::current_runtime_ = nullptr;
8
+
9
Runtime *ContextImpl::getCurrentRuntime() {
10
return current_runtime_;
11
}
src/infinicore/context/context_impl.hpp
@@ -8,8 +8,10 @@
class ContextImpl {
private:
+ // Table of runtimes for every device (type and index)
12
std::array<std::vector<std::unique_ptr<Runtime>>, size_t(Device::Type::COUNT)> runtime_table_;
- Runtime *current_runtime_ = nullptr;
13
+ // Active runtime for current thread. Can use "static thread local" because context is a process singleton.
14
+ static thread_local Runtime *current_runtime_;
15
16
protected:
17
ContextImpl();
0 commit comments