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
5 changes: 2 additions & 3 deletions projects/clr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,11 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC"
string(REPLACE "/W3" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
if (AMD_COMPUTE_WIN)
# shared prebuilt libs are release, allows hip to be debug
add_compile_options(/MT)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded")
add_compile_options("$<$<CONFIG:Debug>:-D_ITERATOR_DEBUG_LEVEL=0>")
add_compile_options("$<$<CONFIG:Debug>:-D_ALLOW_ITERATOR_DEBUG_LEVEL_MISMATCH>")
else()
add_compile_options("$<$<CONFIG:Debug>:/MTd>")
add_compile_options("$<$<NOT:$<CONFIG:Debug>>:/MT>")
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
add_compile_options("$<$<CONFIG:Debug>:-D_ALLOW_ITERATOR_DEBUG_LEVEL_MISMATCH>")
endif()
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

#ifdef __cplusplus

extern "C" HIP_PUBLIC_API hipChannelFormatDesc hipCreateChannelDesc(int x, int y, int z, int w,
hipChannelFormatKind f);
extern "C" hipChannelFormatDesc hipCreateChannelDesc(int x, int y, int z, int w,
hipChannelFormatKind f);

static inline hipChannelFormatDesc hipCreateChannelDescHalf() {
int e = (int)sizeof(unsigned short) * 8;
Expand Down
6 changes: 5 additions & 1 deletion projects/clr/hipamd/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ target_sources(amdhip64 PRIVATE
hip_vm.cpp
hip_api_trace.cpp
hip_table_interface.cpp
hip_table_interface_c.cpp
hip_deprecated_abi.cpp
hip_comgr_helper.cpp
hip_library.cpp
Expand Down Expand Up @@ -157,6 +156,11 @@ if(BUILD_SHARED_LIBS)
target_link_options(amdhip64 PRIVATE "/DEF:${AMDHIP_DEF_OUTPUT_NATIVE}")
set_target_properties(amdhip64 PROPERTIES LINK_DEPENDS "${AMDHIP_DEF_OUTPUT}")
else()
# Unix compiler and linker default visibility to visible. Let's change to
# hidden so we only expose what we need.
set_target_properties(amdhip64 PROPERTIES
CXX_VISIBILITY_PRESET hidden
VISIBILITY_INLINES_HIDDEN ON)
target_link_libraries(amdhip64 PRIVATE "-Wl,--version-script=${CMAKE_CURRENT_LIST_DIR}/hip_hcc.map.in")
set_target_properties(amdhip64 PROPERTIES LINK_DEPENDS "${CMAKE_CURRENT_LIST_DIR}/hip_hcc.map.in")
endif()
Expand Down
6 changes: 4 additions & 2 deletions projects/clr/hipamd/src/hip_activity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@

#include "platform/activity.hpp"
#include <hip/hip_runtime_api.h>
#include <hip/library_types.h>
#include "hip_internal.hpp"

extern "C" const char* hipGetCmdName(unsigned op) {
HIP_PUBLIC_API const char* hipGetCmdName(unsigned op) {
return amd::activity_prof::getOclCommandKindString(static_cast<cl_command_type>(op));
}
}
21 changes: 16 additions & 5 deletions projects/clr/hipamd/src/hip_deprecated_abi.cpp
Comment thread
mikeqinamd marked this conversation as resolved.
Resolved
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,32 @@
// of the ABI. If the application insists on using them, they need to call the
// R0000 version.

#include <cstdint>

// 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;
typedef uint32_t hipError_t;

// This is a duplicate of hip_internal.h. We cannot include anything in this
// file so that we don't pollute the ABI with API versioning macros.

#if defined(__GNUC__) || defined(__clang__)
#define HIP_PUBLIC_API __attribute__((visibility("default")))
#else
#define HIP_PUBLIC_API
#endif

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

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

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

Expand Down
6 changes: 3 additions & 3 deletions projects/clr/hipamd/src/hip_global.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
#include "platform/program.hpp"
#include <hip/hip_version.h>

const char* amd_dbgapi_get_build_name(void) { return HIP_VERSION_BUILD_NAME; }
HIP_PUBLIC_API const char* amd_dbgapi_get_build_name(void) { return HIP_VERSION_BUILD_NAME; }

const char* amd_dbgapi_get_git_hash() { return HIP_VERSION_GITHASH; }
HIP_PUBLIC_API const char* amd_dbgapi_get_git_hash() { return HIP_VERSION_GITHASH; }

size_t amd_dbgapi_get_build_id() { return HIP_VERSION_BUILD_ID; }
HIP_PUBLIC_API size_t amd_dbgapi_get_build_id() { return HIP_VERSION_BUILD_ID; }

#ifdef __HIP_ENABLE_PCH
extern const char __hip_pch_wave32[];
Expand Down
2 changes: 0 additions & 2 deletions projects/clr/hipamd/src/hip_hcc.map.in
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,6 @@ global:
__hipRegisterTexture;
__hipRegisterManagedVar;
__hipUnregisterFatBinary;
__gnu_h2f_ieee;
__gnu_f2h_ieee;
Comment thread
mikeqinamd marked this conversation as resolved.
Resolved
hipConfigureCall;
hipSetupArgument;
hipLaunchByPtr;
Expand Down
4 changes: 2 additions & 2 deletions projects/clr/hipamd/src/hip_intercept.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const char* hipApiName(uint32_t id) { return hip_api_name(id); }

} // namespace hip

extern "C" void hipRegisterTracerCallback(int (*function)(activity_domain_t domain,
uint32_t operation_id, void* data)) {
HIP_PUBLIC_API void hipRegisterTracerCallback(int (*function)(activity_domain_t domain,
uint32_t operation_id, void* data)) {
amd::activity_prof::report_activity.store(function, std::memory_order_release);
}
10 changes: 8 additions & 2 deletions projects/clr/hipamd/src/hip_internal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,17 @@ const char* ihipGetErrorName(hipError_t hip_error);
} // namespace hip

#if defined(__GNUC__) || defined(__clang__)
extern "C" __attribute__((visibility("default"))) void __hipOnError(const void *err_info);
#define HIP_PUBLIC_API extern "C" __attribute__((visibility("default")))
#define HIP_INTERNAL_EXPORTED_API extern "C" __attribute__((visibility("default")))
#else
extern "C" void __hipOnError(const void *err_info);
// MSVC could have use __declspec(dllexport), but we'll see a redeclaration
// warning. Let's just rely on the .def file under MSVC.
#define HIP_PUBLIC_API extern "C"
#define HIP_INTERNAL_EXPORTED_API extern "C"
#endif

HIP_PUBLIC_API void __hipOnError(const void *err_info);

// Helper: set up TLS device pointer on first use.
#define HIP_INIT_TLS_DEVICE() \
if (hip::tls.device_ == nullptr && !hip::g_devices.empty()) { \
Expand Down
Loading
Loading