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:
Alex Voicu
2017-11-01 22:51:22 +00:00
rodzic 09d866a639
commit a619ac6f92
7 zmienionych plików z 278 dodań i 52 usunięć
@@ -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);
}