Skip to content

Commit

Permalink
init counter to 0
Browse files Browse the repository at this point in the history
  • Loading branch information
pvelesko committed Jan 13, 2024
1 parent 8304f2a commit 862b3eb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ multiple Threads.
#endif

static constexpr size_t N = 4096;
static constexpr int numThreads = 3;
static constexpr int numThreads = 1000;
static std::atomic<int> Cb_count{0}, Data_mismatch{0};
static hipStream_t mystream;
static float *A1_h, *C1_h;
Expand Down Expand Up @@ -85,7 +85,6 @@ static void HIPRT_CB Thread1_Callback(hipStream_t stream, hipError_t status,

// Increment the Cb_count to indicate that the callback is processed.
++Cb_count;
std::cout << "Hello from thread id: " << std::this_thread::get_id() << "\n";
}

static void HIPRT_CB Thread2_Callback(hipStream_t stream, hipError_t status,
Expand All @@ -103,8 +102,6 @@ static void HIPRT_CB Thread2_Callback(hipStream_t stream, hipError_t status,

// Increment the Cb_count to indicate that the callback is processed.
++Cb_count;
// hello from thread id
std::cout << "Hello from thread id: " << std::this_thread::get_id() << "\n";
}

void Thread1_func() {
Expand Down
2 changes: 1 addition & 1 deletion src/CHIPBackend.hh
Original file line number Diff line number Diff line change
Expand Up @@ -1286,7 +1286,7 @@ protected:
public:
// atomic int for counting number of threads that were created
// for this device
std::atomic<int> NumThreadsAlive;
std::atomic<int> NumThreadsAlive = 0;

hipDeviceProp_t getDeviceProps() { return HipDeviceProps_; }
std::mutex DeviceVarMtx;
Expand Down
5 changes: 3 additions & 2 deletions src/backend/Level0/CHIPBackendLevel0.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1663,8 +1663,9 @@ chipstar::ExecItem *CHIPBackendLevel0::createExecItem(dim3 GirdDim,
return ExecItem;
};

std::shared_ptr<chipstar::Event> CHIPBackendLevel0::createEventShared(
chipstar::Context *ChipCtx, chipstar::EventFlags Flags) {
std::shared_ptr<chipstar::Event>
CHIPBackendLevel0::createEventShared(chipstar::Context *ChipCtx,
chipstar::EventFlags Flags) {
std::shared_ptr<chipstar::Event> Event;

auto ZeCtx = (CHIPContextLevel0 *)ChipCtx;
Expand Down

0 comments on commit 862b3eb

Please sign in to comment.