Update hipHostRegister debug and pointerTracker debug and notes
This commit is contained in:
@@ -45,17 +45,13 @@ int main(){
|
||||
A[i] = float(1);
|
||||
}
|
||||
|
||||
// Copy to B, this should be optimal pinned malloc copy:
|
||||
float *B;
|
||||
HIPCHECK(hipMalloc(&B, size));
|
||||
HIPCHECK(hipMemcpy(B, A, size, hipMemcpyHostToDevice));
|
||||
|
||||
|
||||
for(int i=0;i<num_devices;i++){
|
||||
HIPCHECK(hipSetDevice(i));
|
||||
HIPCHECK(hipHostGetDevicePointer((void**)&Ad[i], A, 0));
|
||||
}
|
||||
|
||||
// Use device pointer inside a kernel:
|
||||
for(int i=0;i<num_devices;i++){
|
||||
HIPCHECK(hipSetDevice(i));
|
||||
hipLaunchKernel(HIP_KERNEL_NAME(Inc), dim3(N/512), dim3(512), 0, 0, Ad[i]);
|
||||
@@ -63,6 +59,43 @@ int main(){
|
||||
HIPCHECK(hipDeviceSynchronize());
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
// Senstizes HIP bug if device does not match where the memory was registered.
|
||||
HIPCHECK(hipSetDevice(0));
|
||||
|
||||
// Copy to B, this should be optimal pinned malloc copy:
|
||||
// Note we are using the host pointer here:
|
||||
float *Bh, *Bd;
|
||||
Bh = (float*)malloc(size);
|
||||
HIPCHECK(hipMalloc(&Bd, size));
|
||||
|
||||
for(int i=0;i<N;i++){
|
||||
A[i] = float(i);
|
||||
Bh[i] = 0.0f;
|
||||
}
|
||||
|
||||
HIPCHECK(hipMemcpy(Bd, A, size, hipMemcpyHostToDevice));
|
||||
|
||||
HIPCHECK(hipMemcpy(Bh, Bd, size, hipMemcpyDeviceToHost));
|
||||
|
||||
#if 0
|
||||
//TODO - disable check until we update HCC to deal with registered memory pointers.
|
||||
for(int i=0;i<N;i++){
|
||||
if (Bh[i] != A[i]) {
|
||||
printf ("mismatch at Bh[%d]=%f, A[%d]=%f\n", i, Bh[i], i, A[i]);
|
||||
failed("mismatch");
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
// Make sure the copy worked
|
||||
}
|
||||
|
||||
|
||||
|
||||
HIPASSERT(A[10] == 1.0f + float(num_devices));
|
||||
HIPCHECK(hipHostUnregister(A));
|
||||
passed();
|
||||
|
||||
Reference in New Issue
Block a user