From de4c173c6ebe8b8bcc09ab1a4b311d5523b52886 Mon Sep 17 00:00:00 2001 From: Tao Sang Date: Sun, 19 Apr 2020 10:40:47 -0400 Subject: [PATCH] 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 --- tests/src/kernel/hipLaunchParm.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tests/src/kernel/hipLaunchParm.cpp b/tests/src/kernel/hipLaunchParm.cpp index 23742d7d6c..797bc84ced 100644 --- a/tests/src/kernel/hipLaunchParm.cpp +++ b/tests/src/kernel/hipLaunchParm.cpp @@ -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);