[HIP] Clean-up deprecated HIP error codes

hipErrorMemoryAllocation -> hipErrorOutOfMemory
hipErrorInitializationError -> hipErrorNotInitialized
hipErrorMapBufferObjectFailed -> hipErrorMapFailed
hipErrorInvalidResourceHandle -> hipErrorInvalidHandle


[ROCm/hip commit: 4921678b6c]
This commit is contained in:
Evgeny Mankov
2019-12-23 17:01:35 +03:00
parent 97535f3e97
commit abef353b5b
13 changed files with 112 additions and 118 deletions
@@ -62,11 +62,11 @@ int launch_local_kernel() {
hipDeviceProp_t props;
CHECK(hipGetDeviceProperties(&props, device /*deviceID*/));
A_h = (float*)malloc(Nbytes);
CHECK(A_h == 0 ? hipErrorMemoryAllocation : hipSuccess);
CHECK(A_h == 0 ? hipErrorOutOfMemory : hipSuccess);
B_h = (float*)malloc(Nbytes);
CHECK(B_h == 0 ? hipErrorMemoryAllocation : hipSuccess);
CHECK(B_h == 0 ? hipErrorOutOfMemory : hipSuccess);
C_h = (float*)malloc(Nbytes);
CHECK(C_h == 0 ? hipErrorMemoryAllocation : hipSuccess);
CHECK(C_h == 0 ? hipErrorOutOfMemory : hipSuccess);
// Fill with Phi + i
for (size_t i = 0; i < N; i++) {
A_h[i] = 1.618f + i;
@@ -174,11 +174,11 @@ extern "C" int foo() {
hipDeviceProp_t props;
CHECK(hipGetDeviceProperties(&props, device /*deviceID*/));
A_h = (float*)malloc(Nbytes);
CHECK(A_h == 0 ? hipErrorMemoryAllocation : hipSuccess);
CHECK(A_h == 0 ? hipErrorOutOfMemory : hipSuccess);
B_h = (float*)malloc(Nbytes);
CHECK(B_h == 0 ? hipErrorMemoryAllocation : hipSuccess);
CHECK(B_h == 0 ? hipErrorOutOfMemory : hipSuccess);
C_h = (float*)malloc(Nbytes);
CHECK(C_h == 0 ? hipErrorMemoryAllocation : hipSuccess);
CHECK(C_h == 0 ? hipErrorOutOfMemory : hipSuccess);
// Fill with Phi + i
for (size_t i = 0; i < N; i++) {
A_h[i] = 1.618f + i;
@@ -133,14 +133,14 @@ void test(unsigned testMask, int* C_d, int* C_h, int64_t numElements, hipStream_
{
// Check some error conditions for incomplete events:
HIPCHECK_API(hipEventElapsedTime(&t, timingDisabled, stop), hipErrorInvalidResourceHandle);
HIPCHECK_API(hipEventElapsedTime(&t, start, timingDisabled), hipErrorInvalidResourceHandle);
HIPCHECK_API(hipEventElapsedTime(&t, timingDisabled, stop), hipErrorInvalidHandle);
HIPCHECK_API(hipEventElapsedTime(&t, start, timingDisabled), hipErrorInvalidHandle);
HIPCHECK_API(hipEventElapsedTime(&t, neverCreated, stop), hipErrorInvalidResourceHandle);
HIPCHECK_API(hipEventElapsedTime(&t, start, neverCreated), hipErrorInvalidResourceHandle);
HIPCHECK_API(hipEventElapsedTime(&t, neverCreated, stop), hipErrorInvalidHandle);
HIPCHECK_API(hipEventElapsedTime(&t, start, neverCreated), hipErrorInvalidHandle);
HIPCHECK_API(hipEventElapsedTime(&t, neverRecorded, stop), hipErrorInvalidResourceHandle);
HIPCHECK_API(hipEventElapsedTime(&t, start, neverRecorded), hipErrorInvalidResourceHandle);
HIPCHECK_API(hipEventElapsedTime(&t, neverRecorded, stop), hipErrorInvalidHandle);
HIPCHECK_API(hipEventElapsedTime(&t, start, neverRecorded), hipErrorInvalidHandle);
}
HIPCHECK(hipEventDestroy(start));
@@ -67,9 +67,9 @@ int main(int argc, char *argv[])
printf ("info: allocate host mem (%6.2f MB)\n", 2*Nbytes/1024.0/1024.0);
A_h = (float*)malloc(Nbytes);
HIPCHECK(A_h == 0 ? hipErrorMemoryAllocation : hipSuccess );
HIPCHECK(A_h == 0 ? hipErrorOutOfMemory : hipSuccess );
C_h = (float*)malloc(Nbytes);
HIPCHECK(C_h == 0 ? hipErrorMemoryAllocation : hipSuccess );
HIPCHECK(C_h == 0 ? hipErrorOutOfMemory : hipSuccess );
// Fill with Phi + i
for (size_t i = 0; i < N; i++)
{
@@ -60,9 +60,9 @@ int main(int argc, char* argv[]) {
size_t Nbytes = N * sizeof(float);
A_h = (float*)malloc(Nbytes);
HIPCHECK(A_h == 0 ? hipErrorMemoryAllocation : hipSuccess);
HIPCHECK(A_h == 0 ? hipErrorOutOfMemory : hipSuccess);
C_h = (float*)malloc(Nbytes);
HIPCHECK(C_h == 0 ? hipErrorMemoryAllocation : hipSuccess);
HIPCHECK(C_h == 0 ? hipErrorOutOfMemory : hipSuccess);
// Fill with Phi + i
for (size_t i = 0; i < N; i++) {
@@ -201,7 +201,7 @@ void runTests(int64_t numElements) {
int main(int argc, char* argv[]) {
// Can' destroy the default stream:// TODO - move to another test
HIPCHECK_API(hipStreamDestroy(0), hipErrorInvalidResourceHandle);
HIPCHECK_API(hipStreamDestroy(0), hipErrorInvalidHandle);
HipTest::parseStandardArguments(argc, argv, true /*failOnUndefinedArg*/);