2016-03-24 07:04:01 -05:00
|
|
|
/*
|
2017-03-31 12:11:34 -05:00
|
|
|
Copyright (c) 2015 - present Advanced Micro Devices, Inc. All rights reserved.
|
2016-10-15 22:55:22 +05:30
|
|
|
|
2016-03-24 07:04:01 -05:00
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
|
|
|
in the Software without restriction, including without limitation the rights
|
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
|
|
|
furnished to do so, subject to the following conditions:
|
2016-10-15 22:55:22 +05:30
|
|
|
|
2016-03-24 07:04:01 -05:00
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
|
|
|
all copies or substantial portions of the Software.
|
2016-10-15 22:55:22 +05:30
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
2016-03-24 07:04:01 -05:00
|
|
|
THE SOFTWARE.
|
|
|
|
|
*/
|
|
|
|
|
|
2016-10-04 22:17:18 +05:30
|
|
|
#include "hip/hip_runtime.h"
|
2017-03-31 12:11:34 -05:00
|
|
|
#include "hip_hcc_internal.h"
|
2016-10-15 20:25:20 -05:00
|
|
|
#include "trace_helper.h"
|
2016-03-24 04:57:30 -05:00
|
|
|
|
2016-03-24 09:28:46 -05:00
|
|
|
//-------------------------------------------------------------------------------------------------
|
|
|
|
|
//-------------------------------------------------------------------------------------------------
|
|
|
|
|
// Error Handling
|
|
|
|
|
//---
|
2016-09-13 16:54:46 +05:30
|
|
|
|
2018-03-12 11:29:03 +05:30
|
|
|
hipError_t hipGetLastError() {
|
2018-11-08 08:36:50 -06:00
|
|
|
HIP_INIT_API(hipGetLastError);
|
2016-03-24 09:28:46 -05:00
|
|
|
|
|
|
|
|
// Return last error, but then reset the state:
|
|
|
|
|
hipError_t e = ihipLogStatus(tls_lastHipError);
|
|
|
|
|
tls_lastHipError = hipSuccess;
|
|
|
|
|
return e;
|
|
|
|
|
}
|
|
|
|
|
|
2018-03-12 11:29:03 +05:30
|
|
|
hipError_t hipPeekAtLastError() {
|
2018-11-08 08:36:50 -06:00
|
|
|
HIP_INIT_API(hipPeekAtLastError);
|
2016-03-24 09:28:46 -05:00
|
|
|
|
2016-08-16 15:28:42 -05:00
|
|
|
// peek at last error, but don't reset it.
|
2016-03-24 09:28:46 -05:00
|
|
|
return ihipLogStatus(tls_lastHipError);
|
|
|
|
|
}
|
|
|
|
|
|
2018-03-12 11:29:03 +05:30
|
|
|
const char* hipGetErrorName(hipError_t hip_error) {
|
2018-11-08 08:36:50 -06:00
|
|
|
HIP_INIT_API(hipGetErrorName, hip_error);
|
2016-03-24 09:28:46 -05:00
|
|
|
|
|
|
|
|
return ihipErrorString(hip_error);
|
|
|
|
|
}
|
|
|
|
|
|
2018-03-12 11:29:03 +05:30
|
|
|
const char* hipGetErrorString(hipError_t hip_error) {
|
2018-11-08 08:36:50 -06:00
|
|
|
HIP_INIT_API(hipGetErrorString, hip_error);
|
2016-03-24 09:28:46 -05:00
|
|
|
|
|
|
|
|
// TODO - return a message explaining the error.
|
2018-03-12 11:29:03 +05:30
|
|
|
// TODO - This should be set up to return the same string reported in the the doxygen comments,
|
|
|
|
|
// somehow.
|
2016-03-24 09:28:46 -05:00
|
|
|
return hipGetErrorName(hip_error);
|
|
|
|
|
}
|