support hipLaunchParm test with static lib of hip-vdi rt

Let hipMalloc() be called in main() so that global variable can be initialized.

Change-Id: I9aa1f0a0bb4fa0825d10af0b58c843e7b928e9a3


[ROCm/clr commit: d27880ac39]
Этот коммит содержится в:
Tao Sang
2020-04-19 10:40:47 -04:00
коммит произвёл Tao Sang
родитель f0df4418a0
Коммит 876c5c568e
+8 -6
Просмотреть файл
@@ -58,12 +58,10 @@ static const int BLOCK_DIM_SIZE = 512;
// allocate memory on device and host for result validation
static bool *result_d, *result_h;
static hipError_t hipMallocError = hipMalloc((void**)&result_d,
BLOCK_DIM_SIZE*sizeof(bool));
static hipError_t hipHostMallocError = hipHostMalloc((void**)&result_h,
BLOCK_DIM_SIZE*sizeof(bool));
static hipError_t hipMemsetError = hipMemset(result_d,
false, BLOCK_DIM_SIZE);
static hipError_t hipMallocError = hipErrorUnknown;
static hipError_t hipHostMallocError = hipErrorUnknown;
static hipError_t hipMemsetError = hipErrorUnknown;
static void ResultValidation() {
hipMemcpy(result_h, result_d, BLOCK_DIM_SIZE*sizeof(bool),
@@ -600,6 +598,10 @@ __global__ void vAdd(float* a) {}
int main() {
hipMallocError = hipMalloc((void**)&result_d, BLOCK_DIM_SIZE*sizeof(bool));
hipHostMallocError = hipHostMalloc((void**)&result_h, BLOCK_DIM_SIZE*sizeof(bool));
hipMemsetError = hipMemset(result_d, false, BLOCK_DIM_SIZE);
// Validating memory & initial value, for result_d, result_h
HIPASSERT(hipMallocError == hipSuccess);
HIPASSERT(hipHostMallocError == hipSuccess);