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
This commit is contained in:
committed by
Maneesh Gupta
parent
7cb45e2d87
commit
2ab19ca505
@@ -27,6 +27,12 @@ THE SOFTWARE.
|
||||
using namespace hc::precise_math;
|
||||
#endif
|
||||
|
||||
#if __hcc_workweek__ > 16186
|
||||
#define USE_DYNAMIC_SHARED 1
|
||||
#else
|
||||
#define USE_DYNAMIC_SHARED 0
|
||||
#endif
|
||||
|
||||
#define HIP_SQRT_2 1.41421356237
|
||||
|
||||
#define __hip_erfinva3 -0.140543331
|
||||
@@ -606,6 +612,11 @@ __device__ float __hip_y1f(float x)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if __hcc_workweek__ > 16186
|
||||
#define USE_DYNAMIC_SHARED 1
|
||||
#else
|
||||
#define USE_DYNAMIC_SHARED 0
|
||||
#endif
|
||||
|
||||
__device__ float acosf(float x)
|
||||
{
|
||||
@@ -1634,10 +1645,12 @@ __host__ __device__ int max(int arg1, int arg2)
|
||||
return (int)(hc::precise_math::fmax((float)arg1, (float)arg2));
|
||||
}
|
||||
|
||||
#if USE_DYNAMIC_SHARED
|
||||
__device__ __attribute__((address_space(3))) void* __get_dynamicgroupbaseptr()
|
||||
{
|
||||
return hc::get_dynamic_group_segment_base_pointer();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
+3
-5
@@ -100,7 +100,7 @@ hsa_agent_t g_cpu_agent;
|
||||
ihipSignal_t::ihipSignal_t() : _sig_id(0)
|
||||
{
|
||||
if (hsa_signal_create(0/*value*/, 0, NULL, &_hsa_signal) != HSA_STATUS_SUCCESS) {
|
||||
throw ihipException(hipErrorOutOfResources);
|
||||
throw ihipException(hipErrorRuntimeMemory);
|
||||
}
|
||||
//tprintf (DB_SIGNAL, " allocated hsa_signal=%lu\n", (_hsa_signal.handle));
|
||||
}
|
||||
@@ -110,7 +110,7 @@ ihipSignal_t::~ihipSignal_t()
|
||||
{
|
||||
tprintf (DB_SIGNAL, " destroy hsa_signal #%lu (#%lu)\n", (_hsa_signal.handle), _sig_id);
|
||||
if (hsa_signal_destroy(_hsa_signal) != HSA_STATUS_SUCCESS) {
|
||||
throw ihipException(hipErrorOutOfResources);
|
||||
throw ihipException(hipErrorRuntimeOther);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1137,9 +1137,7 @@ const char *ihipErrorString(hipError_t hip_error)
|
||||
switch (hip_error) {
|
||||
case hipSuccess : return "hipSuccess";
|
||||
case hipErrorMemoryAllocation : return "hipErrorMemoryAllocation";
|
||||
case hipErrorMemoryFree : return "hipErrorMemoryFree";
|
||||
case hipErrorUnknownSymbol : return "hipErrorUnknownSymbol";
|
||||
case hipErrorOutOfResources : return "hipErrorOutOfResources";
|
||||
case hipErrorLaunchOutOfResources : return "hipErrorLaunchOutOfResources";
|
||||
case hipErrorInvalidValue : return "hipErrorInvalidValue";
|
||||
case hipErrorInvalidResourceHandle : return "hipErrorInvalidResourceHandle";
|
||||
case hipErrorInvalidDevice : return "hipErrorInvalidDevice";
|
||||
|
||||
+12
-4
@@ -89,6 +89,8 @@ hipError_t hipHostGetDevicePointer(void **devicePointer, void *hostPointer, unsi
|
||||
|
||||
hipError_t e = hipSuccess;
|
||||
|
||||
*devicePointer = NULL;
|
||||
|
||||
// Flags must be 0:
|
||||
if (flags != 0) {
|
||||
e = hipErrorInvalidValue;
|
||||
@@ -100,7 +102,6 @@ hipError_t hipHostGetDevicePointer(void **devicePointer, void *hostPointer, unsi
|
||||
*devicePointer = amPointerInfo._devicePointer;
|
||||
} else {
|
||||
e = hipErrorMemoryAllocation;
|
||||
*devicePointer = NULL;
|
||||
}
|
||||
}
|
||||
return ihipLogStatus(e);
|
||||
@@ -530,6 +531,9 @@ hipError_t hipFree(void* ptr)
|
||||
hipStatus = hipSuccess;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// free NULL pointer succeeds and is common technique to initialize runtime
|
||||
hipStatus = hipSuccess;
|
||||
}
|
||||
|
||||
return ihipLogStatus(hipStatus);
|
||||
@@ -540,10 +544,11 @@ hipError_t hipHostFree(void* ptr)
|
||||
{
|
||||
HIP_INIT_API(ptr);
|
||||
|
||||
// TODO - ensure this pointer was created by hipMallocHost and not hipMalloc
|
||||
std::call_once(hip_initialized, ihipInit);
|
||||
// Synchronize to ensure all work has finished.
|
||||
ihipGetTlsDefaultDevice()->locked_waitAllStreams(); // ignores non-blocking streams, this waits for all activity to finish.
|
||||
|
||||
hipError_t hipStatus = hipErrorInvalidDevicePointer;
|
||||
|
||||
hipError_t hipStatus = hipErrorInvalidValue;
|
||||
if (ptr) {
|
||||
hc::accelerator acc;
|
||||
hc::AmPointerInfo amPointerInfo(NULL, NULL, 0, acc, 0, 0);
|
||||
@@ -554,6 +559,9 @@ hipError_t hipHostFree(void* ptr)
|
||||
hipStatus = hipSuccess;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// free NULL pointer succeeds and is common technique to initialize runtime
|
||||
hipStatus = hipSuccess;
|
||||
}
|
||||
|
||||
return ihipLogStatus(hipStatus);
|
||||
|
||||
Reference in New Issue
Block a user