NVCC improvements.

- Complete translation tables for cudaError <-> hipError_t.
- Remove some odd errors that were not correctly translated or not used.
- Add HIPCHECK_API to test infrastructure.  Used for negative testing
  an API ; if a mismatch occurs it shows the expected return error
  code.  Can also print a warning rather than error.
- Enable hipMemoryAllocate on NV system, and review error coded.
- Add hipErrorName to nvcc.

Change-Id: I680427dcf32a5796d5913cf9e7f3b4c6f6b91599

Conflicts:
	tests/src/CMakeLists.txt

Bug fixes and improved docs for hipFree and hipHostFree.

    - Passing NULL pointer initialized runtime and return hipSuccess
      (not an error like before).
    - add negative test for this. (hipMemoryAllocate, improved)
    - Match NVCC errors for invalid pointers, add to test.
    - Update hipFree and hipHostFree docs.
    - hipGetDevicePointer always set *devicePointer=NULL, even for
      invalid flags.
    - Gate shared memory usage on specific HCC work-week.

Change-Id: I533b4fd3280a3d6cdbf05eb768976f0c7506c012
Dieser Commit ist enthalten in:
Ben Sander
2016-06-10 20:12:46 -05:00
committet von Maneesh Gupta
Ursprung 7cb45e2d87
Commit 2ab19ca505
9 geänderte Dateien mit 120 neuen und 53 gelöschten Zeilen
+3 -1
Datei anzeigen
@@ -200,6 +200,8 @@ make_hip_executable (hipTestMemcpyPin hipTestMemcpyPin.cpp)
make_hip_executable (hipDynamicShared hipDynamicShared.cpp)
make_hip_executable (hipTestDevice hipTestDevice.cpp)
make_hip_executable (hipTestDeviceDouble hipTestDeviceDouble.cpp)
make_test(hip_ballot " " )
make_test(hip_anyall " " )
make_test(hip_popc " " )
@@ -245,6 +247,7 @@ make_test(hipTestDevice " ")
make_named_test (hipMultiThreadDevice "hipMultiThreadDevice-serial" --tests 0x1)
make_named_test (hipMultiThreadDevice "hipMultiThreadDevice-pyramid" --tests 0x4)
make_named_test (hipMultiThreadDevice "hipMultiThreadDevice-nearzero" --tests 0x10)
make_test(hipMemoryAllocate " ")
if (${HIP_MULTI_GPU})
make_test(hipPeerToPeer_simple " ") # use current device for copy, this fails.
@@ -254,7 +257,6 @@ if (${HIP_MULTI_GPU})
endif()
if (${HIP_PLATFORM} STREQUAL "hcc")
make_test(hipMemoryAllocate " ")
make_test(hipFuncSetDevice " ")
endif()
+14 -15
Datei anzeigen
@@ -28,24 +28,23 @@ int main(){
hipHostMalloc((void**)&Bd, SIZE, hipHostMallocDefault);
hipHostMalloc((void**)&Bm, SIZE, hipHostMallocMapped);
hipHostMalloc((void**)&C, SIZE, hipHostMallocMapped);
hipHostGetDevicePointer((void**)&Cd, C, SIZE);
HIPASSERT(hipFree(Ad) == hipSuccess);
HIPASSERT(hipHostFree(Ad) == hipErrorInvalidDevicePointer);
hipHostGetDevicePointer((void**)&Cd, C, 0/*flags*/);
HIPASSERT(hipFree(B) == hipErrorInvalidDevicePointer);
HIPASSERT(hipFree(Bd) == hipErrorInvalidDevicePointer);
HIPASSERT(hipFree(Bm) == hipErrorInvalidDevicePointer);
HIPASSERT(hipHostFree(Bd) == hipSuccess);
HIPASSERT(hipHostFree(Bm) == hipSuccess);
HIPCHECK_API(hipFree(Ad) , hipSuccess);
HIPCHECK_API(hipHostFree(Ad) , hipErrorInvalidValue);
HIPASSERT(hipFree(C) == hipErrorInvalidDevicePointer);
HIPASSERT(hipFree(Cd) == hipErrorInvalidDevicePointer);
HIPASSERT(hipHostFree(C) == hipSuccess);
HIPASSERT(hipHostFree(Cd) == hipErrorInvalidDevicePointer);
HIPASSERT(hipFree(Cd) == hipErrorInvalidDevicePointer);
HIPCHECK_API(hipFree(B) , hipErrorInvalidDevicePointer); // try to hipFree on malloced memory
HIPCHECK_API(hipFree(Bd) , hipErrorInvalidDevicePointer);
HIPCHECK_API(hipFree(Bm) , hipErrorInvalidDevicePointer);
HIPCHECK_API(hipHostFree(Bd) , hipSuccess);
HIPCHECK_API(hipHostFree(Bm) , hipSuccess);
HIPASSERT(hipFree(NULL) == hipErrorInvalidDevicePointer);
HIPASSERT(hipHostFree(NULL) == hipErrorInvalidDevicePointer);
HIPCHECK_API(hipFree(C) , hipErrorInvalidDevicePointer);
HIPCHECK_API(hipHostFree(C) , hipSuccess);
HIPCHECK_API(hipFree(NULL) , hipSuccess);
HIPCHECK_API(hipHostFree(NULL) , hipSuccess);
passed();
}
+18
Datei anzeigen
@@ -57,6 +57,12 @@ THE SOFTWARE.
printf ("error: TEST FAILED\n%s", KNRM );\
abort();
#define warn(...) \
printf ("%swarn: ", KYEL);\
printf (__VA_ARGS__);\
printf ("\n");\
printf ("warn: TEST WARNING\n%s", KNRM );\
#define HIPCHECK(error) \
{\
@@ -76,6 +82,18 @@ THE SOFTWARE.
__FILE__, __LINE__,KNRM); \
}
#define HIPCHECK_API(API_CALL, EXPECTED_ERROR) \
{\
hipError_t _e = (API_CALL);\
if (_e != (EXPECTED_ERROR) ) { \
failed("%sAPI '%s' returned %d(%s) but test expected %d(%s) at %s:%d%s \n", \
KRED, #API_CALL, _e, hipGetErrorName(_e), \
EXPECTED_ERROR, hipGetErrorName(EXPECTED_ERROR), \
__FILE__, __LINE__,KNRM); \
}\
}
// standard command-line variables:
extern size_t N;
extern char memsetval;