SWDEV-79309 - [ROCm][OCLonLC][AMDGPU asm] OclElf: Correctly skip symbols which have special section indexes.
[Issues]
Kernels which contain absolute symbols can't be run. Error message looks like:
"OclElf::getSymbolInfo() failed in gelf_getshdr() - Invalid argument."
[Reason]
Symbols which have special section indexes (e.g. absolute symbols)
are incorrectly handled by the compiler library.
[Solution]
Correctly skip symbols which have special section indexes in the loader.
Promote the fix into compiler/legacy-lib at once.
[Remarks/Misc]
Absolute symbols do not normally produced by OpenCL compiler,
but may come from kernels written in assembly language.
AMDGPU asm exports all symbols, even ABSOLUTE LOCAL HIDDEN INTERNAL etc.
Impossibility to disable export of useless symbols is known issue of llvm-mc
core, see https://llvm.org/bugs/show_bug.cgi?id=27201.
Note that presence of useless symbols does not make ELF invalid.
[Review] http://ocltc.amd.com/reviews/r/11921/
Evgeny Mankov (OK)
[Tests]
Tested that issue with asm kernels has gone.
PASS TeamCity - Pre-checkin for CL1347161 timestamped:2016-11-29 21:54:40 Rev:0063
Affected files ...
... //depot/stg/opencl/drivers/opencl/compiler/legacy-lib/loaders/elf/elf.cpp#3 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/loaders/elf/elf.cpp#36 edit
SWDEV-94189 - ORCA RT: do not use temp files
This is memfile implementation, an interface to plug into libelf and emulate files in memory w/o any IO.
If passed filename to open() is empty it will use in memory file, otherwise proxy it to the real file IO routine.
This allows RT not to use temp files. Next this interface will be plugged to the finalizer.
Testing: smoke, precheckin, conformance 2.0 reallyquick, test_compiler 1.2 with -legacy, test_compiler with -save-temps-all and -g -O0 -mem2reg=0
Reviewed by Evgeny Mankov
Affected files ...
... //depot/stg/opencl/drivers/opencl/compiler/lib/loaders/elf/elf.cpp#34 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/loaders/elf/elf.hpp#23 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/loaders/elf/elf_utils.cpp#2 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/loaders/elf/utils/libelf/_libelf_config.h#3 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/loaders/elf/utils/libelf/build/Makefile.libelf#5 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/loaders/elf/utils/libelf/elf_update.c#12 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/loaders/elf/utils/libelf/memfile.cpp#1 add
... //depot/stg/opencl/drivers/opencl/compiler/lib/loaders/elf/utils/libelf/memfile.h#1 add
SWDEV-83467 - [SPIRV] Add support of SPIRV to CPU
Modifying runtime and compile time to allow SPIRV binaries to run on CPU since it only runs on HSAIL GPU
Added changes to allow conversion of CPU's llvmBinaryIsSpir boolean into compiler library's oclElfSections enum
Cpuprogram.cpp's llvmBinaryIsSpir flag renamed to elfSectionType will now support LLVMIR, SPIR, and SPIRV
Added SPIRV to compiler lib's elf as new oclElfSections enum
cpuprogram.cpp changes also made to gpuprogram.cpp's NullProgram to allow compilation
Affected files ...
... //depot/stg/opencl/drivers/opencl/compiler/lib/loaders/elf/elf.cpp#33 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/loaders/elf/elf.hpp#22 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/cpu/cpuprogram.cpp#69 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/device.cpp#191 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/device.hpp#266 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpucompiler.cpp#152 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuprogram.cpp#217 edit