Skip to content

Commit fa1d09c

Browse files
rakesroyJeniferC99
authored andcommitted
SWDEV-483134 - Remove hipExtHostAlloc API
Change-Id: Ib1538546794194cdce77516ebfa8f5d06da69f1b
1 parent f5d6153 commit fa1d09c

9 files changed

Lines changed: 14 additions & 78 deletions

File tree

CHANGELOG.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,6 @@ Full documentation for HIP is available at [rocm.docs.amd.com](https://rocm.docs
1919
- `hipDrvGraphAddMemFreeNode` creates a memory free node and adds it to a graph.
2020
- `hipDrvGraphExecMemcpyNodeSetParams` sets the parameters for a memcpy node in the given graphExec.
2121
- `hipDrvGraphExecMemsetNodeSetParams` sets the parameters for a memset node in the given graphExec.
22-
- `hipExtHostAlloc` preserves the functionality of `hipHostMalloc`.
23-
24-
* Deprecated HIP APIs
25-
- `hipHostMalloc` to be replaced by `hipExtHostAlloc`.
26-
- `hipHostFree` to be replaced by `hipFreeHost`.
2722

2823
### Resolved issues
2924

hipamd/include/hip/amd_detail/hip_api_trace.hpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
// - Reset any of the *_STEP_VERSION defines to zero if the corresponding *_MAJOR_VERSION increases
6262
#define HIP_API_TABLE_STEP_VERSION 0
6363
#define HIP_COMPILER_API_TABLE_STEP_VERSION 0
64-
#define HIP_RUNTIME_API_TABLE_STEP_VERSION 5
64+
#define HIP_RUNTIME_API_TABLE_STEP_VERSION 4
6565

6666
// HIP API interface
6767
typedef hipError_t (*t___hipPopCallConfiguration)(dim3* gridDim, dim3* blockDim, size_t* sharedMem,
@@ -998,9 +998,6 @@ typedef hipError_t (*t_hipDrvGraphMemcpyNodeGetParams)(hipGraphNode_t hNode,
998998
typedef hipError_t (*t_hipDrvGraphMemcpyNodeSetParams)(hipGraphNode_t hNode,
999999
const HIP_MEMCPY3D* nodeParams);
10001000

1001-
typedef hipError_t (*t_hipExtHostAlloc)(void **ptr, size_t size,
1002-
unsigned int flags);
1003-
10041001
// HIP Compiler dispatch table
10051002
struct HipCompilerDispatchTable {
10061003
// HIP_COMPILER_API_TABLE_STEP_VERSION == 0
@@ -1510,11 +1507,8 @@ struct HipDispatchTable {
15101507
t_hipDrvGraphMemcpyNodeGetParams hipDrvGraphMemcpyNodeGetParams_fn;
15111508
t_hipDrvGraphMemcpyNodeSetParams hipDrvGraphMemcpyNodeSetParams_fn;
15121509

1513-
// HIP_RUNTIME_API_TABLE_STEP_VERSION == 5
1514-
t_hipExtHostAlloc hipExtHostAlloc_fn;
1515-
15161510
// DO NOT EDIT ABOVE!
1517-
// HIP_RUNTIME_API_TABLE_STEP_VERSION == 6
1511+
// HIP_RUNTIME_API_TABLE_STEP_VERSION == 5
15181512

15191513
// ******************************************************************************************* //
15201514
//

hipamd/include/hip/amd_detail/hip_prof_str.h

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -424,8 +424,7 @@ enum hip_api_id_t {
424424
HIP_API_ID_hipMemcpyDtoA = 404,
425425
HIP_API_ID_hipMemcpyHtoAAsync = 405,
426426
HIP_API_ID_hipSetValidDevices = 406,
427-
HIP_API_ID_hipExtHostAlloc = 407,
428-
HIP_API_ID_LAST = 407,
427+
HIP_API_ID_LAST = 406,
429428

430429
HIP_API_ID_hipChooseDevice = HIP_API_ID_CONCAT(HIP_API_ID_,hipChooseDevice),
431430
HIP_API_ID_hipGetDeviceProperties = HIP_API_ID_CONCAT(HIP_API_ID_,hipGetDeviceProperties),
@@ -672,7 +671,6 @@ static inline const char* hip_api_name(const uint32_t id) {
672671
case HIP_API_ID_hipHostGetDevicePointer: return "hipHostGetDevicePointer";
673672
case HIP_API_ID_hipHostGetFlags: return "hipHostGetFlags";
674673
case HIP_API_ID_hipHostMalloc: return "hipHostMalloc";
675-
case HIP_API_ID_hipExtHostAlloc: return "hipExtHostAlloc";
676674
case HIP_API_ID_hipHostRegister: return "hipHostRegister";
677675
case HIP_API_ID_hipHostUnregister: return "hipHostUnregister";
678676
case HIP_API_ID_hipImportExternalMemory: return "hipImportExternalMemory";
@@ -1075,7 +1073,6 @@ static inline uint32_t hipApiIdByName(const char* name) {
10751073
if (strcmp("hipHostGetDevicePointer", name) == 0) return HIP_API_ID_hipHostGetDevicePointer;
10761074
if (strcmp("hipHostGetFlags", name) == 0) return HIP_API_ID_hipHostGetFlags;
10771075
if (strcmp("hipHostMalloc", name) == 0) return HIP_API_ID_hipHostMalloc;
1078-
if (strcmp("hipExtHostAlloc", name) == 0) return HIP_API_ID_hipExtHostAlloc;
10791076
if (strcmp("hipHostRegister", name) == 0) return HIP_API_ID_hipHostRegister;
10801077
if (strcmp("hipHostUnregister", name) == 0) return HIP_API_ID_hipHostUnregister;
10811078
if (strcmp("hipImportExternalMemory", name) == 0) return HIP_API_ID_hipImportExternalMemory;
@@ -2465,12 +2462,6 @@ typedef struct hip_api_data_s {
24652462
size_t size;
24662463
unsigned int flags;
24672464
} hipHostMalloc;
2468-
struct {
2469-
void** ptr;
2470-
void* ptr__val;
2471-
size_t size;
2472-
unsigned int flags;
2473-
} hipExtHostAlloc;
24742465
struct {
24752466
void* hostPtr;
24762467
size_t sizeBytes;
@@ -4818,12 +4809,6 @@ typedef struct hip_api_data_s {
48184809
cb_data.args.hipHostMalloc.size = (size_t)sizeBytes; \
48194810
cb_data.args.hipHostMalloc.flags = (unsigned int)flags; \
48204811
};
4821-
// hipExtHostAlloc[('void**', 'ptr'), ('size_t', 'size'), ('unsigned int', 'flags')]
4822-
#define INIT_hipExtHostAlloc_CB_ARGS_DATA(cb_data) { \
4823-
cb_data.args.hipExtHostAlloc.ptr = (void**)ptr; \
4824-
cb_data.args.hipExtHostAlloc.size = (size_t)sizeBytes; \
4825-
cb_data.args.hipExtHostAlloc.flags = (unsigned int)flags; \
4826-
};
48274812
// hipHostRegister[('void*', 'hostPtr'), ('size_t', 'sizeBytes'), ('unsigned int', 'flags')]
48284813
#define INIT_hipHostRegister_CB_ARGS_DATA(cb_data) { \
48294814
cb_data.args.hipHostRegister.hostPtr = (void*)hostPtr; \
@@ -6912,10 +6897,6 @@ static inline void hipApiArgsInit(hip_api_id_t id, hip_api_data_t* data) {
69126897
case HIP_API_ID_hipHostMalloc:
69136898
if (data->args.hipHostMalloc.ptr) data->args.hipHostMalloc.ptr__val = *(data->args.hipHostMalloc.ptr);
69146899
break;
6915-
// hipExtHostAlloc[('void**', 'ptr'), ('size_t', 'size'), ('unsigned int', 'flags')]
6916-
case HIP_API_ID_hipExtHostAlloc:
6917-
if (data->args.hipExtHostAlloc.ptr) data->args.hipExtHostAlloc.ptr__val = *(data->args.hipExtHostAlloc.ptr);
6918-
break;
69196900
// hipHostRegister[('void*', 'hostPtr'), ('size_t', 'sizeBytes'), ('unsigned int', 'flags')]
69206901
case HIP_API_ID_hipHostRegister:
69216902
break;
@@ -9261,14 +9242,6 @@ static inline const char* hipApiString(hip_api_id_t id, const hip_api_data_t* da
92619242
oss << ", flags="; roctracer::hip_support::detail::operator<<(oss, data->args.hipHostMalloc.flags);
92629243
oss << ")";
92639244
break;
9264-
case HIP_API_ID_hipExtHostAlloc:
9265-
oss << "hipExtHostAlloc(";
9266-
if (data->args.hipExtHostAlloc.ptr == NULL) oss << "ptr=NULL";
9267-
else { oss << "ptr="; roctracer::hip_support::detail::operator<<(oss, data->args.hipExtHostAlloc.ptr__val); }
9268-
oss << ", size="; roctracer::hip_support::detail::operator<<(oss, data->args.hipExtHostAlloc.size);
9269-
oss << ", flags="; roctracer::hip_support::detail::operator<<(oss, data->args.hipExtHostAlloc.flags);
9270-
oss << ")";
9271-
break;
92729245
case HIP_API_ID_hipHostRegister:
92739246
oss << "hipHostRegister(";
92749247
oss << "hostPtr="; roctracer::hip_support::detail::operator<<(oss, data->args.hipHostRegister.hostPtr);

hipamd/src/amdhip.def

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,4 +478,3 @@ hipGraphNodeSetParams
478478
hipGraphExecNodeSetParams
479479
hipDrvGraphMemcpyNodeSetParams
480480
hipDrvGraphMemcpyNodeGetParams
481-
hipExtHostAlloc

hipamd/src/hip_api_trace.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,6 @@ hipError_t hipHostFree(void* ptr);
347347
hipError_t hipHostGetDevicePointer(void** devPtr, void* hstPtr, unsigned int flags);
348348
hipError_t hipHostGetFlags(unsigned int* flagsPtr, void* hostPtr);
349349
hipError_t hipHostMalloc(void** ptr, size_t size, unsigned int flags);
350-
hipError_t hipExtHostAlloc(void** ptr, size_t size, unsigned int flags);
351350
hipError_t hipHostRegister(void* hostPtr, size_t sizeBytes, unsigned int flags);
352351
hipError_t hipHostUnregister(void* hostPtr);
353352
hipError_t hipImportExternalMemory(hipExternalMemory_t* extMem_out,
@@ -1027,7 +1026,6 @@ void UpdateDispatchTable(HipDispatchTable* ptrDispatchTable) {
10271026
ptrDispatchTable->hipHostGetDevicePointer_fn = hip::hipHostGetDevicePointer;
10281027
ptrDispatchTable->hipHostGetFlags_fn = hip::hipHostGetFlags;
10291028
ptrDispatchTable->hipHostMalloc_fn = hip::hipHostMalloc;
1030-
ptrDispatchTable->hipExtHostAlloc_fn = hip::hipExtHostAlloc;
10311029
ptrDispatchTable->hipHostRegister_fn = hip::hipHostRegister;
10321030
ptrDispatchTable->hipHostUnregister_fn = hip::hipHostUnregister;
10331031
ptrDispatchTable->hipImportExternalMemory_fn = hip::hipImportExternalMemory;
@@ -1879,18 +1877,16 @@ HIP_ENFORCE_ABI(HipDispatchTable, hipGraphExecNodeSetParams_fn, 457);
18791877
HIP_ENFORCE_ABI(HipDispatchTable, hipExternalMemoryGetMappedMipmappedArray_fn, 458)
18801878
HIP_ENFORCE_ABI(HipDispatchTable, hipDrvGraphMemcpyNodeGetParams_fn, 459)
18811879
HIP_ENFORCE_ABI(HipDispatchTable, hipDrvGraphMemcpyNodeSetParams_fn, 460)
1882-
// HIP_RUNTIME_API_TABLE_STEP_VERSION == 5
1883-
HIP_ENFORCE_ABI(HipDispatchTable, hipExtHostAlloc_fn, 461)
18841880

18851881
// if HIP_ENFORCE_ABI entries are added for each new function pointer in the table, the number below
18861882
// will be +1 of the number in the last HIP_ENFORCE_ABI line. E.g.:
18871883
//
18881884
// HIP_ENFORCE_ABI(<table>, <functor>, 8)
18891885
//
18901886
// HIP_ENFORCE_ABI_VERSIONING(<table>, 9) <- 8 + 1 = 9
1891-
HIP_ENFORCE_ABI_VERSIONING(HipDispatchTable, 462)
1887+
HIP_ENFORCE_ABI_VERSIONING(HipDispatchTable, 461)
18921888

1893-
static_assert(HIP_RUNTIME_API_TABLE_MAJOR_VERSION == 0 && HIP_RUNTIME_API_TABLE_STEP_VERSION == 5,
1889+
static_assert(HIP_RUNTIME_API_TABLE_MAJOR_VERSION == 0 && HIP_RUNTIME_API_TABLE_STEP_VERSION == 4,
18941890
"If you get this error, add new HIP_ENFORCE_ABI(...) code for the new function "
18951891
"pointers and then update this check so it is true");
18961892
#endif

hipamd/src/hip_hcc.map.in

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -578,10 +578,3 @@ global:
578578
local:
579579
*;
580580
} hip_6.1;
581-
582-
hip_6.3 {
583-
global:
584-
hipExtHostAlloc;
585-
local:
586-
*;
587-
} hip_6.2;

hipamd/src/hip_memory.cpp

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ hipError_t ihipHostMalloc(void** ptr, size_t sizeBytes, unsigned int flags)
352352
}
353353

354354
*ptr = nullptr;
355-
const unsigned int coherentFlags = hipExtHostAllocCoherent | hipExtHostAllocNonCoherent;
355+
const unsigned int coherentFlags = hipHostMallocCoherent | hipHostMallocNonCoherent;
356356

357357
// can't have both Coherent and NonCoherent flags set at the same time
358358
if ((flags & coherentFlags) == coherentFlags) {
@@ -365,16 +365,16 @@ hipError_t ihipHostMalloc(void** ptr, size_t sizeBytes, unsigned int flags)
365365

366366
unsigned int ihipFlags = CL_MEM_SVM_FINE_GRAIN_BUFFER;
367367
if (flags == 0 ||
368-
flags & (hipExtHostAllocCoherent | hipHostAllocMapped | hipExtHostAllocNumaUser) ||
369-
(!(flags & hipExtHostAllocNonCoherent) && HIP_HOST_COHERENT)) {
368+
flags & (hipHostMallocCoherent | hipHostMallocMapped | hipHostMallocNumaUser) ||
369+
(!(flags & hipHostMallocNonCoherent) && HIP_HOST_COHERENT)) {
370370
ihipFlags |= CL_MEM_SVM_ATOMICS;
371371
}
372372

373-
if (flags & hipExtHostAllocNumaUser) {
373+
if (flags & hipHostMallocNumaUser) {
374374
ihipFlags |= CL_MEM_FOLLOW_USER_NUMA_POLICY;
375375
}
376376

377-
if (flags & hipExtHostAllocNonCoherent) {
377+
if (flags & hipHostMallocNonCoherent) {
378378
ihipFlags &= ~CL_MEM_SVM_ATOMICS;
379379
}
380380

@@ -686,16 +686,6 @@ hipError_t hipHostMalloc(void** ptr, size_t sizeBytes, unsigned int flags) {
686686
HIP_RETURN_DURATION(status, *ptr);
687687
}
688688

689-
hipError_t hipExtHostAlloc(void** ptr, size_t sizeBytes, unsigned int flags) {
690-
HIP_INIT_API(hipExtHostAlloc, ptr, sizeBytes, flags);
691-
CHECK_STREAM_CAPTURE_SUPPORTED();
692-
if (ptr == nullptr) {
693-
HIP_RETURN(hipErrorInvalidValue);
694-
}
695-
hipError_t status = ihipHostMalloc(ptr, sizeBytes, flags);
696-
HIP_RETURN_DURATION(status, *ptr);
697-
}
698-
699689
hipError_t hipFree(void* ptr) {
700690
HIP_INIT_API(hipFree, ptr);
701691
CHECK_STREAM_CAPTURE_SUPPORTED();
@@ -1240,7 +1230,7 @@ hipError_t hipHostGetFlags(unsigned int* flagsPtr, void* hostPtr) {
12401230
}
12411231

12421232
// To match with Nvidia behaviour validate that hostPtr passed
1243-
// was allocated using hipHostAlloc(), and not hipMalloc()
1233+
// was allocated using hipHostMalloc(), and not hipMalloc()
12441234
if (!(svmMem->getMemFlags() & CL_MEM_SVM_FINE_GRAIN_BUFFER)) {
12451235
HIP_RETURN(hipErrorInvalidValue);
12461236
}
@@ -1332,12 +1322,11 @@ hipError_t hipHostUnregister(void* hostPtr) {
13321322
hipError_t hipHostAlloc(void** ptr, size_t sizeBytes, unsigned int flags) {
13331323
HIP_INIT_API(hipHostAlloc, ptr, sizeBytes, flags);
13341324
CHECK_STREAM_CAPTURE_SUPPORTED();
1335-
13361325
if (ptr == nullptr) {
13371326
HIP_RETURN(hipErrorInvalidValue);
13381327
}
1339-
if (flags > (hipHostAllocPortable | hipHostAllocMapped |
1340-
hipHostAllocWriteCombined)) {
1328+
if (flags > (hipHostMallocPortable | hipHostMallocMapped |
1329+
hipHostMallocWriteCombined)) {
13411330
HIP_RETURN(hipErrorInvalidValue);
13421331
}
13431332

hipamd/src/hip_table_interface.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1810,6 +1810,3 @@ hipError_t hipDrvGraphMemcpyNodeGetParams(hipGraphNode_t hNode, HIP_MEMCPY3D* no
18101810
hipError_t hipDrvGraphMemcpyNodeSetParams(hipGraphNode_t hNode, const HIP_MEMCPY3D* nodeParams) {
18111811
return hip::GetHipDispatchTable()->hipDrvGraphMemcpyNodeSetParams_fn(hNode, nodeParams);
18121812
}
1813-
hipError_t hipExtHostAlloc(void** ptr, size_t size, unsigned int flags) {
1814-
return hip::GetHipDispatchTable()->hipExtHostAlloc_fn(ptr, size, flags);
1815-
}

rocclr/utils/flags.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ release(uint, HIP_LAUNCH_BLOCKING, 0, \
172172
release(bool, PAL_ALWAYS_RESIDENT, false, \
173173
"Force memory resources to become resident at allocation time") \
174174
release(uint, HIP_HOST_COHERENT, 0, \
175-
"Coherent memory in hipExtHostAlloc, 0x1 = memory is coherent with host"\
175+
"Coherent memory in hipHostMalloc, 0x1 = memory is coherent with host"\
176176
"0x0 = memory is not coherent between host and GPU") \
177177
release(uint, AMD_OPT_FLUSH, 1, \
178178
"Kernel flush option , 0x0 = Use system-scope fence operations." \

0 commit comments

Comments
 (0)