Skip to content

Commit a9f2eff

Browse files
authored
Merge pull request #1 from edgargabriel/topic/hip-warning-silencing
silence warnings in functional testsuite
2 parents d4bb035 + 7e7bc4b commit a9f2eff

11 files changed

+50
-40
lines changed

tests/functional_tests/amo_bitwise_tester.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ __global__ void AMOBitwiseTest(int loop, int skip, uint64_t *timer, char *r_buf,
4040
*****************************************************************************/
4141
template <typename T>
4242
AMOBitwiseTester<T>::AMOBitwiseTester(TesterArguments args) : Tester(args) {
43-
hipMalloc((void **)&_ret_val, args.max_msg_size * args.num_wgs);
43+
CHECK_HIP(hipMalloc((void **)&_ret_val, args.max_msg_size * args.num_wgs));
4444
_r_buf = (char *)roc_shmem_malloc(args.max_msg_size);
4545
_s_buf = (T *)roc_shmem_malloc(args.max_msg_size * args.num_wgs);
4646
}
4747

4848
template <typename T>
4949
AMOBitwiseTester<T>::~AMOBitwiseTester() {
5050
roc_shmem_free(_r_buf);
51-
hipFree(_ret_val);
51+
CHECK_HIP(hipFree(_ret_val));
5252
}
5353

5454
template <typename T>

tests/functional_tests/amo_extended_tester.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ __global__ void AMOExtendedTest(int loop, int skip, uint64_t *timer,
4040
*****************************************************************************/
4141
template <typename T>
4242
AMOExtendedTester<T>::AMOExtendedTester(TesterArguments args) : Tester(args) {
43-
hipMalloc((void **)&_ret_val, args.max_msg_size * args.num_wgs);
43+
CHECK_HIP(hipMalloc((void **)&_ret_val, args.max_msg_size * args.num_wgs));
4444
_r_buf = (char *)roc_shmem_malloc(args.max_msg_size);
4545
_s_buf = (T *)roc_shmem_malloc(args.max_msg_size * args.num_wgs);
4646
}
4747

4848
template <typename T>
4949
AMOExtendedTester<T>::~AMOExtendedTester() {
5050
roc_shmem_free(_r_buf);
51-
hipFree(_ret_val);
51+
CHECK_HIP(hipFree(_ret_val));
5252
}
5353

5454
template <typename T>

tests/functional_tests/amo_standard_tester.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ __global__ void AMOStandardTest(int loop, int skip, uint64_t *timer,
4040
*****************************************************************************/
4141
template <typename T>
4242
AMOStandardTester<T>::AMOStandardTester(TesterArguments args) : Tester(args) {
43-
hipMalloc((void **)&_ret_val, args.max_msg_size * args.num_wgs);
43+
CHECK_HIP(hipMalloc((void **)&_ret_val, args.max_msg_size * args.num_wgs));
4444
_r_buf = (char *)roc_shmem_malloc(args.max_msg_size);
4545
_s_buf = (T *)roc_shmem_malloc(args.max_msg_size * args.num_wgs);
4646
}
4747

4848
template <typename T>
4949
AMOStandardTester<T>::~AMOStandardTester() {
5050
roc_shmem_free(_r_buf);
51-
hipFree(_ret_val);
51+
CHECK_HIP(hipFree(_ret_val));
5252
}
5353

5454
template <typename T>

tests/functional_tests/primitive_mr_tester.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ void PrimitiveMRTester::launchKernel(dim3 gridSize, dim3 blockSize, int loop,
8787
hipLaunchKernelGGL(PrimitiveMRTest, gridSize, blockSize, shared_bytes, stream,
8888
loop, timer, s_buf, r_buf, size, _shmem_context);
8989

90-
hipDeviceSynchronize();
90+
CHECK_HIP(hipDeviceSynchronize());
9191

9292
num_msgs = (loop + args.skip) * gridSize.x;
9393
num_timed_msgs = loop * 64;

tests/functional_tests/random_access_tester.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,9 @@ RandomAccessTester::RandomAccessTester(TesterArguments args) : Tester(args) {
135135
r_buf = (int *)roc_shmem_malloc(max_size * wg_size * space);
136136
h_buf = (int *)malloc(max_size * wg_size * space);
137137
h_dev_buf = (int *)malloc(max_size * wg_size * space);
138-
hipMalloc((void **)&_threads_bins, sizeof(uint32_t) * _num_waves * _num_bins);
139-
hipMalloc((void **)&_off_bins, sizeof(uint32_t) * _num_waves * _num_bins);
140-
hipMalloc((void **)&_PE_bins, sizeof(uint32_t) * _num_waves * _num_bins);
138+
CHECK_HIP(hipMalloc((void **)&_threads_bins, sizeof(uint32_t) * _num_waves * _num_bins));
139+
CHECK_HIP(hipMalloc((void **)&_off_bins, sizeof(uint32_t) * _num_waves * _num_bins));
140+
CHECK_HIP(hipMalloc((void **)&_PE_bins, sizeof(uint32_t) * _num_waves * _num_bins));
141141
memset(_threads_bins, 0, sizeof(uint32_t) * _num_waves * _num_bins);
142142
memset(_off_bins, 0, sizeof(uint32_t) * _num_waves * _num_bins);
143143
memset(_PE_bins, 0, sizeof(uint32_t) * _num_waves * _num_bins);
@@ -148,9 +148,9 @@ RandomAccessTester::~RandomAccessTester() {
148148
roc_shmem_free(r_buf);
149149
free(h_buf);
150150
free(h_dev_buf);
151-
hipFree(_threads_bins);
152-
hipFree(_off_bins);
153-
hipFree(_PE_bins);
151+
CHECK_HIP(hipFree(_threads_bins));
152+
CHECK_HIP(hipFree(_off_bins));
153+
CHECK_HIP(hipFree(_PE_bins));
154154
}
155155

156156
void RandomAccessTester::resetBuffers(uint64_t size) {
@@ -209,9 +209,9 @@ void RandomAccessTester::verifyResults(uint64_t size) {
209209
}
210210
}
211211

212-
hipMemcpy(h_dev_buf, r_buf, space * args.wg_size * size,
213-
hipMemcpyDeviceToHost);
214-
hipDeviceSynchronize();
212+
CHECK_HIP(hipMemcpy(h_dev_buf, r_buf, space * args.wg_size * size,
213+
hipMemcpyDeviceToHost));
214+
CHECK_HIP(hipDeviceSynchronize());
215215
for (i = 0; i < (space * args.wg_size * size / sizeof(int)); i++) {
216216
if (h_dev_buf[i] != h_buf[i]) {
217217
printf("PE %d Got Data Validation: expecting %d got %d at %d \n",

tests/functional_tests/shmem_ptr_tester.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ __global__ void ShmemPtrTest(char *r_buf, int *available) {
4747
* HOST TESTER CLASS METHODS
4848
*****************************************************************************/
4949
ShmemPtrTester::ShmemPtrTester(TesterArguments args) : Tester(args) {
50-
hipMalloc((void **)&_available, sizeof(int));
50+
CHECK_HIP(hipMalloc((void **)&_available, sizeof(int)));
5151
r_buf = (char *)roc_shmem_malloc(args.max_msg_size);
5252
}
5353

5454
ShmemPtrTester::~ShmemPtrTester() {
55-
hipFree(_available);
55+
CHECK_HIP(hipFree(_available));
5656
roc_shmem_free(r_buf);
5757
}
5858

tests/functional_tests/swarm_tester.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ void GetSwarmTester::launchKernel(dim3 gridSize, dim3 blockSize, int loop,
7272

7373
hipLaunchKernelGGL(GetSwarmTest, gridSize, blockSize, shared_bytes, stream,
7474
loop, args.skip, timer, s_buf, r_buf, size,
75-
_shmem_context);
75+
_shmem_context);
7676

7777
num_msgs = (loop + args.skip) * gridSize.x * blockSize.x;
7878
num_timed_msgs = loop * gridSize.x * blockSize.x;

tests/functional_tests/team_ctx_infra_tester.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,14 +126,14 @@ void TeamCtxInfraTester::launchKernel(dim3 gridSize, dim3 blockSize, int loop,
126126

127127
/* Copy array of teams to device */
128128
roc_shmem_team_t *teams_on_device;
129-
hipMalloc(&teams_on_device, sizeof(roc_shmem_team_t) * NUM_TEAMS);
130-
hipMemcpy(teams_on_device, team_world_dup,
131-
sizeof(roc_shmem_team_t) * NUM_TEAMS, hipMemcpyHostToDevice);
129+
CHECK_HIP(hipMalloc(&teams_on_device, sizeof(roc_shmem_team_t) * NUM_TEAMS));
130+
CHECK_HIP(hipMemcpy(teams_on_device, team_world_dup,
131+
sizeof(roc_shmem_team_t) * NUM_TEAMS, hipMemcpyHostToDevice));
132132

133133
hipLaunchKernelGGL(TeamCtxInfraTest, gridSize, blockSize, shared_bytes,
134-
stream, _shmem_context, teams_on_device);
134+
stream, _shmem_context, teams_on_device);
135135

136-
hipFree(teams_on_device);
136+
CHECK_HIP(hipFree(teams_on_device));
137137
}
138138

139139
void TeamCtxInfraTester::postLaunchKernel() {

tests/functional_tests/test_driver.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ int main(int argc, char *argv[]) {
3939
*/
4040
int rank = roc_shmem_my_pe();
4141
int ndevices, my_device = 0;
42-
hipGetDeviceCount(&ndevices);
42+
CHECK_HIP(hipGetDeviceCount(&ndevices));
4343
my_device = rank % ndevices;
44-
hipSetDevice(my_device);
44+
CHECK_HIP(hipSetDevice(my_device));
4545

4646
/**
4747
* Must initialize rocshmem to access arguments needed by the tester.

tests/functional_tests/tester.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,17 @@
5656
Tester::Tester(TesterArguments args) : args(args) {
5757
_type = (TestType)args.algorithm;
5858
_shmem_context = args.shmem_context;
59-
hipStreamCreate(&stream);
60-
hipEventCreate(&start_event);
61-
hipEventCreate(&stop_event);
62-
hipMalloc((void**)&timer, sizeof(uint64_t) * args.num_wgs);
59+
CHECK_HIP(hipStreamCreate(&stream));
60+
CHECK_HIP(hipEventCreate(&start_event));
61+
CHECK_HIP(hipEventCreate(&stop_event));
62+
CHECK_HIP(hipMalloc((void**)&timer, sizeof(uint64_t) * args.num_wgs));
6363
}
6464

6565
Tester::~Tester() {
66-
hipFree(timer);
67-
hipEventDestroy(stop_event);
68-
hipEventDestroy(start_event);
69-
hipStreamDestroy(stream);
66+
CHECK_HIP(hipFree(timer));
67+
CHECK_HIP(hipEventDestroy(stop_event));
68+
CHECK_HIP(hipEventDestroy(start_event));
69+
CHECK_HIP(hipStreamDestroy(stream));
7070
}
7171

7272
std::vector<Tester*> Tester::create(TesterArguments args) {
@@ -538,11 +538,11 @@ void Tester::execute() {
538538
const dim3 blockSize(args.wg_size, 1, 1);
539539
const dim3 gridSize(args.num_wgs, 1, 1);
540540

541-
hipEventRecord(start_event, stream);
541+
CHECK_HIP(hipEventRecord(start_event, stream));
542542

543543
launchKernel(gridSize, blockSize, num_loops, size);
544544

545-
hipEventRecord(stop_event, stream);
545+
CHECK_HIP(hipEventRecord(stop_event, stream));
546546

547547
hipError_t err = hipStreamSynchronize(stream);
548548
if (err != hipSuccess) {
@@ -601,7 +601,7 @@ void Tester::print(uint64_t size) {
601601
double avg_msg_rate = num_timed_msgs / (timer_avg / 1e6);
602602

603603
float total_kern_time_ms;
604-
hipEventElapsedTime(&total_kern_time_ms, start_event, stop_event);
604+
CHECK_HIP(hipEventElapsedTime(&total_kern_time_ms, start_event, stop_event));
605605
float total_kern_time_s = total_kern_time_ms / 1000;
606606
double bandwidth_avg_gbs =
607607
num_msgs * size * bw_factor / total_kern_time_s / pow(2, 30);
@@ -624,9 +624,9 @@ void Tester::print(uint64_t size) {
624624
void flush_hdp() {
625625
int hip_dev_id{};
626626
unsigned int* hdp_flush_ptr_{nullptr};
627-
hipGetDevice(&hip_dev_id);
628-
hipDeviceGetAttribute(reinterpret_cast<int*>(&hdp_flush_ptr_),
629-
hipDeviceAttributeHdpMemFlushCntl, hip_dev_id);
627+
CHECK_HIP(hipGetDevice(&hip_dev_id));
628+
CHECK_HIP(hipDeviceGetAttribute(reinterpret_cast<int*>(&hdp_flush_ptr_),
629+
hipDeviceAttributeHdpMemFlushCntl, hip_dev_id));
630630
__atomic_store_n(hdp_flush_ptr_, 0x1, __ATOMIC_SEQ_CST);
631631
}
632632

0 commit comments

Comments
 (0)