Skip to content

Commit 862b3eb

Browse files
committed
init counter to 0
1 parent 8304f2a commit 862b3eb

3 files changed

Lines changed: 5 additions & 7 deletions

File tree

samples/hipMultiThreadAddCallback/hipMultiThreadAddCallback.cc

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ multiple Threads.
4141
#endif
4242

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

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

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

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

110107
void Thread1_func() {

src/CHIPBackend.hh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1286,7 +1286,7 @@ protected:
12861286
public:
12871287
// atomic int for counting number of threads that were created
12881288
// for this device
1289-
std::atomic<int> NumThreadsAlive;
1289+
std::atomic<int> NumThreadsAlive = 0;
12901290

12911291
hipDeviceProp_t getDeviceProps() { return HipDeviceProps_; }
12921292
std::mutex DeviceVarMtx;

src/backend/Level0/CHIPBackendLevel0.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1663,8 +1663,9 @@ chipstar::ExecItem *CHIPBackendLevel0::createExecItem(dim3 GirdDim,
16631663
return ExecItem;
16641664
};
16651665

1666-
std::shared_ptr<chipstar::Event> CHIPBackendLevel0::createEventShared(
1667-
chipstar::Context *ChipCtx, chipstar::EventFlags Flags) {
1666+
std::shared_ptr<chipstar::Event>
1667+
CHIPBackendLevel0::createEventShared(chipstar::Context *ChipCtx,
1668+
chipstar::EventFlags Flags) {
16681669
std::shared_ptr<chipstar::Event> Event;
16691670

16701671
auto ZeCtx = (CHIPContextLevel0 *)ChipCtx;

0 commit comments

Comments
 (0)