文件
rocm-systems/rocclr/runtime/device/hsa/hsaprogram.cpp
T
foreman 4f098e2a50 P4 to Git Change 1061423 by nhaustov@nhaustov_hsa on 2014/07/31 04:34:11
ECR #010005 - Update to HSAIL PRM 1.0p. [ opencl changes ]

	Changes by Oleg Semenov, Dmitry Preobrazhensky, Valery Pykhtin.

	Testing: full CQE on multiple ASICs, smoke, finalizer_features, regression, OCL conformance 1.2 (offline).

Affected files ...

... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/HSAILAsm/HSAILAsm.cpp#4 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/HSAILAsm/Makefile#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/HSAILAsm/build/Makefile#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/HSAILAsm/build/Makefile.hsailasm#5 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/HSAILTestGen/HSAILTestGen.cpp#6 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/HSAILTestGen/HSAILTestGen.vcxproj#3 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/HSAILTestGen/HSAILTestGenBackend.cpp#3 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/HSAILTestGen/HSAILTestGenBackend.h#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/HSAILTestGen/HSAILTestGenBackendEml.h#1 branch
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/HSAILTestGen/HSAILTestGenBackendLua.h#1 branch
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/HSAILTestGen/HSAILTestGenBrigContext.cpp#1 branch
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/HSAILTestGen/HSAILTestGenBrigContext.h#1 branch
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/HSAILTestGen/HSAILTestGenContext.cpp#7 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/HSAILTestGen/HSAILTestGenContext.h#5 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/HSAILTestGen/HSAILTestGenDataProvider.cpp#6 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/HSAILTestGen/HSAILTestGenDataProvider.h#4 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/HSAILTestGen/HSAILTestGenDump.cpp#4 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/HSAILTestGen/HSAILTestGenEmulator.cpp#14 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/HSAILTestGen/HSAILTestGenEmulator.h#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/HSAILTestGen/HSAILTestGenFilter.h#1 branch
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/HSAILTestGen/HSAILTestGenManager.h#4 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/HSAILTestGen/HSAILTestGenNavigator.cpp#6 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/HSAILTestGen/HSAILTestGenNavigator.h#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/HSAILTestGen/HSAILTestGenProp.cpp#8 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/HSAILTestGen/HSAILTestGenProp.h#8 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/HSAILTestGen/HSAILTestGenProvider.h#5 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/HSAILTestGen/HSAILTestGenSample.cpp#4 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/HSAILTestGen/HSAILTestGenSample.h#4 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/HSAILTestGen/HSAILTestGenTestData.h#1 branch
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/HSAILTestGen/HSAILTestGenTestDesc.cpp#1 branch
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/HSAILTestGen/HSAILTestGenTestDesc.h#1 branch
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/HSAILTestGen/HSAILTestGenUtilities.cpp#6 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/HSAILTestGen/HSAILTestGenUtilities.h#7 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/HSAILTestGen/HSAILTestGenVal.cpp#5 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/HSAILTestGen/HSAILTestGenVal.h#5 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/HSAILTestGen/Makefile#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/HSAILTestGen/build/Makefile#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/HSAILTestGen/build/Makefile.hsailtestgen#5 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/Makefile#4 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/asmdefs#3 delete
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/asmlibs#2 delete
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/asmrules#2 delete
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/htdefs#1 branch
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/htlibs#1 branch
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/htrules#1 branch
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/BrigDwarfGenerator.cpp#3 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/BrigDwarfGenerator.h#3 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/Makefile#3 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/SectionHeaderTable.h#3 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/build/Makefile#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/build/Makefile.libbrigdwarf#4 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/hsa_dwarf.h#3 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libBRIGdwarf.sln#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libBRIGdwarf.vcxproj#5 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libbrigdwarfdefs#2 delete
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/Makefile#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/build/Makefile#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/build/Makefile.libdwarf#3 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/libdwarf.vcxproj#4 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/libdwarfdefs#2 delete
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/CHANGES#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/CODINGSTYLE#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/COPYING#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/ChangeLog#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/ChangeLog2006#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/ChangeLog2007#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/ChangeLog2008#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/ChangeLog2009#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/ChangeLog2010#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/LGPL.txt#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/LIBDWARFCOPYRIGHT#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/NEWS#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/README#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/cmplrs/dwarf_addr_finder.h#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/common.c#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/common.h#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/config.h#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/dwarf.h#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/dwarf_abbrev.c#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/dwarf_abbrev.h#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/dwarf_addr_finder.c#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/dwarf_alloc.c#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/dwarf_alloc.h#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/dwarf_arange.c#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/dwarf_arange.h#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/dwarf_base_types.h#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/dwarf_die_deliv.c#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/dwarf_die_deliv.h#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/dwarf_elf_access.c#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/dwarf_elf_access.h#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/dwarf_error.c#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/dwarf_error.h#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/dwarf_form.c#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/dwarf_frame.c#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/dwarf_frame.h#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/dwarf_frame2.c#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/dwarf_frame3.c#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/dwarf_funcs.c#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/dwarf_funcs.h#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/dwarf_global.c#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/dwarf_global.h#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/dwarf_harmless.c#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/dwarf_harmless.h#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/dwarf_incl.h#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/dwarf_init_finish.c#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/dwarf_leb.c#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/dwarf_line.c#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/dwarf_line.h#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/dwarf_line2.c#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/dwarf_loc.c#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/dwarf_loc.h#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/dwarf_macro.c#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/dwarf_macro.h#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/dwarf_names.c#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/dwarf_names.h#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/dwarf_names_enum.h#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/dwarf_names_new.h#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/dwarf_opaque.h#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/dwarf_original_elf_init.c#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/dwarf_print_lines.c#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/dwarf_pubtypes.c#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/dwarf_query.c#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/dwarf_ranges.c#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/dwarf_sort_line.c#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/dwarf_string.c#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/dwarf_stubs.c#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/dwarf_types.c#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/dwarf_types.h#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/dwarf_util.c#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/dwarf_util.h#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/dwarf_vars.c#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/dwarf_vars.h#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/dwarf_weaks.c#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/dwarf_weaks.h#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/libdwarf.h#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/libdwarfdefs.h#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/malloc_check.c#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/malloc_check.h#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/pro_alloc.c#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/pro_alloc.h#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/pro_arange.c#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/pro_arange.h#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/pro_die.c#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/pro_die.h#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/pro_encode_nm.c#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/pro_encode_nm.h#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/pro_error.c#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/pro_error.h#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/pro_expr.c#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/pro_expr.h#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/pro_finish.c#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/pro_forms.c#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/pro_frame.c#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/pro_frame.h#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/pro_funcs.c#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/pro_incl.h#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/pro_init.c#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/pro_line.c#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/pro_line.h#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/pro_macinfo.c#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/pro_macinfo.h#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/pro_opaque.h#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/pro_pubnames.c#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/pro_reloc.c#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/pro_reloc.h#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/pro_reloc_stream.c#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/pro_reloc_stream.h#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/pro_reloc_symbolic.c#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/pro_reloc_symbolic.h#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/pro_section.c#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/pro_section.h#3 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/pro_types.c#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/pro_types.h#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/pro_util.h#3 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/pro_vars.c#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libdwarf/src/pro_weaks.c#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libelf/libelf.vcxproj#4 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libBRIGdwarf/libelf/libelf.vcxproj.filters#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libHSAIL/Android.mk#3 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libHSAIL/Brig.h#4 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libHSAIL/Brig_new.hpp#10 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libHSAIL/HDLProcessor.pl#4 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libHSAIL/HSAILBrigContainer.cpp#3 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libHSAIL/HSAILBrigContainer.h#4 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libHSAIL/HSAILBrigInstr.hdl#8 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libHSAIL/HSAILBrigObjectFile.cpp#7 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libHSAIL/HSAILBrigObjectFile.h#4 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libHSAIL/HSAILBrigantine.cpp#9 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libHSAIL/HSAILBrigantine.h#6 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libHSAIL/HSAILConvertors.h#4 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libHSAIL/HSAILDisassembler.cpp#10 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libHSAIL/HSAILDisassembler.h#7 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libHSAIL/HSAILDump.cpp#4 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libHSAIL/HSAILDump.h#3 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libHSAIL/HSAILFloats.cpp#4 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libHSAIL/HSAILFloats.h#5 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libHSAIL/HSAILInstProps.h#5 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libHSAIL/HSAILItemBase.h#4 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libHSAIL/HSAILItems.cpp#6 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libHSAIL/HSAILItems.h#8 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libHSAIL/HSAILParser.cpp#11 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libHSAIL/HSAILParser.h#6 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libHSAIL/HSAILSRef.h#5 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libHSAIL/HSAILScanner.cpp#8 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libHSAIL/HSAILScanner.h#7 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libHSAIL/HSAILScannerRules.cpp#5 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libHSAIL/HSAILScannerRules.re2c#7 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libHSAIL/HSAILScope.h#3 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libHSAIL/HSAILTypeUtilities.h#5 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libHSAIL/HSAILUtilities.cpp#9 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libHSAIL/HSAILUtilities.h#8 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libHSAIL/HSAILValidator.cpp#11 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libHSAIL/HSAILValidator.h#4 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libHSAIL/HSAILValidatorBase.cpp#9 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libHSAIL/HSAILValidatorBase.h#7 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libHSAIL/HSAILb128_t.h#3 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libHSAIL/Makefile#3 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libHSAIL/build/Makefile#3 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libHSAIL/build/Makefile.libhsail#7 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libHSAIL/doxy.cfg#3 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libHSAIL/generate.pl#6 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libHSAIL/generate.targets#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libHSAIL/hsail_c.cpp#4 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libHSAIL/hsail_c.h#4 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/libHSAIL/libHSAIL.vcxproj#11 integrate
... //depot/stg/opencl/drivers/opencl/compiler/hsail-tools/mkmk.pl#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/gpu/brig_loader.cpp#12 integrate
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/gpu/hsail_be.cpp#29 integrate
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/gpu/hsail_be.hpp#8 integrate
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/gpu/sc-hsa/Interface/SCCommon.h#11 integrate
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/gpu/sc-hsa/Interface/SCHSAInterface.cpp#2 integrate
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/gpu/sc-hsa/Interface/SCInterface.h#3 integrate
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/gpu/sc-hsa/Src/CompilerExternal.cpp#3 integrate
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/gpu/sc-hsa/Src/Dev/dev.cpp#14 integrate
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/gpu/sc-hsa/Src/hsail-fin/BrigDev.cpp#5 integrate
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/gpu/sc-hsa/Src/hsail-fin/BrigDev.hpp#4 integrate
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/gpu/sc-hsa/Src/hsail-fin/BrigIR.hpp#6 integrate
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/gpu/sc-hsa/Src/hsail-fin/HSAILArithmetic.cpp#11 integrate
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/gpu/sc-hsa/Src/hsail-fin/HSAILCodeGen.cpp#10 integrate
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/gpu/sc-hsa/Src/hsail-fin/HSAILConversions.cpp#6 integrate
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/gpu/sc-hsa/Src/hsail-fin/HSAILFinalizer.cpp#19 integrate
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/gpu/sc-hsa/Src/hsail-fin/HSAILFinalizer.hpp#13 integrate
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/gpu/sc-hsa/Src/hsail-fin/HSAILFunctions.cpp#6 integrate
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/gpu/sc-hsa/Src/hsail-fin/HSAILGCN.cpp#4 integrate
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/gpu/sc-hsa/Src/hsail-fin/HSAILImages.cpp#6 integrate
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/gpu/sc-hsa/Src/hsail-fin/HSAILMemory.cpp#10 integrate
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/gpu/sc-hsa/Src/hsail-fin/HSAILSpecial.cpp#11 integrate
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/gpu/sc-hsa/Src/hsail-fin/HSASymbol.cpp#8 integrate
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/gpu/sc-hsa/Src/hsail-fin/HSASymbol.hpp#7 integrate
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/gpu/sc/Interface/SCCommon.h#37 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/gpu/sc/Interface/SCInterface.h#12 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/gpu/scwrapper/SI/scCompileSI.cpp#42 integrate
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/gpu/scwrapper/SI/scCompileSI.h#16 integrate
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/gpu/scwrapper/build/Makefile.scwrapper#25 integrate
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/gpu/scwrapper/scCompileBase.cpp#37 integrate
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/gpu/scwrapper/scCompileBase.h#21 integrate
... //depot/stg/opencl/drivers/opencl/compiler/lib/include/v0_8/aclEnums.h#11 integrate
... //depot/stg/opencl/drivers/opencl/compiler/lib/include/v0_9/aclTypes.h#6 integrate
... //depot/stg/opencl/drivers/opencl/compiler/lib/loaders/bif/bifbase.cpp#49 integrate
... //depot/stg/opencl/drivers/opencl/compiler/lib/loaders/bif/bifinternal.hpp#7 integrate
... //depot/stg/opencl/drivers/opencl/compiler/lib/utils/bif_section_labels.hpp#17 integrate
... //depot/stg/opencl/drivers/opencl/compiler/llvm/lib/Target/HSAIL/BRIGAsmPrinter.cpp#63 integrate
... //depot/stg/opencl/drivers/opencl/compiler/llvm/lib/Target/HSAIL/BRIGAsmPrinter.h#27 integrate
... //depot/stg/opencl/drivers/opencl/compiler/llvm/lib/Target/HSAIL/HSAILControlFlow.td#5 integrate
... //depot/stg/opencl/drivers/opencl/compiler/llvm/lib/Target/HSAIL/HSAILISelDAGToDAG.cpp#21 integrate
... //depot/stg/opencl/drivers/opencl/compiler/llvm/lib/Target/HSAIL/HSAILISelLowering.cpp#52 integrate
... //depot/stg/opencl/drivers/opencl/compiler/llvm/lib/Target/HSAIL/HSAILImages.td#7 integrate
... //depot/stg/opencl/drivers/opencl/compiler/llvm/lib/Target/HSAIL/HSAILIntrinsics.td#33 integrate
... //depot/stg/opencl/drivers/opencl/compiler/llvm/lib/Target/HSAIL/HSAILKernelManager.cpp#21 integrate
... //depot/stg/opencl/drivers/opencl/compiler/llvm/lib/Target/HSAIL/HSAILKernelManager.h#8 integrate
... //depot/stg/opencl/drivers/opencl/compiler/llvm/lib/Target/HSAIL/HSAILSpecial.td#12 integrate
... //depot/stg/opencl/drivers/opencl/compiler/llvm/lib/Target/HSAIL/HSAILUtilityFunctions.cpp#27 integrate
... //depot/stg/opencl/drivers/opencl/compiler/llvm/lib/Target/HSAIL/HSAILUtilityFunctions.h#18 integrate
... //depot/stg/opencl/drivers/opencl/compiler/llvm/lib/Transforms/Scalar/AMDLowerAtomics.cpp#12 integrate
... //depot/stg/opencl/drivers/opencl/compiler/llvm/utils/TableGen/AMDBRIGLoweringEmitter.cpp#3 integrate
... //depot/stg/opencl/drivers/opencl/compiler/llvm/utils/TableGen/AMDDAGWalker.cpp#15 integrate
... //depot/stg/opencl/drivers/opencl/compiler/llvm/utils/TableGen/AMDDAGWalker.h#12 integrate
... //depot/stg/opencl/drivers/opencl/compiler/loader/libloader/loader.cpp#11 integrate
... //depot/stg/opencl/drivers/opencl/compiler/tools/aoc2/aoc2.cpp#56 integrate
... //depot/stg/opencl/drivers/opencl/library/hsa/hsail/src/image/get.cl#8 integrate
... //depot/stg/opencl/drivers/opencl/library/hsa/hsail/src/misc/atomicWorkItemFence.cl#5 integrate
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuprogram.cpp#171 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/hsa/hsaprogram.cpp#36 integrate
... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/hsaprogram.cpp#5 integrate
... //depot/stg/opencl/drivers/opencl/tests/ocltst/module/complib/CLEnumCheck.cpp#35 integrate
2014-07-31 04:43:02 -04:00

