34fc049ad5
SWDEV-79445 - OCL generic changes and code clean-up - replace NULL with nullptr in the ROCm backend Affected files ... ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocappprofile.cpp#5 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocblit.cpp#16 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocblit.hpp#7 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/roccompiler.cpp#28 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/roccompilerlib.cpp#5 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocdevice.cpp#44 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocdevice.hpp#18 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rockernel.cpp#20 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rockernel.hpp#14 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocmemory.cpp#14 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocmemory.hpp#7 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocprintf.cpp#6 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocprintf.hpp#4 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocprogram.cpp#59 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocprogram.hpp#20 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocsettings.cpp#15 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocvirtual.cpp#33 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocvirtual.hpp#9 edit
60 řádky
1.5 KiB
C++
60 řádky
1.5 KiB
C++
#include "roccompilerlib.hpp"
|
|
#include "utils/flags.hpp"
|
|
|
|
#include "acl.h"
|
|
|
|
namespace roc {
|
|
|
|
void* g_complibModule = nullptr;
|
|
struct CompLibApi g_complibApi;
|
|
|
|
//
|
|
// g_complibModule is defined in LoadCompLib(). This macro must be used only in LoadCompLib() function.
|
|
//
|
|
#define LOADSYMBOL(api) \
|
|
g_complibApi._##api = (pfn_##api) amd::Os::getSymbol(g_complibModule, #api); \
|
|
if( g_complibApi._##api == nullptr ) { \
|
|
LogError ("amd::Os::getSymbol() for exported func " #api " failed."); \
|
|
amd::Os::unloadLibrary(g_complibModule); \
|
|
return false; \
|
|
}
|
|
|
|
bool LoadCompLib(bool offline)
|
|
{
|
|
g_complibModule = amd::Os::loadLibrary("amdhsacl" LP64_SWITCH(LINUX_SWITCH("32",""), "64"));
|
|
if( g_complibModule == nullptr ) {
|
|
if (!offline) {
|
|
LogError( "amd::Os::loadLibrary() for loading of amdhsacl.dll failed.");
|
|
}
|
|
return false;
|
|
}
|
|
|
|
LOADSYMBOL(aclCompilerInit)
|
|
LOADSYMBOL(aclGetTargetInfo)
|
|
LOADSYMBOL(aclBinaryInit)
|
|
LOADSYMBOL(aclInsertSection)
|
|
LOADSYMBOL(aclCompile)
|
|
LOADSYMBOL(aclCompilerFini)
|
|
LOADSYMBOL(aclBinaryFini)
|
|
LOADSYMBOL(aclWriteToMem)
|
|
LOADSYMBOL(aclQueryInfo)
|
|
LOADSYMBOL(aclExtractSymbol)
|
|
LOADSYMBOL(aclGetCompilerLog)
|
|
LOADSYMBOL(aclCreateFromBinary)
|
|
LOADSYMBOL(aclReadFromMem)
|
|
LOADSYMBOL(aclBinaryVersion)
|
|
LOADSYMBOL(aclLink)
|
|
|
|
return true;
|
|
}
|
|
|
|
void UnloadCompLib()
|
|
{
|
|
if( g_complibModule )
|
|
{
|
|
amd::Os::unloadLibrary(g_complibModule);
|
|
}
|
|
}
|
|
|
|
} // namespace roc
|