06056e3adc
SWDEV-94640 - [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/api/opencl/amdocl/build/Makefile.api#133 edit ... //depot/stg/opencl/drivers/opencl/runtime/Makefile#22 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/device.cpp#196 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/device.hpp#275 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/Makefile#2 delete ... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/build/Makefile#2 delete ... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/build/Makefile.oclhsa#7 delete ... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/hsaappprofile.cpp#4 delete ... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/hsaappprofile.hpp#3 delete ... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/hsabinary.cpp#2 delete ... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/hsabinary.hpp#3 delete ... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/hsablit.cpp#17 delete ... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/hsablit.hpp#5 delete ... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/hsacompiler.cpp#6 delete ... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/hsacompilerlib.cpp#3 delete ... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/hsacompilerlib.hpp#3 delete ... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/hsadefs.hpp#6 delete ... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/hsadevice.cpp#65 delete ... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/hsadevice.hpp#31 delete ... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/hsaglinterop.cpp#3 delete ... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/hsaglinterop.hpp#3 delete ... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/hsakernel.cpp#18 delete ... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/hsakernel.hpp#12 delete ... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/hsamemory.cpp#27 delete ... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/hsamemory.hpp#13 delete ... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/hsaprintf.cpp#2 delete ... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/hsaprintf.hpp#2 delete ... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/hsaprogram.cpp#28 delete ... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/hsaprogram.hpp#11 delete ... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/hsaregisters.hpp#2 delete ... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/hsasettings.cpp#13 delete ... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/hsasettings.hpp#8 delete ... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/hsavirtual.cpp#67 delete ... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/hsavirtual.hpp#28 delete ... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/mesa_glinterop.h#2 delete ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/Makefile#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/build/Makefile#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/build/Makefile.oclrocm#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/build/wNow64a/Makefile#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/mesa_glinterop.h#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocappprofile.cpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocappprofile.hpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocbinary.hpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocblit.cpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocblit.hpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/roccompiler.cpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/roccompilerlib.cpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/roccompilerlib.hpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocdefs.hpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocdevice.cpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocdevice.hpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocglinterop.cpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocglinterop.hpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rockernel.cpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rockernel.hpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocmemory.cpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocmemory.hpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocprintf.cpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocprintf.hpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocprogram.cpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocprogram.hpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocregisters.hpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocsettings.cpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocsettings.hpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocvirtual.cpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocvirtual.hpp#1 add
78 wiersze
3.6 KiB
C++
78 wiersze
3.6 KiB
C++
#pragma once
|
|
|
|
//
|
|
// This file hsa the code for explicity loading amdoclcl.dll.
|
|
// Exported functions from amdoclcl.dll can be added for usage as need-basis.
|
|
// With explicit/dynamic loading roc will not have any linkage to amdoclcl.lib.
|
|
//
|
|
|
|
#include "thread/thread.hpp"
|
|
#include "acl.h"
|
|
#include "utils/debug.hpp"
|
|
|
|
using namespace amd;
|
|
|
|
namespace roc {
|
|
|
|
//
|
|
// To use any new exported function from amdhsacl.dll please add/make that function specific changes
|
|
// in typedef below, struct CompLibApi and in hsacompilerLib.cpp::LoadCompLib() function.
|
|
//
|
|
|
|
//
|
|
// Convention: The typedefed function name must be prefixed with pfn_
|
|
//
|
|
typedef aclCompiler* (ACL_API_ENTRY *pfn_aclCompilerInit) (aclCompilerOptions *opts, acl_error *error_code);
|
|
typedef aclTargetInfo (ACL_API_ENTRY *pfn_aclGetTargetInfo) (const char*, const char*, acl_error*);
|
|
typedef aclBinary* (ACL_API_ENTRY *pfn_aclBinaryInit) (size_t, const aclTargetInfo*, const aclBinaryOptions*, acl_error*);
|
|
typedef acl_error (ACL_API_ENTRY *pfn_aclInsertSection) (aclCompiler *cl, aclBinary *binary, const void *data, size_t data_size, aclSections id);
|
|
typedef acl_error (ACL_API_ENTRY *pfn_aclCompile) (aclCompiler *cl, aclBinary *bin, const char *options, aclType from, aclType to, aclLogFunction compile_callback);
|
|
typedef acl_error (ACL_API_ENTRY *pfn_aclCompilerFini) (aclCompiler *cl);
|
|
typedef acl_error (ACL_API_ENTRY *pfn_aclBinaryFini) (aclBinary *bin);
|
|
typedef acl_error (ACL_API_ENTRY *pfn_aclWriteToMem) (aclBinary *bin,void **mem, size_t *size);
|
|
typedef acl_error (ACL_API_ENTRY *pfn_aclQueryInfo) (aclCompiler *cl, const aclBinary *binary, aclQueryType query, const char *kernel, void *data_ptr, size_t *ptr_size);
|
|
typedef const void* (ACL_API_ENTRY *pfn_aclExtractSymbol) (aclCompiler *cl,const aclBinary *binary,size_t *size,aclSections id,const char *symbol,acl_error *error_code);
|
|
typedef aclBinary* (ACL_API_ENTRY *pfn_aclReadFromMem) (void *mem,size_t size, acl_error *error_code);
|
|
typedef char* (ACL_API_ENTRY *pfn_aclGetCompilerLog) (aclCompiler* cl);
|
|
typedef aclBinary* (ACL_API_ENTRY *pfn_aclCreateFromBinary) (const aclBinary *binary,aclBIFVersion version);
|
|
typedef aclBIFVersion (ACL_API_ENTRY *pfn_aclBinaryVersion) (const aclBinary *binary);
|
|
typedef acl_error (ACL_API_ENTRY *pfn_aclLink) (aclCompiler* cl, aclBinary *src_bin, unsigned int num_libs, aclBinary **libs, aclType link_mode,const char* options, aclLogFunction link_callback);
|
|
//
|
|
// Convention: prefix struct member variable with with underscore '_'
|
|
// would be nice if there was no underscore prfix, but on Linux the token
|
|
// pasting in the macro is srtict and his is the workaround.
|
|
//
|
|
struct CompLibApi
|
|
{
|
|
pfn_aclCompilerInit _aclCompilerInit;
|
|
pfn_aclGetTargetInfo _aclGetTargetInfo;
|
|
pfn_aclBinaryInit _aclBinaryInit;
|
|
pfn_aclInsertSection _aclInsertSection;
|
|
pfn_aclCompile _aclCompile;
|
|
pfn_aclCompilerFini _aclCompilerFini;
|
|
pfn_aclBinaryFini _aclBinaryFini;
|
|
pfn_aclWriteToMem _aclWriteToMem;
|
|
pfn_aclQueryInfo _aclQueryInfo;
|
|
pfn_aclExtractSymbol _aclExtractSymbol;
|
|
pfn_aclReadFromMem _aclReadFromMem;
|
|
pfn_aclGetCompilerLog _aclGetCompilerLog;
|
|
pfn_aclCreateFromBinary _aclCreateFromBinary;
|
|
pfn_aclBinaryVersion _aclBinaryVersion;
|
|
pfn_aclLink _aclLink;
|
|
};
|
|
|
|
|
|
//
|
|
// Use g_ prefix for all global variables.
|
|
//
|
|
extern void* g_complibModule;
|
|
extern CompLibApi g_complibApi;
|
|
|
|
// Note: initializes global variable g_complibApi.
|
|
// Not sure what error values we have, for now returning false on failure.
|
|
bool LoadCompLib(bool isOfflineDevice=false);
|
|
void UnloadCompLib();
|
|
|
|
} // namespace roc
|
|
|