748 行
27 KiB
C++

//
// Copyright (c) 2008 Advanced Micro Devices, Inc. All rights reserved.
//
#ifndef WITHOUT_FSA_BACKEND
#include "device/hsa/hsaprogram.hpp"
#include "compiler/lib/loaders/elf/elf.hpp"
#include "compiler/lib/utils/options.hpp"
#include "runtime/device/hsa/hsakernel.hpp"
#include "runtime/device/hsa/hsacompilerlib.hpp"
#include "runtime/device/hsa/oclhsa_common.hpp"
#include "utils/bif_section_labels.hpp"
#include <string>
#include <vector>
#include <cstring>
#include <fstream>
#include <sstream>
#include <iostream>
#include <istream>
#endif // WITHOUT_FSA_BACKEND
namespace oclhsa {
#ifndef WITHOUT_FSA_BACKEND
/* Temporary log function for the compiler library */
static void logFunction(const char *msg, size_t size) {
std::cout << "Compiler Library log :" << msg << std::endl;
}
FSAILProgram::~FSAILProgram() {
unloadBrig();
acl_error error;
// Free the elf binary
if (binaryElf_ != NULL) {
error = g_complibApi._aclBinaryFini(binaryElf_);
if (error != ACL_SUCCESS) {
LogWarning( "Error while destroying the acl binary \n" );
}
}
}
FSAILProgram::FSAILProgram(oclhsa::NullDevice& device): device::Program(device),
llvmBinary_(),
binaryElf_(NULL),
device_(device),
isBrigLoaded_(false)
{
memset(&binOpts_, 0, sizeof(binOpts_));
binOpts_.struct_size = sizeof(binOpts_);
//binOpts_.elfclass = LP64_SWITCH( ELFCLASS32, ELFCLASS64 );
//Setting as 32 bit because hsail64 returns an invalid aclTargetInfo
//when aclGetTargetInfo is called - EPR# 377910
binOpts_.elfclass = ELFCLASS32;
binOpts_.bitness = ELFDATA2LSB;
binOpts_.alloc = &::malloc;
binOpts_.dealloc = &::free;
}
bool FSAILProgram::initClBinary(char *binaryIn, size_t size) { // Save the
// original
// binary that
// isn't owned
// by ClBinary
clBinary()->saveOrigBinary(binaryIn, size);
char *bin = binaryIn;
size_t sz = size;
int encryptCode;
char *decryptedBin;
size_t decryptedSize;
if (!clBinary()->decryptElf(binaryIn, size,
&decryptedBin, &decryptedSize, &encryptCode)) {
return false;
}
if (decryptedBin != NULL) {
// It is decrypted binary.
bin = decryptedBin;
sz = decryptedSize;
}
// Both 32-bit and 64-bit are allowed!
if (!amd::isElfMagic(bin)) {
// Invalid binary.
if (decryptedBin != NULL) {
delete[]decryptedBin;
}
return false;
}
clBinary()->setFlags(encryptCode);
return clBinary()->setBinary(bin, sz, (decryptedBin != NULL));
}
bool FSAILProgram::initBuild(amd::option::Options *options) {
if (!device::Program::initBuild(options)) {
return false;
}
// Need to get device information from CAL !?!?
// Needs the device pointer from CAL to send to options class
//
// Shreyas: Commenting this might cause a bug - keeping this fro now
// options->setPerBuildInfo("hsa",
// binary_.getEncryptCode()
// );
// Elf Binary setup
std::string outFileName;
// true means fsail required
clBinary()->init(options, true);
if (options->isDumpFlagSet(amd::option::DUMP_BIF)) {
outFileName = options->getDumpFileName(".bin");
}
bool useELF64 = getCompilerOptions()->oVariables->EnableGpuElf64;
if (!clBinary()->setElfOut(useELF64 ? ELFCLASS64 : ELFCLASS32,
(outFileName.size() >
0) ? outFileName.c_str() : NULL)) {
LogError("Setup elf out for gpu failed");
return false;
}
return true;
}
// ! post-compile setup for GPU
bool FSAILProgram::finiBuild(bool isBuildGood) {
clBinary()->resetElfOut();
clBinary()->resetElfIn();
if (!isBuildGood) {
// Prevent the encrypted binary form leaking out
clBinary()->setBinary(NULL, 0);
}
return device::Program::finiBuild(isBuildGood);
}
static char *readFile(std::string source_filename, size_t &size) {
FILE *fp = ::fopen(source_filename.c_str(), "rb");
unsigned int length;
size_t offset = 0;
char *ptr;
if (!fp) {
return NULL;
}
// obtain file size.
::fseek(fp, 0, SEEK_END);
length = ::ftell(fp);
::rewind(fp);
ptr = reinterpret_cast<char *>(malloc(offset + length + 1));
if (length != fread(&ptr[offset], 1, length, fp)) {
free(ptr);
return NULL;
}
ptr[offset + length] = '\0';
size = offset + length;
::fclose(fp);
return ptr;
}
aclType FSAILProgram::getNextCompilationStageFromBinary() {
acl_error errorCode;
size_t secSize = 0;
aclType from = ACL_TYPE_DEFAULT;
// Checking llvmir in .llvmir section
bool isLlvmirText = true;
const void *llvmirText = g_complibApi._aclExtractSection(device().compiler(),
binaryElf_,
&secSize,
aclLLVMIR,
&errorCode);
if (errorCode != ACL_SUCCESS) {
isLlvmirText = false;
}
// Checking compile & link options in .comment section
bool isOpts = true;
const void *opts = g_complibApi._aclExtractSection(device().compiler(),
binaryElf_,
&secSize,
aclCOMMENT,
&errorCode);
if (errorCode != ACL_SUCCESS) {
isOpts = false;
}
if (isLlvmirText) {
from = ACL_TYPE_LLVMIR_BINARY;
} else {
if (!isLlvmirText) {
buildLog_ +="Error while linking : \
Invalid binary (Missing LLVMIR section)\n" ;
}
if (!isOpts) {
buildLog_ +="Warning while linking : \
Invalid binary (Missing COMMENT section)\n" ;
}
return ACL_TYPE_DEFAULT;
}
bool isHsailText = true;
// Checking HSAIL in .cg section
const void *hsailText = g_complibApi._aclExtractSection(device().compiler(),
binaryElf_,
&secSize,
aclCODEGEN,
&errorCode);
if (errorCode != ACL_SUCCESS) {
isHsailText = false;
}
// Checking BRIG STRTAB in .brig_strtab section
bool isBrigStrtab = true;
const void *brigStrtab = g_complibApi._aclExtractSection(device().compiler(),
binaryElf_,
&secSize,
aclBRIGstrs,
&errorCode);
if (errorCode != ACL_SUCCESS) {
isBrigStrtab = false;
}
// Checking BRIG CODE in .brig_code section
bool isBrigCode = true;
const void *brigCode = g_complibApi._aclExtractSection(device().compiler(),
binaryElf_,
&secSize,
aclBRIGcode,
&errorCode);
if (errorCode != ACL_SUCCESS) {
isBrigCode = false;
}
// Checking BRIG OPERANDS in .brig_operands section
bool isBrigOps = true;
const void *brigOps = g_complibApi._aclExtractSection(device().compiler(),
binaryElf_,
&secSize,
aclBRIGoprs,
&errorCode);
if (errorCode != ACL_SUCCESS) {
isBrigOps = false;
}
if (isHsailText && isBrigStrtab && isBrigCode && isBrigOps) {
from = ACL_TYPE_HSAIL_BINARY;
} else if (!isHsailText && !isBrigStrtab && !isBrigCode && !isBrigOps) {
from = ACL_TYPE_LLVMIR_BINARY;
} else {
if (!isHsailText) {
buildLog_ +="Error while linking : \
Invalid binary (Missing CG section)\n" ;
}
if (!isBrigStrtab) {
buildLog_ +="Error while linking : \
Invalid binary (Missing BRIG_STRTAB section)\n" ;
}
if (!isBrigCode) {
buildLog_ +="Error while linking : \
Invalid binary (Missing BRIG_CODE section)\n" ;
}
if (!isBrigOps) {
buildLog_ +="Error while linking : \
Invalid binary (Missing BRIG_OPERANDS section)\n" ;
}
return ACL_TYPE_DEFAULT;
}
// Checking ISA in .text section
bool isShaderIsa = true;
const void *shaderIsa = g_complibApi._aclExtractSection(device().compiler(),
binaryElf_,
&secSize,
aclTEXT,
&errorCode);
if (errorCode != ACL_SUCCESS) {
isShaderIsa = false;
}
if (isShaderIsa && from == ACL_TYPE_LLVMIR_BINARY) {
from = ACL_TYPE_DEFAULT;
}
return from;
}
bool FSAILProgram::updateAclBinaryWithKernelIsaAndDebug(std::string kernelName){
assert(brig_.loadmap_section != NULL);
aclBinary * internalAclBinary = reinterpret_cast<aclBinary*>(brig_.loadmap_section);
std::string openClKernelName("&__OpenCL_" + kernelName + "_kernel");
const oclBIFSymbolStruct* isaSymbolStruct = findBIF30SymStruct(symISABinary);
assert(isaSymbolStruct && "symbol not found");
std::string kernelIsaSymbol = isaSymbolStruct->str[PRE] +
openClKernelName + isaSymbolStruct->str[POST];
const oclBIFSymbolStruct* debugSymbolStruct = findBIF30SymStruct(symDebugInfo);
assert(debugSymbolStruct && "symbol not found");
//For debug symbols, the PRE is used for BRIG debug and the POST is used for
//ISA debug
std::string kernelIsaDebugSymbol = debugSymbolStruct->str[POST] + openClKernelName;
//Extract the ISA section
size_t symbolSize;
acl_error errorCode;
const void* isaSymbol = g_complibApi._aclExtractSymbol(device().compiler(),
internalAclBinary,
&symbolSize,
aclTEXT,
kernelIsaSymbol.c_str(),
&errorCode);
if (errorCode != ACL_SUCCESS) {
buildLog_ += "Failed to extract ISA for kernel";
return false;
}
//Insert the ISA section
errorCode = g_complibApi._aclInsertSymbol(device().compiler(),
binaryElf_,
isaSymbol,
symbolSize,
aclTEXT,
kernelIsaSymbol.c_str());
if (errorCode != ACL_SUCCESS) {
buildLog_ += "Failed to insert ISA for kernel";
return false;
}
const void* debugSymbol = g_complibApi._aclExtractSymbol(device().compiler(),
internalAclBinary,
&symbolSize,
aclHSADEBUG,
kernelIsaDebugSymbol.c_str(),
&errorCode);
//If debug information is available
if (errorCode == ACL_SUCCESS) {
//Update binary with the debug section for the kernel
errorCode = g_complibApi._aclInsertSymbol(device().compiler(),
binaryElf_,
debugSymbol,
symbolSize,
aclHSADEBUG,
kernelIsaDebugSymbol.c_str());
if (errorCode != ACL_SUCCESS) {
buildLog_ += "Failed to insert debug information for kernel";
return false;
}
}
return true;
}
bool FSAILProgram::ExtractSymbolAndCopy(aclSections id,
const char *symbol_name,
void** address_to_copy,
size_t* symbol_size_bytes,
bool verify) {
acl_error error_code;
*symbol_size_bytes = 0;
const void* symbol_data = g_complibApi._aclExtractSymbol(
device().compiler(),
binaryElf_,
symbol_size_bytes,
id,
symbol_name,
&error_code);
//If the section is not mandatory and the section does not exist
//skip this section
if (error_code != ACL_SUCCESS) {
if (!verify) {
return true;
}
std::string error = "Could not find Brig Directive in BIFF: ";
error += symbol_name;
LogError(error.c_str());
buildLog_ += error;
return false;
}
*address_to_copy = malloc(*symbol_size_bytes);
if (*address_to_copy == NULL) {
LogError(" Failed to allocate memory");
return false;
}
memcpy(*address_to_copy, symbol_data, *symbol_size_bytes);
return true;
}
bool FSAILProgram::saveBinaryAndSetType(type_t type) {
//Write binary to memory
void *rawBinary = NULL;
size_t size;
if (g_complibApi._aclWriteToMem(binaryElf_, &rawBinary, &size)
!= ACL_SUCCESS) {
buildLog_ += "Failed to write binary to memory \n";
return false;
}
clBinary()->saveBIFBinary((char*)rawBinary, size);
//Set the type of binary
setType(type);
//Free memory containing rawBinary
binaryElf_->binOpts.dealloc(rawBinary);
return true;
}
bool FSAILProgram::linkImpl(const std::vector<Program *> &inputPrograms,
amd::option::Options *options,
bool createLibrary) {
std::vector<device::Program *>::const_iterator it
= inputPrograms.begin();
std::vector<device::Program *>::const_iterator itEnd
= inputPrograms.end();
acl_error errorCode;
// For each program we need to extract the LLVMIR and create
// aclBinary for each
std::vector<aclBinary *> binaries_to_link;
for (size_t i = 0; it != itEnd; ++it, ++i) {
FSAILProgram *program = (FSAILProgram *)*it;
// Check if the program was created with clCreateProgramWIthBinary
binary_t binary = program->binary();
if ((binary.first != NULL) && (binary.second > 0)) {
// Binary already exists -- we can also check if there is no
// opencl source code
// Need to check if LLVMIR exists in the binary
// If LLVMIR does not exist then is it valid
// We need to pull out all the compiled kernels
// We cannot do this at present because we need at least
// Hsail text to pull the kernels oout
void *mem = const_cast<void *>(binary.first);
binaryElf_ = g_complibApi._aclReadFromMem(mem,
binary.second,
&errorCode);
if (errorCode != ACL_SUCCESS) {
LogWarning("Error while linking : Could not read from raw binary");
return false;
}
}
// At this stage each FSAILProgram contains a valid binary_elf
// Check if LLVMIR is in the binary
// @TODO - Memory leak , cannot free this buffer
// need to fix this.. File EPR on compiler library
size_t llvmirSize = 0;
const void *llvmirText = g_complibApi._aclExtractSection(device().compiler(),
binaryElf_,
&llvmirSize,
aclLLVMIR,
&errorCode);
if (errorCode != ACL_SUCCESS) {
buildLog_ +="Error while linking : \
Invalid binary (Missing LLVMIR section)" ;
return false;
}
// Create a new aclBinary for each LLVMIR and save it in a list
aclBIFVersion ver = g_complibApi._aclBinaryVersion(binaryElf_);
aclBinary *bin = g_complibApi._aclCreateFromBinary(binaryElf_, ver);
binaries_to_link.push_back(bin);
}
// At this stage each FSAILProgram in the list has an aclBinary initialized
// and contains LLVMIR
// We can now go ahead and link them.
if (binaries_to_link.size() > 1) {
errorCode = g_complibApi._aclLink(device().compiler(),
binaries_to_link[0],
binaries_to_link.size() - 1,
&binaries_to_link[1],
ACL_TYPE_LLVMIR_BINARY,
"-create-library",
NULL);
}
else {
errorCode = g_complibApi._aclLink(device().compiler(),
binaries_to_link[0],
0,
NULL,
ACL_TYPE_LLVMIR_BINARY,
"-create-library",
NULL);
}
if (errorCode != ACL_SUCCESS) {
buildLog_ += "Failed to link programs";
return false;
}
// Store the newly linked aclBinary for this program.
binaryElf_ = binaries_to_link[0];
// Free all the other aclBinaries
for (size_t i = 1; i < binaries_to_link.size(); i++) {
g_complibApi._aclBinaryFini(binaries_to_link[i]);
}
if (createLibrary) {
saveBinaryAndSetType(TYPE_LIBRARY);
return true;
}
// Now call linkImpl with the new options
return linkImpl(options);
}
bool FSAILProgram::loadBrig() {
//Copy all the sections into BRIG
memset(&brig_, 0 ,sizeof(HsaBrig));
bool codeStatus = ExtractSymbolAndCopy(aclBRIGcode,
"__BRIG__code",
&brig_.code_section,
&brig_.code_section_byte_size,
true
);
bool oprStatus = ExtractSymbolAndCopy(aclBRIGoprs,
"__BRIG__operands",
&brig_.operand_section,
&brig_.operand_section_byte_size,
true
);
bool strStatus = ExtractSymbolAndCopy(aclBRIGstrs,
"__BRIG__strtab",
&brig_.string_section,
&brig_.string_section_byte_size,
true
);
bool dbgStatus = ExtractSymbolAndCopy(aclHSADEBUG ,
"__debug_brig__",
&brig_.debug_section,
&brig_.debug_section_byte_size,
false
);
if (!codeStatus || !oprStatus || !strStatus || !dbgStatus) {
LogError("Failed to Extract one or more BRIG sections");
buildLog_ += "Error: Failed to Extract one or more BRIG sections";
return false;
}
if(hsacoreapi->HsaLoadBrig(device_.getBackendDevice(), &brig_)
!= kHsaStatusSuccess){
return false;
}
isBrigLoaded_ = true;
return true;
}
bool FSAILProgram::unloadBrig() {
if (isBrigLoaded_ == true) {
HsaStatus status = hsacoreapi->HsaUnloadBrig(&brig_);
if (status != kHsaStatusSuccess){
return false;
}
//Destroy the BRIG
free(brig_.code_section);
free(brig_.operand_section);
free(brig_.string_section);
free(brig_.debug_section);
}
return true;
}
bool FSAILProgram::linkImpl(amd::option::Options *options) {
acl_error errorCode;
aclType continueCompileFrom = ACL_TYPE_LLVMIR_BINARY;
//If the binaryElf_ is not set then program must have been created
// using clCreateProgramWithBinary
if (!binaryElf_) {
binary_t binary = this->binary();
if ((binary.first != NULL) && (binary.second > 0)) {
// Binary already exists -- we can also check if there is no
// opencl source code
// Need to check if LLVMIR exists in the binary
// If LLVMIR does not exist then is it valid
// We need to pull out all the compiled kernels
// We cannot do this at present because we need at least
// Hsail text to pull the kernels oout
void *mem = const_cast<void *>(binary.first);
binaryElf_ = g_complibApi._aclReadFromMem(mem,
binary.second,
&errorCode);
if (errorCode != ACL_SUCCESS) {
buildLog_ += "Error while converting to BRIG: aclBinary init failure \n" ;
LogWarning("aclBinaryInit failed");
return false;
}
// Check that all needed section also exist in binaryElf_
// No any validity checks here
continueCompileFrom = getNextCompilationStageFromBinary();
if (ACL_TYPE_DEFAULT == continueCompileFrom) {
return false;
}
if (ACL_TYPE_HSAIL_BINARY == continueCompileFrom) {
// Save binary in the interface class
// Also load compile & link options from binary into Program class members:
// compileOptions_ & linkOptions_
setBinary(static_cast<char*>(mem), binary.second);
// Compare options loaded from binary with current ones
// If they differ then recompile from ACL_TYPE_LLVMIR_BINARY
// @TODO It is needed to compare options taking into account that:
// 1. options are order independent;
// 2. (may be not trivial) compare only options that affect binary
std::string curOptions = options->origOptionStr + hsailOptions();
if (compileOptions_ + linkOptions_ != curOptions) {
continueCompileFrom = ACL_TYPE_LLVMIR_BINARY;
}
}
}
}
// Compilation from ACL_TYPE_LLVMIR_BINARY to ACL_TYPE_CG in cases:
// 1. if the program is not created with binary;
// 2. if the program is created with binary and contains only .llvmir & .comment
// 3. if the program is created with binary, contains all brig sections,
// but the binary's compile & link options differ from current ones (recompilation);
if (ACL_TYPE_LLVMIR_BINARY == continueCompileFrom) {
std::string curOptions = options->origOptionStr + hsailOptions();
errorCode = g_complibApi._aclCompile(device().compiler(),
binaryElf_,
curOptions.c_str(),
ACL_TYPE_LLVMIR_BINARY,
ACL_TYPE_CG,
logFunction);
}
if (errorCode != ACL_SUCCESS) {
buildLog_ += "Error while converting to BRIG: Compiling LLVMIR to BRIG \n" ;
return false;
}
//Stop compilation if it is an offline device - HSA runtime does not
//support ISA compiled offline
if (!dev().isOnline()) {
return true;
}
size_t fsailSize;
const void *hsailText = g_complibApi._aclExtractSection(device().compiler(),
binaryElf_,
&fsailSize,
aclCODEGEN,
&errorCode);
if (errorCode != ACL_SUCCESS) {
buildLog_ += "Error while reading out the HSAIL from the ELF" ;
return false;
}
const HsaDevice *hsaDevice = dev().getBackendDevice();
if (!loadBrig()) {
buildLog_ += "Error while loading BRIG" ;
return false;
}
std::string hsailProgram((char*)hsailText, fsailSize);
fsailProgram_ = hsailProgram;
// We pull out all the kernel names in a very ugly manner
//Todo(sramalin) : check if this has been fixed in the compiler library
// If not file an EPR
if (!fsailProgram_.empty()) {
// Find out the name of the kernel. Works for multiple kernels
std::vector<std::string> kernelNames;
int pos = 0;
while (true) {
std::string findString = "kernel &";
size_t kernelNPos = fsailProgram_.find(findString, pos);
if (kernelNPos == std::string::npos) {
break;
}
size_t kernelEndNPos = fsailProgram_.find("l(", kernelNPos);
pos = kernelEndNPos + 1;
if (kernelEndNPos == std::string::npos) {
break;
}
// "kernel &" is 8
// "__OpenCL_" is 9
// "_kerne" is 6
// We can drop all this with a compiler tweak later
std::string kernelName = fsailProgram_.substr(kernelNPos + 8 + 9,
kernelEndNPos -
(kernelNPos + 8 + 9) - 6);
kernelNames.push_back(kernelName);
Kernel *aKernel = new oclhsa::Kernel(kernelName,
this,
&brig_,
options->origOptionStr + hsailOptions());
if (!aKernel->init() ) {
return false;
}
aKernel->setUniformWorkGroupSize(options
->oVariables->UniformWorkGroupSize);
//Update the binary in the FSAILProgram to save the ISA and debug
// information. This is so the debugger and the profiler can use the
// a single aclBinary for all their needs.
if (!updateAclBinaryWithKernelIsaAndDebug(kernelName)) {
return false;
}
kernels()[kernelName] = aKernel;
}
saveBinaryAndSetType(TYPE_EXECUTABLE);
buildLog_ += g_complibApi._aclGetCompilerLog(device().compiler());
return true;
}
return false;
}
bool FSAILProgram::createBinary(amd::option::Options *options) {
return false;
}
bool FSAILProgram::initClBinary() {
if (clBinary_ == NULL) {
clBinary_ = new ClBinary(static_cast<const Device &>(device()));
if (clBinary_ == NULL) {
return false;
}
}
return true;
}
void FSAILProgram::releaseClBinary() {
if (clBinary_ != NULL) {
delete clBinary_;
clBinary_ = NULL;
}
}
std::string FSAILProgram::hsailOptions() {
std::string hsailOptions;
//Set options for the standard device specific options
//This is just for legacy compiler code
// All our devices support these options now
hsailOptions.append(" -DFP_FAST_FMAF=1");
hsailOptions.append(" -DFP_FAST_FMA=1");
//TODO(sramalin) : Query the device for opencl version
// and only set if -cl-std wasn't specified in
// original build options (app)
//hsailOptions.append(" -cl-std=CL1.2");
//check if the host is 64 bit or 32 bit
LP64_ONLY(hsailOptions.append(" -m64"));
//Now append each extension supported by the device
// one by one
std::string token;
std::istringstream iss("");
iss.str(device().info().extensions_);
while (getline(iss, token, ' ')) {
if (!token.empty()) {
hsailOptions.append(" -D");
hsailOptions.append(token);
hsailOptions.append("=1");
}
}
return hsailOptions;
}
#endif // WITHOUT_FSA_BACKEND
} // namespace hsa