SWDEV-463865 - namespace changes to prevent symbol conflicts in static builds

Change-Id: I09ceb5962b7aa19156909f47167c87d6887c9cd1


[ROCm/clr commit: 3edf1501cc]
Этот коммит содержится в:
Ioannis Assiouras
2024-06-07 15:02:50 +01:00
родитель 09defbc48f
Коммит af089a2171
13 изменённых файлов: 38 добавлений и 36 удалений
+3
Просмотреть файл
@@ -69,6 +69,9 @@ if(CLR_BUILD_HIP)
endif()
if(CLR_BUILD_HIP)
option(BUILD_SHARED_LIBS "Build the shared library" ON)
if (NOT BUILD_SHARED_LIBS)
add_compile_definitions(BUILD_STATIC_LIBS)
endif()
endif()
if((CLR_BUILD_HIP AND HIP_PLATFORM STREQUAL "amd") OR CLR_BUILD_OCL)
add_subdirectory(rocclr)
-7
Просмотреть файл
@@ -31,10 +31,3 @@
cl_icd_dispatch amd::ICDDispatchedObject::icdVendorDispatch_[] = {0};
amd::PlatformIDS amd::PlatformID::Platform = {amd::ICDDispatchedObject::icdVendorDispatch_};
RUNTIME_ENTRY(cl_int, clGetDeviceIDs,
(cl_platform_id platform, cl_device_type device_type, cl_uint num_entries,
cl_device_id* devices, cl_uint* num_devices)) {
return CL_SUCCESS;
}
RUNTIME_EXIT
+1 -1
Просмотреть файл
@@ -22,5 +22,5 @@
#include <hip/hip_runtime_api.h>
extern "C" const char* hipGetCmdName(unsigned op) {
return getOclCommandKindString(static_cast<cl_command_type>(op));
return amd::activity_prof::getOclCommandKindString(static_cast<cl_command_type>(op));
}
+1 -1
Просмотреть файл
@@ -25,9 +25,9 @@
#include "utils/flags.hpp"
#include "utils/versions.hpp"
namespace hip {
std::once_flag g_ihipInitialized;
namespace hip {
std::vector<hip::Device*> g_devices;
thread_local TlsAggregator tls;
amd::Context* host_context = nullptr;
+2
Просмотреть файл
@@ -25,6 +25,7 @@
case X: \
case_string = #C; \
break;
namespace {
const char* GetGraphNodeTypeString(uint32_t op) {
const char* case_string;
switch (static_cast<hipGraphNodeType>(op)) {
@@ -47,6 +48,7 @@ const char* GetGraphNodeTypeString(uint32_t op) {
};
return case_string;
};
}
namespace hip {
std::unordered_map<GraphExec*, std::pair<hip::Stream*, bool>> GraphExecStatus_;
+5 -5
Просмотреть файл
@@ -51,9 +51,9 @@
/*! IHIP IPC MEMORY Structure */
#define IHIP_IPC_MEM_HANDLE_SIZE 32
#define IHIP_IPC_MEM_RESERVED_SIZE LP64_SWITCH(20,12)
extern std::once_flag g_ihipInitialized;
namespace hip{
extern std::once_flag g_ihipInitialized;
}
typedef struct hipArray {
void* data; // FIXME: generalize this
struct hipChannelFormatDesc desc;
@@ -99,7 +99,7 @@ const char* ihipGetErrorName(hipError_t hip_error);
#define HIP_INIT(noReturn) \
{ \
bool status = true; \
std::call_once(g_ihipInitialized, hip::init, &status); \
std::call_once(hip::g_ihipInitialized, hip::init, &status); \
if (!status && !noReturn) { \
HIP_RETURN(hipErrorInvalidDevice); \
} \
@@ -112,7 +112,7 @@ const char* ihipGetErrorName(hipError_t hip_error);
#define HIP_INIT_VOID() \
{ \
bool status = true; \
std::call_once(g_ihipInitialized, hip::init, &status); \
std::call_once(hip::g_ihipInitialized, hip::init, &status); \
if (hip::tls.device_ == nullptr && hip::g_devices.size() > 0) { \
hip::tls.device_ = hip::g_devices[0]; \
amd::Os::setPreferredNumaNode(hip::g_devices[0]->devices()[0]->getPreferredNumaNode()); \
-15
Просмотреть файл
@@ -25,11 +25,6 @@
#include <cstdlib>
#include <cstring>
typedef void* ADLApplicationProfile;
int SearchProfileOfAnApplication(const wchar_t* fileName, ADLApplicationProfile** lppProfile)
{
return 0;
}
#define GETPROCADDRESS(_adltype_, _adlfunc_) (_adltype_) amd::Os::getSymbol(adlHandle_, #_adlfunc_);
@@ -77,16 +72,6 @@ bool AppProfile::init() {
}
bool AppProfile::ParseApplicationProfile() {
ADLApplicationProfile* pProfile = NULL;
if (!SearchProfileOfAnApplication(wsAppFileName_.c_str(), &pProfile)) {
return false;
}
if (pProfile == NULL) {
return false;
}
return true;
}
}
+2 -1
Просмотреть файл
@@ -122,7 +122,7 @@ void ReportActivity(const amd::Command& command) {
}
}
} // namespace amd::activity_prof
#define CASE_STRING(X, C) \
case X: \
@@ -168,3 +168,4 @@ const char* getOclCommandKindString(cl_command_type commandType) {
};
return "Unknown command kind";
};
} // namespace amd::activity_prof
+2 -1
Просмотреть файл
@@ -76,6 +76,7 @@ constexpr OpId OperationId(cl_command_type commandType) {
bool IsEnabled(OpId operation_id);
void ReportActivity(const amd::Command& command);
} // namespace amd::activity_prof
const char* getOclCommandKindString(cl_command_type kind);
} // namespace amd::activity_prof
+1 -1
Просмотреть файл
@@ -349,7 +349,7 @@ void Command::enqueue() {
}
ClPrint(LOG_DEBUG, LOG_CMD, "Command (%s) enqueued: %p",
getOclCommandKindString(this->type()), this);
amd::activity_prof::getOclCommandKindString(this->type()), this);
// Direct dispatch logic below will submit the command immediately, but the command status
// update will occur later after flush() with a wait
+7 -3
Просмотреть файл
@@ -192,13 +192,15 @@ void HostQueue::loop(device::VirtualDevice* virtualDevice) {
const Command::EventWaitList& events = command->eventWaitList();
bool dependencyFailed = false;
ClPrint(LOG_DEBUG, LOG_CMD, "Command (%s) processing: %p ,events.size(): %d",
getOclCommandKindString(command->type()), command, events.size());
amd::activity_prof::getOclCommandKindString(command->type()), command, events.size());
for (const auto& it : events) {
// Only wait if the command is enqueued into another queue.
if (it->command().queue() != this) {
// Runtime has to flush the current batch only if the dependent wait is blocking
if (it->command().status() != CL_COMPLETE) {
ClPrint(LOG_DEBUG, LOG_CMD, "Command (%s) %p awaiting event: %p", getOclCommandKindString(command->type()), command, it);
ClPrint(LOG_DEBUG, LOG_CMD, "Command (%s) %p awaiting event: %p",
amd::activity_prof::getOclCommandKindString(command->type()),
command, it);
virtualDevice->flush(head, true);
tail = head = NULL;
dependencyFailed |= !it->awaitCompletion();
@@ -219,7 +221,9 @@ void HostQueue::loop(device::VirtualDevice* virtualDevice) {
continue;
}
ClPrint(LOG_DEBUG, LOG_CMD, "Command (%s) submitted: %p", getOclCommandKindString(command->type()), command);
ClPrint(LOG_DEBUG, LOG_CMD, "Command (%s) submitted: %p",
amd::activity_prof::getOclCommandKindString(command->type()),
command);
command->setStatus(CL_SUBMITTED);
+6
Просмотреть файл
@@ -204,6 +204,9 @@ Flag Flag::flags_[] = {
} // namespace amd
#ifndef _WIN32
namespace {
#endif
#define DEFINE_RELEASE_FLAG_VALUE(type, name, value, help) type name = value;
#define DEFINE_DEBUG_FLAG_VALUE(type, name, value, help) DEBUG_ONLY(type name = value);
@@ -211,3 +214,6 @@ RUNTIME_FLAGS(DEFINE_DEBUG_FLAG_VALUE, DEFINE_RELEASE_FLAG_VALUE, DEFINE_DEBUG_F
#undef DEFINE_DEBUG_FLAG_VALUE
#undef DEFINE_RELEASE_FLAG_VALUE
#ifndef _WIN32
}
#endif
+8 -1
Просмотреть файл
@@ -328,7 +328,12 @@ struct Flag {
#ifdef _WIN32
# define EXPORT_FLAG extern "C" __declspec(dllexport)
#else // !_WIN32
#ifdef BUILD_STATIC_LIBS
# define EXPORT_FLAG extern
#else
# define EXPORT_FLAG extern "C"
#endif
namespace {
#endif // !_WIN32
#define DECLARE_RELEASE_FLAG(type, name, value, help) EXPORT_FLAG type name;
@@ -342,5 +347,7 @@ RUNTIME_FLAGS(DECLARE_DEBUG_FLAG, DECLARE_RELEASE_FLAG, DECLARE_DEBUG_FLAG);
#undef DECLARE_DEBUG_FLAG
#undef DECLARE_RELEASE_FLAG
#ifndef _WIN32
}
#endif // !_WIN32
#endif /*FLAGS_HPP_*/