SWDEV-299773 - Enable performance tests on NV (#2337)

1. Simply enable test on NV
   Some need minor fix
performance/compute/hipPerfDotProduct.cpp
performance/dispatch/hipPerfDispatchSpeed.cpp
performance/memory/hipPerfBufferCopyRectSpeed.cpp
performance/memory/hipPerfBufferCopySpeed.cpp
performance/memory/hipPerfDevMemReadSpeed.cpp
performance/memory/hipPerfDevMemWriteSpeed.cpp
performance/memory/hipPerfMemcpy.cpp
performance/memory/hipPerfMemset.cpp
performance/memory/hipPerfSharedMemReadSpeed.cpp
performance/stream/hipPerfDeviceConcurrency.cpp
performance/stream/hipPerfStreamCreateCopyDestroy.cpp

2. Enable and fix on NV
performance/compute/hipPerfMandelbrot.cpp
   Root cause: coordIdx is random
   Solution: Initialize coordIdx correctly
performance/memory/hipPerfMemFill.cpp
   Root cause: Hip ext Apis called.
   Solution: Exclude case with Hip ext Apis involved
performance/memory/hipPerfMemMallocCpyFree.cpp
   Root cause: Test allocates device memory more than GPU has.
   Solution: Allocate device memory in terms of GPU capacity.
tests/performance/memory/hipPerfSampleRate.cpp
   Root cause: Cuda has no operators += for float2 and float4.
   Solution: Provide the operators.
performance/stream/hipPerfStreamConcurrency.cpp
   Root cause:float4 format doesn't match cude.
              operators are missing in cuda lib.
   Solution: Use (x, y, z, w) format.
             Add necessary float4 operatoris for cuda.

Change-Id: I5add29ebabcfb21fb3ef89d09004c5d13423a291
Bu işleme şunda yer alıyor:
TomSang
2021-09-14 04:07:13 -04:00
işlemeyi yapan: GitHub
ebeveyn 3fd16c0b5b
işleme 9035ae3154
16 değiştirilmiş dosya ile 133 ekleme ve 112 silme
+1 -1
Dosyayı Görüntüle
@@ -18,7 +18,7 @@ THE SOFTWARE.
*/
/* HIT_START
* BUILD: %t %s ../../src/test_common.cpp ../../src/timer.cpp EXCLUDE_HIP_PLATFORM nvidia
* BUILD: %t %s ../../src/test_common.cpp ../../src/timer.cpp
* TEST: %t
* HIT_END
*/
+1 -1
Dosyayı Görüntüle
@@ -18,7 +18,7 @@ THE SOFTWARE.
*/
/* HIT_START
* BUILD: %t %s ../../src/test_common.cpp ../../src/timer.cpp EXCLUDE_HIP_PLATFORM nvidia
* BUILD: %t %s ../../src/test_common.cpp ../../src/timer.cpp
* TEST: %t
* HIT_END
*/
+1 -1
Dosyayı Görüntüle
@@ -18,7 +18,7 @@ THE SOFTWARE.
*/
/* HIT_START
* BUILD: %t %s ../../src/test_common.cpp EXCLUDE_HIP_PLATFORM nvidia
* BUILD: %t %s ../../src/test_common.cpp
* TEST: %t
* HIT_END
*/
+1 -1
Dosyayı Görüntüle
@@ -18,7 +18,7 @@ THE SOFTWARE.
*/
/* HIT_START
* BUILD: %t %s ../../src/test_common.cpp EXCLUDE_HIP_PLATFORM nvidia
* BUILD: %t %s ../../src/test_common.cpp
* TEST: %t
* HIT_END
*/
+11 -2
Dosyayı Görüntüle
@@ -18,7 +18,7 @@
*/
/* HIT_START
* BUILD: %t %s ../../src/test_common.cpp EXCLUDE_HIP_PLATFORM nvidia
* BUILD: %t %s ../../src/test_common.cpp
* TEST: %t
* HIT_END
*/
@@ -136,6 +136,7 @@ class hipPerfMemFill {
}
HIPCHECK(hipSetDevice(deviceId));
memset(&props_, 0, sizeof(props_));
HIPCHECK(hipGetDeviceProperties(&props_, deviceId));
std::cout << "Info: running on device: id: " << deviceId << ", bus: 0x"
<< props_.pciBusID << " " << props_.name << " with "
@@ -397,8 +398,9 @@ class hipPerfMemFill {
return true;
}
/* This fuction should be via device attribute query*/
/* This function should be via device attribute query*/
bool supportDeviceMallocFinegrained() {
#ifdef __HIP_PLATFORM_AMD__
T *A = nullptr;
hipExtMallocWithFlags((void **)&A, sizeof(T), hipDeviceMallocFinegrained);
if (!A) {
@@ -406,6 +408,9 @@ class hipPerfMemFill {
}
HIPCHECK(hipFree(A));
return true;
#else
return false;
#endif
}
unsigned int setNumBlocks(size_t size) {
@@ -419,6 +424,7 @@ class hipPerfMemFill {
#endif
}
#ifdef __HIP_PLATFORM_AMD__
bool testExtDeviceMemoryHostFill(size_t size, unsigned int flags) {
double GBytes = (double) size / (1024.0 * 1024.0 * 1024.0);
@@ -481,6 +487,7 @@ class hipPerfMemFill {
return true;
}
#endif
bool run() {
if (supportLargeBar()) {
@@ -499,11 +506,13 @@ class hipPerfMemFill {
return false;
}
#ifdef __HIP_PLATFORM_AMD__
if (supportDeviceMallocFinegrained()) {
if (!testExtDeviceMemory()) {
return false;
}
}
#endif
return true;
}
+14 -4
Dosyayı Görüntüle
@@ -22,7 +22,7 @@ THE SOFTWARE.
#include <time.h>
/* HIT_START
* BUILD: %t %s ../../src/test_common.cpp EXCLUDE_HIP_PLATFORM nvidia
* BUILD: %t %s ../../src/test_common.cpp
* TEST: %t
* HIT_END
*/
@@ -37,10 +37,15 @@ void valSet(int* A, int val, size_t size) {
}
}
void setup(size_t *size, const int num, int **pA) {
void setup(size_t *size, int &num, int **pA, const size_t totalGlobalMem) {
std::cout << "size: ";
for (int i = 0; i < num; i++) {
size[i] = 1 << (i + 6);
if((NUM_ITER + 1) * size[i] > totalGlobalMem) {
num = i;
break;
}
std::cout << size[i] << " ";
}
std::cout << std::endl;
@@ -77,11 +82,16 @@ int main() {
size_t size[NUM_SIZE] = { 0 };
int *Ad[NUM_ITER] = { nullptr };
int *A;
hipDeviceProp_t props;
memset(&props, 0, sizeof(props));
HIPCHECK(hipGetDeviceProperties(&props, 0));
std::cout << "totalGlobalMem: " << props.totalGlobalMem << std::endl;
setup(size, NUM_SIZE, &A);
int num = NUM_SIZE;
setup(size, num, &A, props.totalGlobalMem);
testInit(size[0], A);
for (int i = 0; i < NUM_SIZE; i++) {
for (int i = 0; i < num; i++) {
std::cout << size[i] << std::endl;
start = clock();
for (int j = 0; j < NUM_ITER; j++) {
+1 -1
Dosyayı Görüntüle
@@ -18,7 +18,7 @@
*/
/* HIT_START
* BUILD: %t %s ../../src/test_common.cpp EXCLUDE_HIP_PLATFORM nvidia
* BUILD: %t %s ../../src/test_common.cpp
* TEST: %t
* HIT_END
*/
+3 -3
Dosyayı Görüntüle
@@ -18,7 +18,7 @@
*/
/* HIT_START
* BUILD: %t %s ../../src/test_common.cpp EXCLUDE_HIP_PLATFORM nvidia
* BUILD: %t %s ../../src/test_common.cpp
* TEST: %t
* HIT_END
*/
@@ -140,13 +140,13 @@ void hipPerfMemset::run1D(unsigned int test, T memsetval, enum MemsetType type,
HIPCHECK(hipStreamCreate(&stream));
// Warm-up
HIPCHECK(hipMemset((hipDeviceptr_t)A_d, memsetval, bufSize_));
HIPCHECK(hipMemset((void *)A_d, memsetval, bufSize_));
auto start = chrono::steady_clock::now();
for (uint i = 0; i < NUM_ITER; i++) {
if (type == hipMemsetTypeDefault && !async) {
HIPCHECK(hipMemset((hipDeviceptr_t)A_d, memsetval, bufSize_));
HIPCHECK(hipMemset((void *)A_d, memsetval, bufSize_));
}
else if (type == hipMemsetTypeDefault && async) {
HIPCHECK(hipMemsetAsync(A_d, memsetval, bufSize_, stream));
+17 -4
Dosyayı Görüntüle
@@ -18,7 +18,7 @@
*/
/* HIT_START
* BUILD: %t %s ../../src/test_common.cpp EXCLUDE_HIP_PLATFORM nvidia
* BUILD: %t %s ../../src/test_common.cpp
* TEST: %t
* HIT_END
*/
@@ -42,6 +42,18 @@ vector<unsigned int> sizes = {1, 2, 4, 8, 16, 32,
#define NUM_BUFS 6
#define MAX_BUFS (1 << (NUM_BUFS - 1))
#ifdef __HIP_PLATFORM_NVIDIA__
inline __host__ __device__ void operator+=(float2 &a, float2 b)
{
a.x += b.x; a.y += b.y;
}
inline __host__ __device__ void operator+=(float4 &a, float4 b)
{
a.x += b.x; a.y += b.y; a.z += b.z; a.w += b.w;
}
#endif
template <typename T>
__global__ void sampleRate(T * outBuffer, unsigned int inBufSize, unsigned int writeIt,
T **inBuffer, int numBufs) {
@@ -49,7 +61,8 @@ __global__ void sampleRate(T * outBuffer, unsigned int inBufSize, unsigned int w
uint gid = (blockIdx.x * blockDim.x + threadIdx.x);
uint inputIdx = gid % inBufSize;
T tmp = (T)0.0f;
T tmp;
memset(&tmp, 0, sizeof(T));
for(int i = 0; i < numBufs; i++) {
tmp += *(*(inBuffer+i)+inputIdx);
}
@@ -264,11 +277,11 @@ void hipPerfSampleRate::run(unsigned int test) {
// Free host and device memory
for (uint i = 0; i < numBufs_; i++) {
HIPCHECK(hipFree(hInPtr[i]));
HIPCHECK(hipHostFree(hInPtr[i]));
HIPCHECK(hipFree(dInPtr[i]));
}
HIPCHECK(hipFree(hOutPtr));
HIPCHECK(hipHostFree(hOutPtr));
HIPCHECK(hipFree(dPtr));
}
+1 -1
Dosyayı Görüntüle
@@ -18,7 +18,7 @@
*/
/* HIT_START
* BUILD: %t %s ../../src/test_common.cpp EXCLUDE_HIP_PLATFORM nvidia
* BUILD: %t %s ../../src/test_common.cpp
* TEST: %t
* HIT_END
*/