diff --git a/rocclr/compiler/lib/amdoclcl.def.in b/rocclr/compiler/lib/amdoclcl.def.in index 0d8a7009e2..10cd7442c2 100644 --- a/rocclr/compiler/lib/amdoclcl.def.in +++ b/rocclr/compiler/lib/amdoclcl.def.in @@ -95,5 +95,5 @@ aclJITObjectImageDisassembleKernel aclJITObjectImageIterateSymbols aclJITObjectImageGetGlobalsSize #if defined(WITH_TARGET_HSAIL) -aclHsaLoader +_aclHsaLoader #endif diff --git a/rocclr/compiler/lib/amdoclcl.map.in b/rocclr/compiler/lib/amdoclcl.map.in index f2ee10dedc..9d54251784 100644 --- a/rocclr/compiler/lib/amdoclcl.map.in +++ b/rocclr/compiler/lib/amdoclcl.map.in @@ -95,7 +95,7 @@ global: aclJITObjectImageIterateSymbols; aclJITObjectImageGetGlobalsSize; #if defined(WITH_TARGET_HSAIL) - aclHsaLoader; + _aclHsaLoader; #endif #if defined(OPENCL_MAINLINE) local: diff --git a/rocclr/compiler/lib/utils/v0_8/libUtils.h b/rocclr/compiler/lib/utils/v0_8/libUtils.h index a38e54e8d0..83c59f2485 100644 --- a/rocclr/compiler/lib/utils/v0_8/libUtils.h +++ b/rocclr/compiler/lib/utils/v0_8/libUtils.h @@ -187,4 +187,30 @@ inline std::vector splitSpaceSeparatedString(char *str) return vec; } +// Helper function that allocates an aligned memory. +inline void* +alignedMalloc(size_t size, size_t alignment) +{ +#if defined(_WIN32) + return ::_aligned_malloc(size, alignment); +#else + void * ptr = NULL; + if (0 == ::posix_memalign(&ptr, alignment, size)) { + return ptr; + } + return NULL; +#endif +} + +// Helper function that frees an aligned memory. +inline void +alignedFree(void *ptr) +{ +#if defined(_WIN32) + ::_aligned_free(ptr); +#else + free(ptr); +#endif +} + #endif // _CL_LIB_UTILS_0_8_H_ diff --git a/rocclr/runtime/device/gpu/gpuprogram.cpp b/rocclr/runtime/device/gpu/gpuprogram.cpp index b72f10b4e5..3443fb7254 100644 --- a/rocclr/runtime/device/gpu/gpuprogram.cpp +++ b/rocclr/runtime/device/gpu/gpuprogram.cpp @@ -20,7 +20,7 @@ #include "hsa_ext_image.h" extern "C" bool -ACL_API_ENTRY aclHsaLoader( +ACL_API_ENTRY _aclHsaLoader( aclCompiler* compiler_handle, aclBinary* bin, void* userData, @@ -2137,7 +2137,7 @@ HSAILProgram::linkImpl(amd::option::Options* options) return false; } // ACL_TYPE_CG stage is always being performed - if (!aclHsaLoader(dev().hsaCompiler(), binaryElf_, this, &AllocateGPUMemory, + if (!_aclHsaLoader(dev().hsaCompiler(), binaryElf_, this, &AllocateGPUMemory, &DmaMemoryCopy, &GetSamplerObjectParams, &InitializeSamplerObject)) { buildLog_ += "Error while BRIG Codegen phase: loading BRIG globals in the ELF \n"; return false;