5ba83829e2
SWDEV-94640 - Re-submit CL#1292110 after integration from fsa_foundation: - [OCL-LC-ROCm] OpenCL Runtime Library Implements OpenCL runtime API. Add HSA virtual device to ORCA. Rename hsa_foundation to ROCm Affected files ... ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/Makefile#3 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/build/Makefile#3 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/build/Makefile.rocm#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/mesa_glinterop.h#3 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocappprofile.cpp#3 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocappprofile.hpp#3 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocbinary.cpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocbinary.hpp#3 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocblit.cpp#3 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocblit.hpp#3 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/roccompiler.cpp#3 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/roccompilerlib.cpp#3 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/roccompilerlib.hpp#3 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocdefs.hpp#4 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocdevice.cpp#4 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocdevice.hpp#3 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocglinterop.cpp#3 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocglinterop.hpp#3 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rockernel.cpp#3 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rockernel.hpp#3 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/roclib.cpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/roclib.h#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocmemory.cpp#3 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocmemory.hpp#3 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocprintf.cpp#3 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocprintf.hpp#3 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocprogram.cpp#3 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocprogram.hpp#3 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocregisters.hpp#3 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocsettings.cpp#3 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocsettings.hpp#3 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocvirtual.cpp#3 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocvirtual.hpp#3 add
60 строки
1.5 KiB
C++
60 строки
1.5 KiB
C++
#include "roccompilerlib.hpp"
|
|
#include "utils/flags.hpp"
|
|
|
|
#include "acl.h"
|
|
|
|
namespace roc {
|
|
|
|
void* g_complibModule = NULL;
|
|
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 == NULL ) { \
|
|
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 == NULL ) {
|
|
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
|