SWDEV-337452 - Changing Clock64 to WallClock64 in directed tests. (#3140)

Change-Id: I511ab4dcc61daee4fdfbd2a248b5fe74e52174b2
This commit is contained in:
ROCm CI Service Account
2023-03-21 01:48:32 +05:30
committed by GitHub
parent 3fb0920a55
commit 0ea181501c
18 changed files with 604 additions and 58 deletions
@@ -124,6 +124,13 @@ __global__ void test_kernel(long long *array) {
array[rank] += clock64();
}
__global__ void test_kernel_gfx11(long long *array) {
#ifdef __HIP_PLATFORM_AMD__
unsigned int rank = blockIdx.x * blockDim.x + threadIdx.x;
array[rank] += wall_clock64();
#endif
}
int main(int argc, char** argv) {
hipError_t err;
int device_num, FailFlag = 0;
@@ -155,6 +162,7 @@ int main(int argc, char** argv) {
int num_sms = device_properties.multiProcessorCount;
int max_num_threads = device_properties.maxThreadsPerBlock;
auto test_kernel_used = IsGfx11() ? test_kernel_gfx11 : test_kernel;
// Check single-thread block, all numbers of warps, then too-large block
for (int block_size = 0; block_size <= (max_num_threads + warp_size);
block_size += warp_size) {
@@ -163,9 +171,8 @@ int main(int argc, char** argv) {
}
int max_blocks_per_sm;
// Calculate the device occupancy to know how many blocks can be run.
HIPCHECK(hipOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(
&max_blocks_per_sm, test_kernel, block_size, 0,
hipOccupancyDefault));
HIPCHECK(hipOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(&max_blocks_per_sm,
test_kernel_used, block_size, 0, hipOccupancyDefault));
if ((block_size > max_num_threads) && (max_blocks_per_sm != 0)) {
std::cerr << "ERROR! Occupancy API indicated that we can have >0 ";
@@ -212,7 +219,7 @@ int main(int argc, char** argv) {
coop_params[i][0] = reinterpret_cast<void*>(&dev_array[i]);
}
err = hipLaunchCooperativeKernel(reinterpret_cast<void*>(test_kernel),
err = hipLaunchCooperativeKernel(reinterpret_cast<void*>(test_kernel_used),
2 * desired_blocks, block_size,
coop_params[0], 0, streams[0]);
@@ -235,9 +242,8 @@ int main(int argc, char** argv) {
}
HIPCHECK(hipDeviceSynchronize());
err = hipLaunchCooperativeKernel(reinterpret_cast<void*>(test_kernel),
desired_blocks, block_size,
coop_params[1], 0, streams[1]);
err = hipLaunchCooperativeKernel(reinterpret_cast<void*>(test_kernel_used), desired_blocks,
block_size, coop_params[1], 0, streams[1]);
if (expect_fail) {
expect_to_see = hipErrorInvalidConfiguration;