Files
rocm-systems/src/hip_error.cpp
T
Ben Sander f2aa470f7f P2P checkpoint.
Maintain enabled peer tables for each device.
2016-04-11 07:58:58 -05:00

74 lines
2.3 KiB
C++

/*
Copyright (c) 2015-2016 Advanced Micro Devices, Inc. All rights reserved.
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:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANNTY OF ANY KIND, EXPRESS OR
IMPLIED, INNCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANNY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER INN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR INN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include "hip_runtime.h"
#include "hcc_detail/hip_hcc.h"
#include "hcc_detail/trace_helper.h"
//-------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------
// Error Handling
//---
/**
* @returns return code from last HIP called from the active host thread.
*/
hipError_t hipGetLastError()
{
HIP_INIT_API();
// Return last error, but then reset the state:
hipError_t e = ihipLogStatus(tls_lastHipError);
tls_lastHipError = hipSuccess;
return e;
}
//---
hipError_t hipPeakAtLastError()
{
HIP_INIT_API();
// peak at last error, but don't reset it.
return ihipLogStatus(tls_lastHipError);
}
//---
const char *hipGetErrorName(hipError_t hip_error)
{
HIP_INIT_API(hip_error);
return ihipErrorString(hip_error);
}
/**
* @warning : hipGetErrorString returns string from hipGetErrorName
*/
//---
const char *hipGetErrorString(hipError_t hip_error)
{
HIP_INIT_API(hip_error);
// TODO - return a message explaining the error.
// TODO - This should be set up to return the same string reported in the the doxygen comments, somehow.
return hipGetErrorName(hip_error);
}