SWDEV-271283, SWDEV-274749 - Fix hipLaunchParmFUnctor test failure

Change-Id: I568eba45403feae6f50eceab4a6bcc76756fd5bd


[ROCm/clr commit: 3dea940498]
Este commit está contenido en:
jujiang
2021-03-12 21:12:11 -05:00
cometido por Julia Jiang
padre 67fd63192a
commit a2ded8ffca
@@ -23,7 +23,6 @@ THE SOFTWARE.
* HIT_END
*/
#include "../test_common.h"
#define test_passed(test_name) printf("%s %s PASSED!%s\n", KGRN, #test_name, KNRM);
@@ -56,9 +55,6 @@ class HipFunctorTests {
void TestForFunctorContainInStructObj(void);
};
static const int BLOCK_DIM_SIZE = 1024;
static const int THREADS_PER_BLOCK = 1;
@@ -70,9 +66,6 @@ class DoublerFunctor{
__device__ int operator()(int x) { return x * 2;}
};
// simple doubler functor passed to kernel
__global__ void DoublerFunctorKernel(
DoublerFunctor doubler_,
@@ -93,7 +86,6 @@ void HipFunctorTests::TestForSimpleClassFunctor(void) {
hostResults[k] = false;
}
HIPCHECK(hipMemcpy(deviceResults, hostResults, BLOCK_DIM_SIZE*sizeof(bool),
hipMemcpyHostToDevice));
hipLaunchKernelGGL(DoublerFunctorKernel, dim3(BLOCK_DIM_SIZE),
@@ -108,9 +100,6 @@ void HipFunctorTests::TestForSimpleClassFunctor(void) {
HIPCHECK(hipFree(deviceResults));
}
// pointer functor passed to kernel
__global__ void PtrDoublerFunctorKernel(
DoublerFunctor *doubler_,
@@ -121,7 +110,7 @@ __global__ void PtrDoublerFunctorKernel(
}
void HipFunctorTests::TestForClassObjPtrFunctor(void) {
DoublerFunctor *ptrdoubler;
DoublerFunctor* ptrdoubler = new DoublerFunctor[sizeof(int)];
bool *deviceResults, *hostResults;
HIPCHECK(hipMalloc(&deviceResults, BLOCK_DIM_SIZE*sizeof(bool)));
HIPCHECK(hipHostMalloc(&hostResults, BLOCK_DIM_SIZE*sizeof(bool)));
@@ -131,7 +120,6 @@ void HipFunctorTests::TestForClassObjPtrFunctor(void) {
hostResults[k] = false;
}
HIPCHECK(hipMemcpy(deviceResults, hostResults, BLOCK_DIM_SIZE*sizeof(bool),
hipMemcpyHostToDevice));
hipLaunchKernelGGL(PtrDoublerFunctorKernel, dim3(BLOCK_DIM_SIZE),
@@ -144,7 +132,7 @@ void HipFunctorTests::TestForClassObjPtrFunctor(void) {
HIPASSERT(hostResults[k] == true);
HIPCHECK(hipHostFree(hostResults));
HIPCHECK(hipFree(deviceResults));
delete ptrdoubler;
delete[] ptrdoubler;
}
class compare {
@@ -155,9 +143,6 @@ class compare {
}
};
// template functor passed to kernel
__global__ void TemplateFunctorKernel(
compare compare_,
@@ -202,8 +187,6 @@ class DoublerCalculator {
DoublerFunctor doubler;
};
// doubler functor conatined in class obj passed to kernel
__global__ void DoublerCalculatorFunctorKernel(
DoublerCalculator doubler_,
@@ -242,7 +225,6 @@ void HipFunctorTests::TestForFunctorContainInClassObj(void) {
HIPCHECK(hipFree(deviceResults));
}
// Struct functor tests
// Simple doubler Functor
@@ -252,8 +234,6 @@ struct sDoublerFunctor {
};
// simple sturct doubler functor passed to kernel
__global__ void structDoublerFunctorKernel(
sDoublerFunctor doubler_,
@@ -298,7 +278,7 @@ __global__ void structPtrDoublerFunctorKernel(
}
void HipFunctorTests::TestForStructObjPtrFunctor(void) {
sDoublerFunctor *ptrdoubler;
sDoublerFunctor* ptrdoubler = new sDoublerFunctor[sizeof(int)];
bool *deviceResults, *hostResults;
HIPCHECK(hipMalloc(&deviceResults, BLOCK_DIM_SIZE*sizeof(bool)));
HIPCHECK(hipHostMalloc(&hostResults, BLOCK_DIM_SIZE*sizeof(bool)));
@@ -308,7 +288,6 @@ void HipFunctorTests::TestForStructObjPtrFunctor(void) {
hostResults[k] = false;
}
HIPCHECK(hipMemcpy(deviceResults, hostResults, BLOCK_DIM_SIZE*sizeof(bool),
hipMemcpyHostToDevice));
hipLaunchKernelGGL(structPtrDoublerFunctorKernel, dim3(BLOCK_DIM_SIZE),
@@ -321,7 +300,7 @@ void HipFunctorTests::TestForStructObjPtrFunctor(void) {
HIPASSERT(hostResults[k] == true);
HIPCHECK(hipHostFree(hostResults));
HIPCHECK(hipFree(deviceResults));
delete ptrdoubler;
delete[] ptrdoubler;
}
struct sCompare {
@@ -332,9 +311,6 @@ struct sCompare {
}
};
// template functor passed to kernel
__global__ void structTemplateFunctorKernel(
sCompare compare_,