SWDEV-467854 - [catch2][dtest] Functional testcases for hipGetProcAddress API - Part 2

Change-Id: I4619f8e69b75d1193e98adce2707bf7876b1ba59
Этот коммит содержится в:
Rambabu Swargam
2024-07-12 20:55:55 +05:30
коммит произвёл Rakesh Roy
родитель 5fd10bc7bc
Коммит 7fb9301d6b
16 изменённых файлов: 6132 добавлений и 237 удалений
+1 -1
Просмотреть файл
@@ -106,7 +106,7 @@ if(HIP_PLATFORM MATCHES "amd")
hipMemVmm.cc
hipArray.cc
hipMemcpyDeviceToDeviceNoCU.cc
hipGetProcAddress_Memory_APIs.cc)
hipGetProcAddressMemoryApis.cc)
if(UNIX)
# Should be compiled for NVIDIA as well after EXSWHTEC-346 is addressed
# For windows build error occurs undefined symbol: hipPointerSetAttribute
@@ -21,159 +21,7 @@ THE SOFTWARE.
#include <hip_test_helper.hh>
#include <utils.hh>
#include "hipMallocManagedCommon.hh"
/**
* @addtogroup hipGetProcAddress hipGetProcAddress
* @{
* @ingroup DeviceTest
* `hipGetProcAddress(const char* symbol, void** pfn,
* int hipVersion, uint64_t flags,
* hipDriverProcAddressQueryResult* symbolStatus);` -
* Gets the symbol's function address.
*/
/**
* Local Function to fill the array with given value
*/
void fillHostArray(int *arr, int size, int value) {
for ( int i = 0; i < size; i++ ) {
arr[i] = value;
}
}
/**
* Local Function to validate the array with given reference value
*/
bool validateHostArray(int *arr, int size, int refValue) {
for ( int i = 0; i < size; i++ ) {
if ( arr[i] != refValue ) {
return false;
}
}
return true;
}
/**
* Local Function to fill the character array with given value
*/
void fillCharHostArray(char *arr, int size, int value) {
for ( int i = 0; i < size; i++ ) {
arr[i] = value;
}
}
/**
* Local Function to validate the array with given reference value
*/
bool validateCharHostArray(char *arr, int size, int refValue) {
for ( int i = 0; i < size; i++ ) {
if ( arr[i] != refValue ) {
return false;
}
}
return true;
}
/**
* Kernel to validate the array with given reference value
*/
__global__ void verifyArray(int *arr, int size, int refValue, int* status) {
for ( int i = 0; i < size; i++ ) {
if ( arr[i] != refValue ) {
*status = 0;
return;
}
}
*status = 1;
return;
}
/**
* Local Function to validate the device array with given reference value
*/
bool validateDeviceArray(int *arr, int size, int refValue) {
int *devStatus = nullptr;
HIP_CHECK(hipMalloc(&devStatus, sizeof(int)));
REQUIRE(devStatus != nullptr);
verifyArray<<<1, 1>>>(arr, size, refValue, devStatus);
int status;
HIP_CHECK(hipMemcpy(&status, devStatus, sizeof(int), hipMemcpyDeviceToHost));
HIP_CHECK(hipFree(devStatus));
if ( status == 1 ) {
return true;
} else {
return false;
}
}
/**
* Kernel to fill the array with given value
*/
__global__ void fillArray(int *arr, int size, int value) {
for ( int i = 0; i < size; i++ ) {
arr[i] = value;
}
}
/**
* Local Function to fill the device array with given value
*/
void fillDeviceArray(int *arr, int size, int value) {
fillArray<<<1, 1>>>(arr, size, value);
}
/**
* Kernel to validate the character array with given reference value
*/
__global__ void verifyCharArray(char *arr, int size,
int refValue, int* status) {
for ( int i = 0; i < size; i++ ) {
if ( arr[i] != refValue ) {
*status = 0;
return;
}
}
*status = 1;
return;
}
/**
* Local Function to validate the character device array with
* given reference value
*/
bool validateCharDeviceArray(char *arr, int size, int refValue) {
int *devStatus = nullptr;
HIP_CHECK(hipMalloc(&devStatus, sizeof(int)));
REQUIRE(devStatus != nullptr);
verifyCharArray<<< 1, 1 >>>(arr, size, refValue, devStatus);
int status;
HIP_CHECK(hipMemcpy(&status, devStatus, sizeof(int), hipMemcpyDeviceToHost));
HIP_CHECK(hipFree(devStatus));
if ( status == 1 ) {
return true;
} else {
return false;
}
}
/**
* Local Function to validate the array of different types
*/
template<class T>
bool validateArrayT(T *arr, int size, T value) {
for ( int i = 0; i < size; i++ ) {
if ( arr[i] != value ) {
return false;
}
}
return true;
}
#include "../device/hipGetProcAddressHelpers.hh"
/**
* Test Description