Skip to content

Commit

Permalink
setExecutionSpace thread safety(#230)
Browse files Browse the repository at this point in the history
Co-authored-by: Neela Kausik <[email protected]>
  • Loading branch information
davidbeckingsale and Neela Kausik authored Jul 17, 2023
1 parent fa2fbc1 commit 7e5350d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/chai/ArrayManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

namespace chai
{
thread_local ExecutionSpace ArrayManager::m_current_execution_space;
thread_local bool ArrayManager::m_synced_since_last_kernel = false;

PointerRecord ArrayManager::s_null_record = PointerRecord();

Expand Down
4 changes: 2 additions & 2 deletions src/chai/ArrayManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ class ArrayManager
/*!
* Current execution space.
*/
ExecutionSpace m_current_execution_space;
static thread_local ExecutionSpace m_current_execution_space;

/**
* Default space for new allocations.
Expand Down Expand Up @@ -536,7 +536,7 @@ class ArrayManager
* Whether or not a synchronize has been performed since the launch of the last
* GPU context
*/
bool m_synced_since_last_kernel = false;
static thread_local bool m_synced_since_last_kernel;

#if defined(CHAI_ENABLE_GPU_SIMULATION_MODE)
/*!
Expand Down

0 comments on commit 7e5350d

Please sign in to comment.