This corrects some interesting choices that were present in the HIP
unit tests such as e.g. de-allocating memory allocated with new[] using free. All of these were identified via cppcheck.
This commit is contained in:
@@ -36,17 +36,23 @@ __global__ void Kern(hipLaunchParm lp, float *A)
|
||||
|
||||
int main()
|
||||
{
|
||||
float *A, *Ad;
|
||||
float A[len];
|
||||
float *Ad;
|
||||
|
||||
for(int i=0;i<len;i++)
|
||||
{
|
||||
A[i] = 1.0f;
|
||||
}
|
||||
|
||||
Ad = (float*)mallocHip(size);
|
||||
memcpyHipH2D(Ad, A, size);
|
||||
hipLaunchKernel(HIP_KERNEL_NAME(Kern), dim3(len/1024), dim3(1024), 0, 0, A);
|
||||
hipLaunchKernel(
|
||||
HIP_KERNEL_NAME(Kern), dim3(len/1024), dim3(1024), 0, 0, Ad);
|
||||
memcpyHipD2H(A, Ad, size);
|
||||
for(int i=0;i<len;i++)
|
||||
{
|
||||
assert(A[i] == 2.0f);
|
||||
}
|
||||
|
||||
hipFree(Ad);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user