Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions projects/clr/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@ Copy operations at or below the 256-row threshold are unchanged.
- Streamlined batch grouping:
* Removed the `AgentGroup/src_agent` mapping for D2D broadcasts.
* Processed `H2D` and `D2H` LINEAR operations directly, bypassing the broadcast map.

## HIP 8.0 for ROCm 8.0

### Added
* An optional `HIP_FORCE_API_VERSION` macro can be used to select an older version of the HIP APIs. For example, `HIP_FORCE_API_VERSION=600` selects the HIP 6.0 APIs. This macro must be defined before including `hip_runtime_api.h`.

### Deprecated

* `hipMemAdvise` is now an alias for `hipMemAdvise_v2`. To use the previous version of `hipMemAdvise`, define `HIP_FORCE_API_VERSION` as a non-zero value less than 800.

## HIP 7.14 for ROCm 7.14

Expand Down
2 changes: 1 addition & 1 deletion projects/clr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: MIT

cmake_minimum_required(VERSION 3.16.8)
cmake_minimum_required(VERSION 3.27)
project(clr)

##########
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ typedef hipError_t (*t_hipBindTextureToArray)(const textureReference* tex, hipAr
typedef hipError_t (*t_hipBindTextureToMipmappedArray)(const textureReference* tex,
hipMipmappedArray_const_t mipmappedArray,
const hipChannelFormatDesc* desc);
typedef hipError_t (*t_hipChooseDevice)(int* device, const hipDeviceProp_t* prop);
typedef hipError_t (*t_hipChooseDevice)(int* device, const hipDeviceProp_tR0600* prop);
typedef hipError_t (*t_hipChooseDeviceR0000)(int* device, const hipDeviceProp_tR0000* properties);
typedef hipError_t (*t_hipConfigureCall)(dim3 gridDim, dim3 blockDim, size_t sharedMem,
hipStream_t stream);
Expand Down
78 changes: 41 additions & 37 deletions projects/clr/hipamd/include/hip/amd_detail/hip_prof_str.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
#include <hip/hip_deprecated.h>
#include "amd_hip_gl_interop.h"

#define HIP_API_ID_CONCAT_HELPER(a,b) a##b
#define HIP_API_ID_CONCAT(a,b) HIP_API_ID_CONCAT_HELPER(a,b)

// HIP API callbacks ID enumeration
enum hip_api_id_t {
HIP_API_ID_NONE = 0,
Expand Down Expand Up @@ -511,8 +508,6 @@ enum hip_api_id_t {
HIP_API_ID_hipInitDevice = 486,
HIP_API_ID_LAST = 486,

HIP_API_ID_hipChooseDevice = HIP_API_ID_CONCAT(HIP_API_ID_,hipChooseDevice),
HIP_API_ID_hipGetDeviceProperties = HIP_API_ID_CONCAT(HIP_API_ID_,hipGetDeviceProperties),

HIP_API_ID_hipBindTexture = HIP_API_ID_NONE,
HIP_API_ID_hipBindTexture2D = HIP_API_ID_NONE,
Expand Down Expand Up @@ -541,9 +536,6 @@ enum hip_api_id_t {
HIP_API_ID_hipUnbindTexture = HIP_API_ID_NONE,
};

#undef HIP_API_ID_CONCAT_HELPER
#undef HIP_API_ID_CONCAT

// Return the HIP API string for a given callback ID
static inline const char* hip_api_name(const uint32_t id) {
switch(id) {
Expand Down Expand Up @@ -594,14 +586,14 @@ static inline const char* hip_api_name(const uint32_t id) {
case HIP_API_ID_hipDeviceGetExecutionCtx: return "hipDeviceGetExecutionCtx";
case HIP_API_ID_hipDeviceGetGraphMemAttribute: return "hipDeviceGetGraphMemAttribute";
case HIP_API_ID_hipDeviceGetLimit: return "hipDeviceGetLimit";
case HIP_API_ID_hipDeviceGetLuid: return "hipDeviceGetLuid";
case HIP_API_ID_hipDeviceGetMemPool: return "hipDeviceGetMemPool";
case HIP_API_ID_hipDeviceGetName: return "hipDeviceGetName";
case HIP_API_ID_hipDeviceGetP2PAttribute: return "hipDeviceGetP2PAttribute";
case HIP_API_ID_hipDeviceGetPCIBusId: return "hipDeviceGetPCIBusId";
case HIP_API_ID_hipDeviceGetSharedMemConfig: return "hipDeviceGetSharedMemConfig";
case HIP_API_ID_hipDeviceGetStreamPriorityRange: return "hipDeviceGetStreamPriorityRange";
case HIP_API_ID_hipDeviceGetUuid: return "hipDeviceGetUuid";
case HIP_API_ID_hipDeviceGetLuid: return "hipDeviceGetLuid";
case HIP_API_ID_hipDeviceGraphMemTrim: return "hipDeviceGraphMemTrim";
case HIP_API_ID_hipDevicePrimaryCtxGetState: return "hipDevicePrimaryCtxGetState";
case HIP_API_ID_hipDevicePrimaryCtxRelease: return "hipDevicePrimaryCtxRelease";
Expand Down Expand Up @@ -1074,14 +1066,14 @@ static inline uint32_t hipApiIdByName(const char* name) {
if (strcmp("hipDeviceGetExecutionCtx", name) == 0) return HIP_API_ID_hipDeviceGetExecutionCtx;
if (strcmp("hipDeviceGetGraphMemAttribute", name) == 0) return HIP_API_ID_hipDeviceGetGraphMemAttribute;
if (strcmp("hipDeviceGetLimit", name) == 0) return HIP_API_ID_hipDeviceGetLimit;
if (strcmp("hipDeviceGetLuid", name) == 0) return HIP_API_ID_hipDeviceGetLuid;
if (strcmp("hipDeviceGetMemPool", name) == 0) return HIP_API_ID_hipDeviceGetMemPool;
if (strcmp("hipDeviceGetName", name) == 0) return HIP_API_ID_hipDeviceGetName;
if (strcmp("hipDeviceGetP2PAttribute", name) == 0) return HIP_API_ID_hipDeviceGetP2PAttribute;
if (strcmp("hipDeviceGetPCIBusId", name) == 0) return HIP_API_ID_hipDeviceGetPCIBusId;
if (strcmp("hipDeviceGetSharedMemConfig", name) == 0) return HIP_API_ID_hipDeviceGetSharedMemConfig;
if (strcmp("hipDeviceGetStreamPriorityRange", name) == 0) return HIP_API_ID_hipDeviceGetStreamPriorityRange;
if (strcmp("hipDeviceGetUuid", name) == 0) return HIP_API_ID_hipDeviceGetUuid;
if (strcmp("hipDeviceGetLuid", name) == 0) return HIP_API_ID_hipDeviceGetLuid;
if (strcmp("hipDeviceGraphMemTrim", name) == 0) return HIP_API_ID_hipDeviceGraphMemTrim;
if (strcmp("hipDevicePrimaryCtxGetState", name) == 0) return HIP_API_ID_hipDevicePrimaryCtxGetState;
if (strcmp("hipDevicePrimaryCtxRelease", name) == 0) return HIP_API_ID_hipDevicePrimaryCtxRelease;
Expand Down Expand Up @@ -1746,6 +1738,13 @@ typedef struct hip_api_data_s {
size_t pValue__val;
enum hipLimit_t limit;
} hipDeviceGetLimit;
struct {
char* luid;
char luid__val;
unsigned int* deviceNodeMask;
unsigned int deviceNodeMask__val;
hipDevice_t device;
} hipDeviceGetLuid;
struct {
hipMemPool_t* mem_pool;
hipMemPool_t mem_pool__val;
Expand Down Expand Up @@ -1785,13 +1784,6 @@ typedef struct hip_api_data_s {
hipUUID uuid__val;
hipDevice_t device;
} hipDeviceGetUuid;
struct {
char* luid;
char luid__val;
unsigned int* deviceNodeMask;
unsigned int deviceNodeMask__val;
hipDevice_t device;
} hipDeviceGetLuid;
struct {
int device;
} hipDeviceGraphMemTrim;
Expand Down Expand Up @@ -4657,6 +4649,12 @@ typedef struct hip_api_data_s {
cb_data.args.hipDeviceGetLimit.pValue = (size_t*)pValue; \
cb_data.args.hipDeviceGetLimit.limit = (hipLimit_t)limit; \
};
// hipDeviceGetLuid[('char*', 'luid'), ('unsigned int*', 'deviceNodeMask'), ('hipDevice_t', 'device')]
#define INIT_hipDeviceGetLuid_CB_ARGS_DATA(cb_data) { \
cb_data.args.hipDeviceGetLuid.luid = (char*)luid; \
cb_data.args.hipDeviceGetLuid.deviceNodeMask = (unsigned int*)deviceNodeMask; \
cb_data.args.hipDeviceGetLuid.device = (hipDevice_t)device; \
};
// hipDeviceGetMemPool[('hipMemPool_t*', 'mem_pool'), ('int', 'device')]
#define INIT_hipDeviceGetMemPool_CB_ARGS_DATA(cb_data) { \
cb_data.args.hipDeviceGetMemPool.mem_pool = (hipMemPool_t*)mem_pool; \
Expand Down Expand Up @@ -4695,12 +4693,6 @@ typedef struct hip_api_data_s {
cb_data.args.hipDeviceGetUuid.uuid = (hipUUID*)uuid; \
cb_data.args.hipDeviceGetUuid.device = (hipDevice_t)device; \
};
// hipDeviceGetLuid[('char*', 'luid'), ('unsigned int*', 'deviceNodeMask'), ('hipDevice_t', 'device')]
#define INIT_hipDeviceGetLuid_CB_ARGS_DATA(cb_data) { \
cb_data.args.hipDeviceGetLuid.luid = (char*)luid; \
cb_data.args.hipDeviceGetLuid.deviceNodeMask = (unsigned int*)deviceNodeMask; \
cb_data.args.hipDeviceGetLuid.device = (hipDevice_t)device; \
};
// hipDeviceGraphMemTrim[('int', 'device')]
#define INIT_hipDeviceGraphMemTrim_CB_ARGS_DATA(cb_data) { \
cb_data.args.hipDeviceGraphMemTrim.device = (int)device; \
Expand Down Expand Up @@ -5550,6 +5542,9 @@ typedef struct hip_api_data_s {
};
// hipGraphKernelNodeGetAttribute[('hipGraphNode_t', 'hNode'), ('hipLaunchAttributeID', 'attr'), ('hipLaunchAttributeValue*', 'value')]
#define INIT_hipGraphKernelNodeGetAttribute_CB_ARGS_DATA(cb_data) { \
cb_data.args.hipGraphKernelNodeGetAttribute.hNode = (hipGraphNode_t)hNode; \
cb_data.args.hipGraphKernelNodeGetAttribute.attr = (hipLaunchAttributeID)attr; \
cb_data.args.hipGraphKernelNodeGetAttribute.value = (hipLaunchAttributeValue*)value; \
};
// hipGraphKernelNodeGetParams[('hipGraphNode_t', 'node'), ('hipKernelNodeParams*', 'pNodeParams')]
#define INIT_hipGraphKernelNodeGetParams_CB_ARGS_DATA(cb_data) { \
Expand All @@ -5558,6 +5553,9 @@ typedef struct hip_api_data_s {
};
// hipGraphKernelNodeSetAttribute[('hipGraphNode_t', 'hNode'), ('hipLaunchAttributeID', 'attr'), ('const hipLaunchAttributeValue*', 'value')]
#define INIT_hipGraphKernelNodeSetAttribute_CB_ARGS_DATA(cb_data) { \
cb_data.args.hipGraphKernelNodeSetAttribute.hNode = (hipGraphNode_t)hNode; \
cb_data.args.hipGraphKernelNodeSetAttribute.attr = (hipLaunchAttributeID)attr; \
cb_data.args.hipGraphKernelNodeSetAttribute.value = (const hipLaunchAttributeValue*)value; \
};
// hipGraphKernelNodeSetParams[('hipGraphNode_t', 'node'), ('const hipKernelNodeParams*', 'pNodeParams')]
#define INIT_hipGraphKernelNodeSetParams_CB_ARGS_DATA(cb_data) { \
Expand Down Expand Up @@ -7094,6 +7092,9 @@ typedef struct hip_api_data_s {
};
// hipStreamGetAttribute[('hipStream_t', 'stream'), ('hipLaunchAttributeID', 'attr'), ('hipLaunchAttributeValue*', 'value_out')]
#define INIT_hipStreamGetAttribute_CB_ARGS_DATA(cb_data) { \
cb_data.args.hipStreamGetAttribute.stream = (hipStream_t)stream; \
cb_data.args.hipStreamGetAttribute.attr = (hipLaunchAttributeID)attr; \
cb_data.args.hipStreamGetAttribute.value_out = (hipLaunchAttributeValue*)value_out; \
};
// hipStreamGetCaptureInfo[('hipStream_t', 'stream'), ('hipStreamCaptureStatus*', 'pCaptureStatus'), ('unsigned long long*', 'pId')]
#define INIT_hipStreamGetCaptureInfo_CB_ARGS_DATA(cb_data) { \
Expand Down Expand Up @@ -7147,6 +7148,9 @@ typedef struct hip_api_data_s {
};
// hipStreamSetAttribute[('hipStream_t', 'stream'), ('hipLaunchAttributeID', 'attr'), ('const hipLaunchAttributeValue*', 'value')]
#define INIT_hipStreamSetAttribute_CB_ARGS_DATA(cb_data) { \
cb_data.args.hipStreamSetAttribute.stream = (hipStream_t)stream; \
cb_data.args.hipStreamSetAttribute.attr = (hipLaunchAttributeID)attr; \
cb_data.args.hipStreamSetAttribute.value = (const hipLaunchAttributeValue*)value; \
};
// hipStreamSynchronize[('hipStream_t', 'stream')]
#define INIT_hipStreamSynchronize_CB_ARGS_DATA(cb_data) { \
Expand Down Expand Up @@ -7579,6 +7583,11 @@ static inline void hipApiArgsInit(hip_api_id_t id, hip_api_data_t* data) {
case HIP_API_ID_hipDeviceGetLimit:
if (data->args.hipDeviceGetLimit.pValue) data->args.hipDeviceGetLimit.pValue__val = *(data->args.hipDeviceGetLimit.pValue);
break;
// hipDeviceGetLuid[('char*', 'luid'), ('unsigned int*', 'deviceNodeMask'), ('hipDevice_t', 'device')]
case HIP_API_ID_hipDeviceGetLuid:
data->args.hipDeviceGetLuid.luid = (data->args.hipDeviceGetLuid.luid) ? strdup(data->args.hipDeviceGetLuid.luid) : NULL;
if (data->args.hipDeviceGetLuid.deviceNodeMask) data->args.hipDeviceGetLuid.deviceNodeMask__val = *(data->args.hipDeviceGetLuid.deviceNodeMask);
break;
// hipDeviceGetMemPool[('hipMemPool_t*', 'mem_pool'), ('int', 'device')]
case HIP_API_ID_hipDeviceGetMemPool:
if (data->args.hipDeviceGetMemPool.mem_pool) data->args.hipDeviceGetMemPool.mem_pool__val = *(data->args.hipDeviceGetMemPool.mem_pool);
Expand Down Expand Up @@ -7608,11 +7617,6 @@ static inline void hipApiArgsInit(hip_api_id_t id, hip_api_data_t* data) {
case HIP_API_ID_hipDeviceGetUuid:
if (data->args.hipDeviceGetUuid.uuid) data->args.hipDeviceGetUuid.uuid__val = *(data->args.hipDeviceGetUuid.uuid);
break;
// hipDeviceGetLuid[('char*', 'luid'), ('unsigned int*', 'deviceNodeMask'), ('hipDevice_t', 'device')]
case HIP_API_ID_hipDeviceGetLuid:
if (data->args.hipDeviceGetLuid.luid) data->args.hipDeviceGetLuid.luid__val = *(data->args.hipDeviceGetLuid.luid);
if (data->args.hipDeviceGetLuid.deviceNodeMask) data->args.hipDeviceGetLuid.deviceNodeMask__val = *(data->args.hipDeviceGetLuid.deviceNodeMask);
break;
// hipDeviceGraphMemTrim[('int', 'device')]
case HIP_API_ID_hipDeviceGraphMemTrim:
break;
Expand Down Expand Up @@ -9629,6 +9633,15 @@ static inline const char* hipApiString(hip_api_id_t id, const hip_api_data_t* da
oss << ", limit="; roctracer::hip_support::detail::operator<<(oss, data->args.hipDeviceGetLimit.limit);
oss << ")";
break;
case HIP_API_ID_hipDeviceGetLuid:
oss << "hipDeviceGetLuid(";
if (data->args.hipDeviceGetLuid.luid == NULL) oss << "luid=NULL";
else { oss << "luid="; roctracer::hip_support::detail::operator<<(oss, data->args.hipDeviceGetLuid.luid__val); }
if (data->args.hipDeviceGetLuid.deviceNodeMask == NULL) oss << ", deviceNodeMask=NULL";
else { oss << ", deviceNodeMask="; roctracer::hip_support::detail::operator<<(oss, data->args.hipDeviceGetLuid.deviceNodeMask__val); }
oss << ", device="; roctracer::hip_support::detail::operator<<(oss, data->args.hipDeviceGetLuid.device);
oss << ")";
break;
case HIP_API_ID_hipDeviceGetMemPool:
oss << "hipDeviceGetMemPool(";
if (data->args.hipDeviceGetMemPool.mem_pool == NULL) oss << "mem_pool=NULL";
Expand Down Expand Up @@ -9682,15 +9695,6 @@ static inline const char* hipApiString(hip_api_id_t id, const hip_api_data_t* da
oss << ", device="; roctracer::hip_support::detail::operator<<(oss, data->args.hipDeviceGetUuid.device);
oss << ")";
break;
case HIP_API_ID_hipDeviceGetLuid:
oss << "hipDeviceGetLuid(";
if (data->args.hipDeviceGetLuid.luid == NULL) oss << "luid=NULL";
else { oss << "luid="; roctracer::hip_support::detail::operator<<(oss, data->args.hipDeviceGetLuid.luid__val); }
if (data->args.hipDeviceGetLuid.deviceNodeMask == NULL) oss << ", deviceNodeMask=NULL";
else { oss << ", deviceNodeMask="; roctracer::hip_support::detail::operator<<(oss, data->args.hipDeviceGetLuid.deviceNodeMask__val); }
oss << ", device="; roctracer::hip_support::detail::operator<<(oss, data->args.hipDeviceGetLuid.device);
oss << ")";
break;
case HIP_API_ID_hipDeviceGraphMemTrim:
oss << "hipDeviceGraphMemTrim(";
oss << "device="; roctracer::hip_support::detail::operator<<(oss, data->args.hipDeviceGraphMemTrim.device);
Expand Down
16 changes: 12 additions & 4 deletions projects/clr/hipamd/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ target_sources(amdhip64 PRIVATE
hip_api_trace.cpp
hip_table_interface.cpp
hip_table_interface_c.cpp
hip_deprecated_abi.cpp
hip_comgr_helper.cpp
hip_library.cpp
profiler/hip_clr_profiler.cpp
Expand Down Expand Up @@ -173,6 +174,8 @@ target_include_directories(amdhip64
${PROJECT_BINARY_DIR}/include)

target_compile_definitions(amdhip64 PRIVATE __HIP_PLATFORM_AMD__)

target_compile_definitions(amdhip64 PRIVATE HIP_ABI_IMPL)
target_link_libraries(amdhip64 PRIVATE ${OPENGL_LIBRARIES})
target_link_libraries(amdhip64 PRIVATE ${CMAKE_DL_LIBS})
# Add link to comgr, hsa-runtime and other required libraries in target files
Expand Down Expand Up @@ -264,16 +267,21 @@ if(USE_PROF_API)
")
endif()


if(MSVC)
set(pp_out /P /Fi:${PROF_API_NEWHDR}.i)
else()
set(pp_out -E -o ${PROF_API_NEWHDR}.i) # note: -E before input
endif()

add_custom_command(OUTPUT ${PROF_API_NEWHDR}.i
COMMAND ${CMAKE_COMMAND} -E cat ${PROF_API_HDR} ${PROF_GL_HDR} > ${PROF_API_NEWHDR}
COMMAND ${CMAKE_C_COMPILER}
"-D$<JOIN:$<TARGET_PROPERTY:amdhip64,COMPILE_DEFINITIONS>,;-D>"
"-I$<JOIN:$<TARGET_PROPERTY:amdhip64,INCLUDE_DIRECTORIES>,;-I>"
"$<LIST:TRANSFORM,$<TARGET_PROPERTY:amdhip64,INCLUDE_DIRECTORIES>,PREPEND,-I>" # Directory name may contain spaces.
"-DHIP_INCLUDE_HIP_HIP_RUNTIME_PT_API_H=1"
${c_flags}
$<TARGET_PROPERTY:amdhip64,COMPILE_OPTIONS>
${CPP_EXTRA_C_FLAGS}
-E ${PROF_API_NEWHDR} -o ${PROF_API_NEWHDR}.i
${pp_out} ${PROF_API_NEWHDR}
COMMAND_EXPAND_LISTS VERBATIM
IMPLICIT_DEPENDS C ${PROF_API_HDR} ${PROF_GL_HDR} ${PROF_API_DEPRECATED}
DEPENDS ${PROF_API_HDR} ${PROF_GL_HDR} ${PROF_API_DEPRECATED}
Expand Down
4 changes: 2 additions & 2 deletions projects/clr/hipamd/src/hip_api_trace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ hipError_t hipBindTextureToArray(const textureReference* tex, hipArray_const_t a
hipError_t hipBindTextureToMipmappedArray(const textureReference* tex,
hipMipmappedArray_const_t mipmappedArray,
const hipChannelFormatDesc* desc);
hipError_t hipChooseDevice(int* device, const hipDeviceProp_t* prop);
hipError_t hipChooseDeviceR0600(int* device, const hipDeviceProp_tR0600* prop);
hipError_t hipChooseDeviceR0000(int* device, const hipDeviceProp_tR0000* properties);
hipError_t hipConfigureCall(dim3 gridDim, dim3 blockDim, size_t sharedMem, hipStream_t stream);
hipError_t hipCreateTextureObject(hipTextureObject_t* pTexObject, const hipResourceDesc* pResDesc,
Expand Down Expand Up @@ -975,7 +975,7 @@ void UpdateDispatchTable(HipDispatchTable* ptrDispatchTable) {
ptrDispatchTable->hipBindTexture2D_fn = hip::hipBindTexture2D;
ptrDispatchTable->hipBindTextureToArray_fn = hip::hipBindTextureToArray;
ptrDispatchTable->hipBindTextureToMipmappedArray_fn = hip::hipBindTextureToMipmappedArray;
ptrDispatchTable->hipChooseDevice_fn = hip::hipChooseDevice;
ptrDispatchTable->hipChooseDevice_fn = hip::hipChooseDeviceR0600;
ptrDispatchTable->hipChooseDeviceR0000_fn = hip::hipChooseDeviceR0000;
ptrDispatchTable->hipConfigureCall_fn = hip::hipConfigureCall;
ptrDispatchTable->hipCreateSurfaceObject_fn = hip::hipCreateSurfaceObject;
Expand Down
2 changes: 1 addition & 1 deletion projects/clr/hipamd/src/hip_comgr_helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1109,7 +1109,7 @@ bool LinkProgram::LinkComplete(void** bin_out, size_t* size_out) {
if (!findIsa()) {
return false;
}

hip::comgr_helper::ComgrDataSetUniqueHandle link_output;
if (link_output.Create() != AMD_COMGR_STATUS_SUCCESS) {
return false;
Expand Down
29 changes: 29 additions & 0 deletions projects/clr/hipamd/src/hip_deprecated_abi.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright (c) Advanced Micro Devices, Inc., or its affiliates.
*
* SPDX-License-Identifier: MIT
*/

// These symbols are no longer provided as APIs, but they are supported as part
// of the ABI. If the application insists on using them, they need to call the
// R0000 version.

// We name this file .cpp, so that we can use CXXFLAGS.
extern "C" {

typedef int hipDevice_t;
typedef struct hipDeviceProp_tR0000 hipDeviceProp_tR0000;
typedef int hipError_t;

hipError_t hipGetDevicePropertiesR0000(hipDeviceProp_tR0000* props, hipDevice_t device);
hipError_t hipChooseDeviceR0000(int* device, const hipDeviceProp_tR0000* properties);

hipError_t hipGetDeviceProperties(hipDeviceProp_tR0000* props, hipDevice_t device) {
return hipGetDevicePropertiesR0000(props, device);
}

hipError_t hipChooseDevice(int* device, const hipDeviceProp_tR0000* properties) {
return hipChooseDeviceR0000(device, properties);
}

}
12 changes: 3 additions & 9 deletions projects/clr/hipamd/src/hip_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
#include "hip_mempool_impl.hpp"
#include "hip_platform.hpp"

#undef hipGetDeviceProperties
#undef hipDeviceProp_t

namespace hip {

// ================================================================================================
Expand Down Expand Up @@ -627,7 +624,7 @@ hipError_t hipDeviceGetLuid(char* luid, unsigned int* deviceNodeMask, hipDevice_
}

// ================================================================================================
hipError_t ihipGetDeviceProperties(hipDeviceProp_tR0600* props, int device) {
hipError_t ihipGetDeviceProperties(hipDeviceProp_t* props, int device) {
if (props == nullptr) {
return hipErrorInvalidValue;
}
Expand Down Expand Up @@ -831,6 +828,8 @@ hipError_t ihipGetDeviceProperties(hipDeviceProp_tR0600* props, int device) {
hipError_t hipGetDevicePropertiesR0600(hipDeviceProp_tR0600* prop, int device) {
HIP_INIT_API(hipGetDevicePropertiesR0600, prop, device);

// For now, we can forward to the internal/unstable API. In the future, if
// hipDeviceProp_t is different, this will fail to compile.
HIP_RETURN(ihipGetDeviceProperties(prop, device));
}

Expand Down Expand Up @@ -1026,8 +1025,3 @@ hipError_t hipGetProcAddress_spt(const char* symbol, void** pfn, int hipVersion,
}

} // namespace hip

// ================================================================================================
extern "C" hipError_t hipGetDeviceProperties(hipDeviceProp_tR0000* props, hipDevice_t device) {
return hip::hipGetDevicePropertiesR0000(props, device);
}
Loading
Loading