SWDEV-289401 - Catch2 tests for hip event APIs

Change-Id: I7c28f842282e07c21656fb92ddbb1a9ad32d752c
This commit is contained in:
Satyanvesh Dittakavi
2021-06-21 13:19:44 -04:00
parent 89bf84fb30
commit 8093223eec
10 changed files with 576 additions and 18 deletions
+1 -18
View File
@@ -10,29 +10,12 @@
#include <limits>
#include <atomic>
#include <hip_test_common.hh>
size_t N = 4 * 1024 * 1024;
unsigned blocksPerCU = 6; // to hide latency
unsigned threadsPerBlock = 256;
unsigned setNumBlocks(unsigned blocksPerCU, unsigned threadsPerBlock, size_t N) {
int device;
HIP_CHECK(hipGetDevice(&device));
hipDeviceProp_t props;
HIP_CHECK(hipGetDeviceProperties(&props, device));
unsigned blocks = props.multiProcessorCount * blocksPerCU;
if (blocks * threadsPerBlock > N) {
blocks = (N + threadsPerBlock - 1) / threadsPerBlock;
}
return blocks;
}
/**
* Validates data consitency on supplied gpu
*/
@@ -48,7 +31,7 @@ bool validateMemoryOnGPU(int gpu, bool concurOnOneGPU = false) {
printf("tgs allocating..\n");
HipTest::initArrays(&A_d, &B_d, &C_d, &A_h, &B_h, &C_h, N, false);
unsigned blocks = setNumBlocks(blocksPerCU, threadsPerBlock, N);
unsigned blocks = HipTest::setNumBlocks(blocksPerCU, threadsPerBlock, N);
HIP_CHECK(hipMemcpy(A_d, A_h, Nbytes, hipMemcpyHostToDevice));
HIP_CHECK(hipMemcpy(B_d, B_h, Nbytes, hipMemcpyHostToDevice));