[texture] guard new HCC APIs under workweek
Change-Id: I4f60a64fb0b0496ca1eb01ffe6ddda121c25d976
Этот коммит содержится в:
@@ -1866,8 +1866,13 @@ void ihipStream_t::locked_copySync(void* dst, const void* src, size_t sizeBytes,
|
||||
}
|
||||
|
||||
hc::accelerator acc;
|
||||
#if (__hcc_workweek__ >= 17332)
|
||||
hc::AmPointerInfo dstPtrInfo(NULL, NULL, NULL, 0, acc, 0, 0);
|
||||
hc::AmPointerInfo srcPtrInfo(NULL, NULL, NULL, 0, acc, 0, 0);
|
||||
#else
|
||||
hc::AmPointerInfo dstPtrInfo(NULL, NULL, 0, acc, 0, 0);
|
||||
hc::AmPointerInfo srcPtrInfo(NULL, NULL, 0, acc, 0, 0);
|
||||
#endif
|
||||
bool dstTracked = getTailoredPtrInfo(&dstPtrInfo, dst, sizeBytes);
|
||||
bool srcTracked = getTailoredPtrInfo(&srcPtrInfo, src, sizeBytes);
|
||||
|
||||
@@ -1902,7 +1907,11 @@ void ihipStream_t::locked_copySync(void* dst, const void* src, size_t sizeBytes,
|
||||
}
|
||||
|
||||
void ihipStream_t::addSymbolPtrToTracker(hc::accelerator& acc, void* ptr, size_t sizeBytes) {
|
||||
#if (__hcc_workweek__ >= 17332)
|
||||
hc::AmPointerInfo ptrInfo(NULL, ptr, ptr, sizeBytes, acc, true, false);
|
||||
#else
|
||||
hc::AmPointerInfo ptrInfo(NULL, ptr, sizeBytes, acc, true, false);
|
||||
#endif
|
||||
hc::am_memtracker_add(ptr, ptrInfo);
|
||||
}
|
||||
|
||||
@@ -1926,7 +1935,11 @@ void ihipStream_t::lockedSymbolCopyAsync(hc::accelerator &acc, void* dst, void*
|
||||
{
|
||||
// TODO - review - this looks broken , should not be adding pointers to tracker dynamically:
|
||||
if(kind == hipMemcpyHostToDevice) {
|
||||
#if (__hcc_workweek__ >= 17332)
|
||||
hc::AmPointerInfo srcPtrInfo(NULL, NULL, NULL, 0, acc, 0, 0);
|
||||
#else
|
||||
hc::AmPointerInfo srcPtrInfo(NULL, NULL, 0, acc, 0, 0);
|
||||
#endif
|
||||
bool srcTracked = (hc::am_memtracker_getinfo(&srcPtrInfo, src) == AM_SUCCESS);
|
||||
if(srcTracked) {
|
||||
addSymbolPtrToTracker(acc, dst, sizeBytes);
|
||||
@@ -1938,7 +1951,11 @@ void ihipStream_t::lockedSymbolCopyAsync(hc::accelerator &acc, void* dst, void*
|
||||
}
|
||||
}
|
||||
if(kind == hipMemcpyDeviceToHost) {
|
||||
#if (__hcc_workweek__ >= 17332)
|
||||
hc::AmPointerInfo dstPtrInfo(NULL, NULL, NULL, 0, acc, 0, 0);
|
||||
#else
|
||||
hc::AmPointerInfo dstPtrInfo(NULL, NULL, 0, acc, 0, 0);
|
||||
#endif
|
||||
bool dstTracked = (hc::am_memtracker_getinfo(&dstPtrInfo, dst) == AM_SUCCESS);
|
||||
if(dstTracked) {
|
||||
addSymbolPtrToTracker(acc, src, sizeBytes);
|
||||
@@ -1977,8 +1994,13 @@ void ihipStream_t::locked_copyAsync(void* dst, const void* src, size_t sizeBytes
|
||||
} else {
|
||||
|
||||
hc::accelerator acc;
|
||||
#if (__hcc_workweek__ >= 17332)
|
||||
hc::AmPointerInfo dstPtrInfo(NULL, NULL, NULL, 0, acc, 0, 0);
|
||||
hc::AmPointerInfo srcPtrInfo(NULL, NULL, NULL, 0, acc, 0, 0);
|
||||
#else
|
||||
hc::AmPointerInfo dstPtrInfo(NULL, NULL, 0, acc, 0, 0);
|
||||
hc::AmPointerInfo srcPtrInfo(NULL, NULL, 0, acc, 0, 0);
|
||||
#endif
|
||||
bool dstTracked = getTailoredPtrInfo(&dstPtrInfo, dst, sizeBytes);
|
||||
bool srcTracked = getTailoredPtrInfo(&srcPtrInfo, src, sizeBytes);
|
||||
|
||||
|
||||
@@ -108,9 +108,12 @@ void * allocAndSharePtr(const char *msg, size_t sizeBytes, ihipCtx_t *ctx, bool
|
||||
|
||||
auto device = ctx->getWriteableDevice();
|
||||
|
||||
#if (__hcc_workweek__ >= 17332)
|
||||
if (alignment != 0) {
|
||||
ptr = hc::am_aligned_alloc(sizeBytes, device->_acc, amFlags, alignment);
|
||||
} else {
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
ptr = hc::am_alloc(sizeBytes, device->_acc, amFlags);
|
||||
}
|
||||
tprintf(DB_MEM, " alloc %s ptr:%p-%p size:%zu on dev:%d\n",
|
||||
@@ -149,7 +152,11 @@ hipError_t hipPointerGetAttributes(hipPointerAttribute_t *attributes, const void
|
||||
hipError_t e = hipSuccess;
|
||||
|
||||
hc::accelerator acc;
|
||||
#if (__hcc_workweek__ >= 17332)
|
||||
hc::AmPointerInfo amPointerInfo(NULL, NULL, NULL, 0, acc, 0, 0);
|
||||
#else
|
||||
hc::AmPointerInfo amPointerInfo(NULL, NULL, 0, acc, 0, 0);
|
||||
#endif
|
||||
am_status_t status = hc::am_memtracker_getinfo(&amPointerInfo, ptr);
|
||||
if (status == AM_SUCCESS) {
|
||||
|
||||
@@ -199,7 +206,11 @@ hipError_t hipHostGetDevicePointer(void **devicePointer, void *hostPointer, unsi
|
||||
e = hipErrorInvalidValue;
|
||||
} else {
|
||||
hc::accelerator acc;
|
||||
#if (__hcc_workweek__ >= 17332)
|
||||
hc::AmPointerInfo amPointerInfo(NULL, NULL, NULL, 0, acc, 0, 0);
|
||||
#else
|
||||
hc::AmPointerInfo amPointerInfo(NULL, NULL, 0, acc, 0, 0);
|
||||
#endif
|
||||
am_status_t status = hc::am_memtracker_getinfo(&amPointerInfo, hostPointer);
|
||||
if (status == AM_SUCCESS) {
|
||||
*devicePointer = static_cast<char*>(amPointerInfo._devicePointer) + (static_cast<char*>(hostPointer) - static_cast<char*>(amPointerInfo._hostPointer)) ;
|
||||
@@ -581,7 +592,11 @@ hipError_t hipHostGetFlags(unsigned int* flagsPtr, void* hostPtr)
|
||||
hipError_t hip_status = hipSuccess;
|
||||
|
||||
hc::accelerator acc;
|
||||
#if (__hcc_workweek__ >= 17332)
|
||||
hc::AmPointerInfo amPointerInfo(NULL, NULL, NULL, 0, acc, 0, 0);
|
||||
#else
|
||||
hc::AmPointerInfo amPointerInfo(NULL, NULL, 0, acc, 0, 0);
|
||||
#endif
|
||||
am_status_t status = hc::am_memtracker_getinfo(&amPointerInfo, hostPtr);
|
||||
if(status == AM_SUCCESS){
|
||||
*flagsPtr = amPointerInfo._appAllocationFlags;
|
||||
@@ -612,7 +627,11 @@ hipError_t hipHostRegister(void *hostPtr, size_t sizeBytes, unsigned int flags)
|
||||
}
|
||||
|
||||
hc::accelerator acc;
|
||||
#if (__hcc_workweek__ >= 17332)
|
||||
hc::AmPointerInfo amPointerInfo(NULL, NULL, NULL, 0, acc, 0, 0);
|
||||
#else
|
||||
hc::AmPointerInfo amPointerInfo(NULL, NULL, 0, acc, 0, 0);
|
||||
#endif
|
||||
am_status_t am_status = hc::am_memtracker_getinfo(&amPointerInfo, hostPtr);
|
||||
|
||||
if(am_status == AM_SUCCESS){
|
||||
@@ -1412,7 +1431,11 @@ hipError_t hipMemPtrGetInfo(void *ptr, size_t *size)
|
||||
|
||||
if(ptr != nullptr && size != nullptr){
|
||||
hc::accelerator acc;
|
||||
#if (__hcc_workweek__ >= 17332)
|
||||
hc::AmPointerInfo amPointerInfo(NULL, NULL, NULL, 0, acc, 0, 0);
|
||||
#else
|
||||
hc::AmPointerInfo amPointerInfo(NULL, NULL, 0, acc, 0, 0);
|
||||
#endif
|
||||
am_status_t status = hc::am_memtracker_getinfo(&amPointerInfo, ptr);
|
||||
if(status == AM_SUCCESS){
|
||||
*size = amPointerInfo._sizeBytes;
|
||||
@@ -1437,7 +1460,11 @@ hipError_t hipFree(void* ptr)
|
||||
|
||||
if (ptr) {
|
||||
hc::accelerator acc;
|
||||
#if (__hcc_workweek__ >= 17332)
|
||||
hc::AmPointerInfo amPointerInfo(NULL, NULL, NULL, 0, acc, 0, 0);
|
||||
#else
|
||||
hc::AmPointerInfo amPointerInfo(NULL, NULL, 0, acc, 0, 0);
|
||||
#endif
|
||||
am_status_t status = hc::am_memtracker_getinfo(&amPointerInfo, ptr);
|
||||
if(status == AM_SUCCESS){
|
||||
if(amPointerInfo._hostPointer == NULL){
|
||||
@@ -1465,7 +1492,11 @@ hipError_t hipHostFree(void* ptr)
|
||||
hipError_t hipStatus = hipErrorInvalidValue;
|
||||
if (ptr) {
|
||||
hc::accelerator acc;
|
||||
#if (__hcc_workweek__ >= 17332)
|
||||
hc::AmPointerInfo amPointerInfo(NULL, NULL, NULL, 0, acc, 0, 0);
|
||||
#else
|
||||
hc::AmPointerInfo amPointerInfo(NULL, NULL, 0, acc, 0, 0);
|
||||
#endif
|
||||
am_status_t status = hc::am_memtracker_getinfo(&amPointerInfo, ptr);
|
||||
if(status == AM_SUCCESS){
|
||||
if(amPointerInfo._hostPointer == ptr){
|
||||
@@ -1499,7 +1530,11 @@ hipError_t hipFreeArray(hipArray* array)
|
||||
|
||||
if(array->data) {
|
||||
hc::accelerator acc;
|
||||
#if (__hcc_workweek__ >= 17332)
|
||||
hc::AmPointerInfo amPointerInfo(NULL, NULL, NULL, 0, acc, 0, 0);
|
||||
#else
|
||||
hc::AmPointerInfo amPointerInfo(NULL, NULL, 0, acc, 0, 0);
|
||||
#endif
|
||||
am_status_t status = hc::am_memtracker_getinfo(&amPointerInfo, array->data);
|
||||
if(status == AM_SUCCESS){
|
||||
if(amPointerInfo._hostPointer == NULL){
|
||||
@@ -1517,7 +1552,11 @@ hipError_t hipMemGetAddressRange ( hipDeviceptr_t* pbase, size_t* psize, hipDevi
|
||||
HIP_INIT_API ( pbase , psize , dptr );
|
||||
hipError_t hipStatus = hipSuccess;
|
||||
hc::accelerator acc;
|
||||
#if (__hcc_workweek__ >= 17332)
|
||||
hc::AmPointerInfo amPointerInfo( NULL , NULL , NULL, 0 , acc , 0 , 0 );
|
||||
#else
|
||||
hc::AmPointerInfo amPointerInfo( NULL , NULL, 0 , acc , 0 , 0 );
|
||||
#endif
|
||||
am_status_t status = hc::am_memtracker_getinfo( &amPointerInfo , dptr );
|
||||
if (status == AM_SUCCESS) {
|
||||
*pbase = amPointerInfo._devicePointer;
|
||||
@@ -1540,7 +1579,11 @@ hipError_t hipIpcGetMemHandle(hipIpcMemHandle_t* handle, void* devPtr){
|
||||
if((handle == NULL) || (devPtr == NULL)) {
|
||||
hipStatus = hipErrorInvalidResourceHandle;
|
||||
} else {
|
||||
#if (__hcc_workweek__ >= 17332)
|
||||
hc::AmPointerInfo amPointerInfo( NULL , NULL , NULL, 0 , acc , 0 , 0 );
|
||||
#else
|
||||
hc::AmPointerInfo amPointerInfo( NULL , NULL , 0 , acc , 0 , 0 );
|
||||
#endif
|
||||
am_status_t status = hc::am_memtracker_getinfo( &amPointerInfo , devPtr );
|
||||
if (status == AM_SUCCESS) {
|
||||
psize = (size_t)amPointerInfo._sizeBytes;
|
||||
|
||||
Ссылка в новой задаче
Block a user