diff --git a/projects/clr/rocclr/compiler/lib/backends/common/v0_8/if_acl.cpp b/projects/clr/rocclr/compiler/lib/backends/common/v0_8/if_acl.cpp index 3c3d5df104..172214cb74 100644 --- a/projects/clr/rocclr/compiler/lib/backends/common/v0_8/if_acl.cpp +++ b/projects/clr/rocclr/compiler/lib/backends/common/v0_8/if_acl.cpp @@ -2542,7 +2542,7 @@ if_aclQueryInfo(aclCompiler *cl, return ACL_INVALID_ARG; } std::string symbol = pre + std::string(kernel) + post; - const void* roSec = aclutGetKernelMetadata(cl, binary, &roSize, symbol.c_str(), &error_code); + const void* roSec = cl->clAPI.extSym(cl, binary, &roSize, secID, symbol.c_str(), &error_code); if (error_code != ACL_SUCCESS) return error_code; if (roSec == NULL || roSize == 0) { return ACL_ELF_ERROR; @@ -2876,7 +2876,8 @@ if_aclDbgAddArgument(aclCompiler *cl, acl_error error_code; aclMetadata *md = NULL; { - const char* roSec = reinterpret_cast(aclutGetKernelMetadata(cl, bin, &roSize, symbol.c_str(), &error_code)); + const char* roSec = reinterpret_cast(cl->clAPI.extSym( + cl, bin, &roSize, sym->sections[0], symbol.c_str(), &error_code)); if (error_code != ACL_SUCCESS) return error_code; if (roSec == NULL || roSize == 0) { return ACL_ELF_ERROR; @@ -2997,7 +2998,9 @@ if_aclDbgAddArgument(aclCompiler *cl, newMD->data_size = newSize; memcpy(tmp_ptr, reinterpret_cast(md) + printf_offset, roSize - printf_offset); tmp_ptr += (roSize - printf_offset); - error_code = aclutSetKernelMetadata(cl, bin, newMDptr, newSize, symbol.c_str()); + cl->clAPI.remSym(cl, bin, aclRODATA, symbol.c_str()); + error_code = cl->clAPI.insSym(cl, bin, newMDptr, newSize, + aclRODATA, symbol.c_str()); assert((size_t)(tmp_ptr - newMDptr) == newSize && "allocated memory does not equal the amount of memory copied!"); free(md); delete [] newMDptr; @@ -3020,7 +3023,8 @@ if_aclDbgRemoveArgument(aclCompiler *cl, acl_error error_code; aclMetadata *md = NULL; { - const char* roSec = reinterpret_cast(aclutGetKernelMetadata(cl, bin, &roSize, symbol.c_str(), &error_code)); + const char* roSec = reinterpret_cast(cl->clAPI.extSym(cl, bin, &roSize, + sym->sections[0], symbol.c_str(), &error_code)); if (error_code != ACL_SUCCESS) return error_code; if (roSec == NULL || roSize == 0) { return ACL_ELF_ERROR; @@ -3126,7 +3130,9 @@ if_aclDbgRemoveArgument(aclCompiler *cl, memcpy(tmp_ptr, reinterpret_cast(md) + printf_offset, roSize - printf_offset); tmp_ptr += (roSize - printf_offset); newMD->data_size = newSize; - error_code = aclutSetKernelMetadata(cl, bin, newMDptr, newSize, symbol.c_str()); + cl->clAPI.remSym(cl, bin, aclRODATA, symbol.c_str()); + error_code = cl->clAPI.insSym(cl, bin, newMDptr, newSize, + aclRODATA, symbol.c_str()); assert((size_t)(tmp_ptr - newMDptr) == newSize && "allocated memory does not equal the amount of memory copied!"); free(md); delete [] newMDptr; diff --git a/projects/clr/rocclr/compiler/lib/include/v0_8/aclStructs.h b/projects/clr/rocclr/compiler/lib/include/v0_8/aclStructs.h index 80240fc1da..479f3341b1 100644 --- a/projects/clr/rocclr/compiler/lib/include/v0_8/aclStructs.h +++ b/projects/clr/rocclr/compiler/lib/include/v0_8/aclStructs.h @@ -180,7 +180,6 @@ typedef struct _acl_bif_rec_0_8_1 { aclOptions* options; // Pointer to acl options. aclBinaryOptions_0_8_1 binOpts; // Pointer to the binary options. aclDevCaps_0_8 caps; // Capabilities of the BIF. - aclBinaryData *binData; // Pointer to the binary's temporary data. } aclBinary_0_8_1; #define ACL_LOADER_COMMON\ diff --git a/projects/clr/rocclr/compiler/lib/include/v0_8/aclTypes.h b/projects/clr/rocclr/compiler/lib/include/v0_8/aclTypes.h index aef5582fce..f6cb0f9598 100644 --- a/projects/clr/rocclr/compiler/lib/include/v0_8/aclTypes.h +++ b/projects/clr/rocclr/compiler/lib/include/v0_8/aclTypes.h @@ -30,7 +30,6 @@ typedef struct _acl_be_loader_rec_0_8 aclBELoader; typedef struct _acl_llvm_module_0_8* aclModule; // Opaque pointer to llvm::Module typedef struct _acl_llvm_context_0_8* aclContext; // Opaque pointer to llvm::Context typedef struct _acl_loader_data_0_8* aclLoaderData; // Opaque pointer to loader data -typedef struct _acl_binary_data_0_8_2 aclBinaryData; #include "aclEnums.h" // Typedefs for enumerations diff --git a/projects/clr/rocclr/compiler/lib/utils/v0_8/libUtils.cpp b/projects/clr/rocclr/compiler/lib/utils/v0_8/libUtils.cpp index 6c31452315..2418ed843e 100644 --- a/projects/clr/rocclr/compiler/lib/utils/v0_8/libUtils.cpp +++ b/projects/clr/rocclr/compiler/lib/utils/v0_8/libUtils.cpp @@ -1052,39 +1052,3 @@ void dump(aclBinary *bin) { bifbase *elfBin = reinterpret_cast(bin->bin); elfBin->dump(); } - -const void* -aclutGetKernelMetadata(aclCompiler *cl, const aclBinary *bin, size_t *symbolSize, const char *symbol, acl_error *error_code) { - aclutKernelMetadata* md = bin->binData->kernelMetadata; - std::string s(symbol); - aclutKernelMetadata::iterator it = md->find(s); - if (md->end() == it) { - const oclBIFSymbolStruct* sym = findBIF30SymStruct(symOpenclMeta); - assert(sym && "symbol not found"); - const void* symbolData = cl->clAPI.extSym(cl, bin, symbolSize, sym->sections[0], symbol, error_code); - if (symbolData && *symbolSize != 0) { - md->insert(std::make_pair(s, std::make_pair(symbolData, *symbolSize))); - return symbolData; - } - } else { - aclutDataSizePair ds = it->second; - *symbolSize = ds.second; - *error_code = ACL_SUCCESS; - return ds.first; - } - return NULL; -} - -acl_error -aclutSetKernelMetadata(aclCompiler *cl, aclBinary *bin, const void *symbolData, size_t symbolSize, const char *symbol) { - const oclBIFSymbolStruct* sym = findBIF30SymStruct(symOpenclMeta); - assert(sym && "symbol not found"); - acl_error err = cl->clAPI.insSym(cl, bin, symbolData, symbolSize, sym->sections[0], symbol); - if (err != ACL_SUCCESS) return err; - aclutKernelMetadata* md = bin->binData->kernelMetadata; - std::string s(symbol); - if (md->end() != md->find(s)) { - md->erase(s); - } - return ACL_SUCCESS; -} diff --git a/projects/clr/rocclr/compiler/lib/utils/v0_8/libUtils.h b/projects/clr/rocclr/compiler/lib/utils/v0_8/libUtils.h index 5bb11dfade..06ed8a6105 100644 --- a/projects/clr/rocclr/compiler/lib/utils/v0_8/libUtils.h +++ b/projects/clr/rocclr/compiler/lib/utils/v0_8/libUtils.h @@ -4,23 +4,15 @@ #ifndef _CL_LIB_UTILS_0_8_H_ #define _CL_LIB_UTILS_0_8_H_ #include "acl.h" +#include #include -#include +#include #include #include #include "library.hpp" #include "utils/bif_section_labels.hpp" using namespace bif; -typedef std::pair aclutDataSizePair; -typedef std::map aclutKernelMetadata; - -//! Structure for storing temporary aclBinary information (non-serializable). -typedef struct _acl_binary_data_0_8_2 { - ACL_STRUCT_HEADER; - aclutKernelMetadata* kernelMetadata; // Opaque pointer to the cached kernel's Metadata. -} aclBinaryData_0_8_2; - // Utility function to set a flag in option structure // of the aclDevCaps. void @@ -186,18 +178,6 @@ aclutAlloc(const aclCompilerOptions *bin); FreeFunc aclutFree(const aclCompilerOptions *bin); -// Wrapper function for extracting symbol with particular kernel Metadata from the binary bin, -// once extracted kernel Metadata is cached, secondary extraction doesn't happen. -// This function have to be used instead of extSym function for symOpenclMeta. -const void* -aclutGetKernelMetadata(aclCompiler *cl, const aclBinary *bin, size_t *symbolSize, const char *symbol, acl_error *error_code); - -// Wrapper function for inserting symbol with particular kernel Metadata into the binary bin, -// once inserted kernel Metadata is cached. -// This function have to be used instead of insSym function for symOpenclMeta. -acl_error -aclutSetKernelMetadata(aclCompiler *cl, aclBinary *bin, const void *symbolData, size_t symbolSize, const char *symbol); - inline std::vector splitSpaceSeparatedString(char *str) { std::string s(str);