SWDEV-88670 - Required for upcoming sync of SPIRV translator
SPIRV.h removed the include from header file, but it is needed.
Affected files ...
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/common/frontend_clang.cpp#28 edit
SWDEV-86836 - Enhance caching library class to prepare one-stage kernel caching by:
0. Moving cache storage setup into constructor
1. Controlling cache storage size
2. Explicit cache cleanup
a. -kcache-wipe is off by default; when turned on, the caching directory would be wiped off
b. Here it's just an option. The implementation (the call of wipeCacheFolders()) will be added in the compiler library
3. Enforcing cache miss (actual compilation enforcing and adding a new entry to the cache storage).
a. -kcache-enforce-miss is off by default; when turned on, the real compilation will be enforced
b. Here it's just an option. The implementation will be added in the compiler library
ReviewBoardURL = http://ocltc.amd.com/reviews/r/9726/
Affected files ...
... //depot/stg/opencl/drivers/opencl/compiler/lib/utils/OPTIONS.def#134 edit
... //depot/stg/opencl/drivers/opencl/compiler/tools/caching/cache.cpp#12 edit
... //depot/stg/opencl/drivers/opencl/compiler/tools/caching/cache.hpp#7 edit
SWDEV-85602 - rename hsail-64 arch to hsail64
This is to match other existing llvm targets, such as spir64 and amdil64, as well as to match behavior of open source HSAIL BE.
For legacy users there is alias "-hsail-64" provided in the aoc2 only.
Testing: smoke, precheckin
Reviewed by Matthew Arsenault, Evgeny Mankov and Nikolay Haustov
Affected files ...
... //depot/stg/opencl/drivers/opencl/compiler/legacy-lib/backends/common/codegen.cpp#2 edit
... //depot/stg/opencl/drivers/opencl/compiler/legacy-lib/backends/common/frontend.cpp#4 edit
... //depot/stg/opencl/drivers/opencl/compiler/legacy-lib/utils/v0_8/target_mappings.h#5 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/common/codegen.cpp#66 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/common/frontend.cpp#37 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/utils/v0_8/target_mappings.h#37 edit
... //depot/stg/opencl/drivers/opencl/compiler/llvm/lib/Target/HSAIL/HSAILTargetMachine.cpp#53 edit
... //depot/stg/opencl/drivers/opencl/compiler/llvm/lib/Target/HSAIL/TargetInfo/HSAILTargetInfo.cpp#6 edit
... //depot/stg/opencl/drivers/opencl/compiler/llvm/tools/aacl/aa.h#2 edit
... //depot/stg/opencl/drivers/opencl/compiler/tools/aoc2/aoc2.cpp#80 edit
... //depot/stg/opencl/drivers/opencl/library/hsa/amp_libm/build/Makefile.amp_libm#4 edit
... //depot/stg/opencl/drivers/opencl/library/hsa/gcn/build/Makefile.gcn#20 edit
... //depot/stg/opencl/drivers/opencl/library/hsa/gcndev/build/Makefile.gcndev#3 edit
... //depot/stg/opencl/drivers/opencl/library/hsa/hsail/build/Makefile.hsail#44 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpucompiler.cpp#153 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuprogram.cpp#222 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/hsacompiler.cpp#5 edit
... //depot/stg/opencl/drivers/opencl/tests/hsa/bin/test_driver.pl#25 edit
... //depot/stg/opencl/drivers/opencl/tests/hsa/tlst/complib.tlst#21 edit
... //depot/stg/opencl/drivers/opencl/tests/hsa/tlst/ocl_debug.tlst#9 edit
... //depot/stg/opencl/drivers/opencl/tests/hsa/tlst/ocl_regression.tlst#25 edit
... //depot/stg/opencl/drivers/opencl/tests/ocltst/module/spir/SPIRBase.cpp#3 edit
... //depot/stg/opencl/drivers/opencl/tests/ocltst/module/spir/SPIRVBasic.cpp#10 edit
... //depot/stg/opencl/drivers/opencl/tests/ocltst/module/spir/SPIRVDropIn.cpp#5 edit
SWDEV-80173 - remove the opt level adjustment based on the function size
Since it only limits the llvm backend, but not optimizer or SC it really hurts the compile time.
A huge unoptimized hsail after inlining and no backend optimizations goes to the SC with overwhelming results.
A proper way of addressing these issues is to keep inlining reasonable.
Testing: smoke, precheckin
Reviewed by Evgeny Mankov
Affected files ...
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/common/codegen.cpp#65 edit
... //depot/stg/opencl/drivers/opencl/compiler/llvm/lib/Transforms/IPO/AMDInline.cpp#3 edit
SWDEV-80173 - HSA HLC: disable liveness analysis and jump threading
After the investigation I have found liveness analysis never changed code generation in any of the benchmarks or applications.
Its only use is in the LICM and the hoisting limitation was never really triggered.
Since the analysis is very expensive I'm disabling it.
The jump threading is generally bad on the GPU because it creates unstructured control flow.
Even if hsail might become smaller and have less branches, it does not help because finalzier's structurizer will have to clone blocks.
Jump threading is disabled for GPU. This improves compilation speed and just slightly improves performance.
Testing: smoke, precheckin, vray and blender compilation
Reviewed by Daniil Fukalov
Affected files ...
... //depot/stg/opencl/drivers/opencl/compiler/lib/utils/OPTIONS.def#133 edit
... //depot/stg/opencl/drivers/opencl/compiler/llvm/include/llvm/AMDLLVMContextHook.h#29 edit
... //depot/stg/opencl/drivers/opencl/compiler/llvm/lib/Analysis/AMDLiveAnalysis.cpp#32 edit
... //depot/stg/opencl/drivers/opencl/compiler/llvm/lib/Transforms/IPO/AMDPassManagerBuilder.cpp#61 edit
... //depot/stg/opencl/drivers/opencl/compiler/llvm/tools/opt/amdopt.inc#29 edit
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
SWDEV-82596 - HSA HLC: Create AMDInline pass
The generic llvm inlining heuristcs do not work well for GPU.
In particular we have a common problem in several tests:
If we have a pointer to private array passed into a function it will not be optimized out, leaving scratch usage.
The pass increases the inline threshold to allow inliniting in this case.
Also that we can move at least some AMD inlining customizations into this file from the common code.
Inline hint threshold is moved in this change.
Performance impact on ocltst sha256, 32 bit, Fiji:
AMDIL HSAIL Diff HSAIL+Inliner Diff Diff
before to AMDIL to HSAIL to AMDIL
OCLPerfSHA256[ 0] 43.843 40.894 0.93 69.910 1.71 1.59
OCLPerfSHA256[ 1] 53.611 51.083 0.95 80.919 1.58 1.51
OCLPerfSHA256[ 2] 52.127 51.528 0.99 80.640 1.56 1.55
OCLPerfSHA256[ 3] 60.952 57.027 0.94 68.615 1.20 1.13
OCLPerfSHA256[ 4] 76.173 70.150 0.92 80.582 1.15 1.06
OCLPerfSHA256[ 5] 75.886 70.264 0.93 81.000 1.15 1.07
Testing: smoke, precheckin, ocltst sha256
Reviewed by Danill Fukalov
Affected files ...
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/common/opt_level.cpp#28 edit
... //depot/stg/opencl/drivers/opencl/compiler/llvm/include/llvm/InitializePasses.h#93 edit
... //depot/stg/opencl/drivers/opencl/compiler/llvm/include/llvm/LinkAllPasses.h#49 edit
... //depot/stg/opencl/drivers/opencl/compiler/llvm/include/llvm/Transforms/IPO.h#32 edit
... //depot/stg/opencl/drivers/opencl/compiler/llvm/lib/Transforms/IPO/AMDInline.cpp#1 add
... //depot/stg/opencl/drivers/opencl/compiler/llvm/lib/Transforms/IPO/CMakeLists.txt#24 edit
... //depot/stg/opencl/drivers/opencl/compiler/llvm/lib/Transforms/IPO/IPO.cpp#32 edit
... //depot/stg/opencl/drivers/opencl/compiler/llvm/lib/Transforms/IPO/Inliner.cpp#42 edit
... //depot/stg/opencl/drivers/opencl/compiler/llvm/tools/opt/amdopt.inc#28 edit
SWDEV-82054 - [CQE OCL][QR][LNX] RQ Conformance "Integer_Ops" test is crashing on CPU; Faulty CL#1206023.
In llvm32 by default llvm::DisablePrettyStackTrace is off, which causes a trap handler installed by default and interferes with the trap handler in runtime, causing unhandled SIGFPE exceptions when executing conformance/integer_ops on certain cpu.
To fix this, put stack trace duping under an env var AMD_DUMP_STACK_TRACE and set llvm::DisablePrettyStackTrace=true by default.
Here env var is used because there is still no elf binary at this stage to pass the compiler option to if_aclCompilerInit.
Affected files ...
... //depot/stg/opencl/drivers/opencl/compiler/legacy-lib/backends/common/v0_8/if_acl.cpp#8 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/common/v0_8/if_acl.cpp#86 edit
SWDEV-81805 - Fix compiler lib bug: incorrect type name %opencl.pipe_t0 is generated when using clang.
Clang does not return llvm::Module. It saves the bitcode to a memory buffer and passed back to compiler lib, then bitcode reader is used to get llvm::Module. Clang and bitcode reader uses the same LLVMContext which is created earlier in aclCompileInternal. Since named struct types are shared between modules in LLVMContext. When bitcode reader loads the module, name collision happens for named struct types, which causes them to be postfixed with a number, e.g. %opencl.pipe_t => %opencl.pipe_t0.
This causes failure in SPIR-V drop-in conformance test.
The fix is to let clang uses a separate LLVMContext.
Affected files ...
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/common/frontend_clang.cpp#26 edit
SWDEV-67990 - SPIR-V: Fix duplicate creation of opaque types in SPIR-V/LLVM translation.
Fix mem leak in drop-in LLVM/SPIR-V translator.
Add warning for undefined function in linker.
Affected files ...
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/common/linker.cpp#135 edit
... //depot/stg/opencl/drivers/opencl/compiler/llvm/lib/SPIRV/SPIRVReader.cpp#5 edit
SWDEV-80864 - HSAIL Metadata Workgroup Size Hint and Vec Type Hint added to HSAIL Runtime
Runtime changes required for the use of these two metadata:
- Runtime's gpukernel.cpp requires new aclQueries during HSAILKernel::Init
- One for quering WorkGroupSizeHint's array
- Two for size of VecTypeHint and fetching VecTypeHint's string
- initArgList needs to be moved to end of HSAILKernel::init to allow createSignature to get non empty values
- Compiler lib's workgroup hint (wsh) needs to match runtime's type (size_t)
- In Kernel constructor, instead of using memset which corrupts std::string, specifically set default workGroupInfo struct's variables
Also fixed wavesPerSimdHint to use size_t to match runtime.
Updated CLAssumptionCheck.cpp since aclMetadata structure was modified.
Note: This is the runtime counterpart to submitted CL#1204512. (Post Review#8808, SWDEV-79695)
Affected files ...
... //depot/stg/opencl/drivers/opencl/compiler/legacy-lib/include/v0_8/aclStructs.h#5 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/include/v0_8/aclStructs.h#22 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/device.hpp#260 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpukernel.cpp#308 edit
... //depot/stg/opencl/drivers/opencl/tests/ocltst/module/complib/CLAssumptionCheck.cpp#48 edit
SWDEV-77584 - Compiler Lib: Preparations for enabling HSAIL on OpenCL 1.2 by default. Adding -legacy and -binary_is_spirv.
-legacy option will be used for forcing AMDIL path after switching HSAIL by default for OpenCL.
-binary_is_spirv option will be used for indicating that the binary is constructed from SPIRV.
[Testing] pre-checkin:
http://ocltc.amd.com:8111/viewModification.html?modId=61541&personal=true&buildTypeId=&tab=vcsModificationBuilds&show_all_builds=true
[Reviewer] Stanislav Mekhanoshin
http://ocltc.amd.com/reviews/r/8850
Affected files ...
... //depot/stg/opencl/drivers/opencl/compiler/legacy-lib/utils/OPTIONS.def#4 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/utils/OPTIONS.def#132 edit
SWDEV-80261 - Enable dump stack trace in debug build when assert/abort/segfault to facilitate debugging.
It is useful to see the stack trace when program assert(), especially in teamcity when some issues are not reproducible locally. This change enables that.
Only enabled for debug build.
Affected files ...
... //depot/stg/opencl/drivers/opencl/compiler/legacy-lib/backends/common/v0_8/if_acl.cpp#6 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/common/v0_8/if_acl.cpp#83 edit
SWDEV-79695 - Checkin again after fixed build issue with ocltst changes. Merged all changes in compiler lib to legacy-lib.
HSAIL Metadata Workgroup Size Hint and Vec Type Hint added to HSAIL
HSAIL does not handle kernel attributes for work_group_size_hint or vec_type_hint.
Adding these two kernel attributes to metadata requires multiple changes:
HSAIL: Added parsing functions to HSAILParseMetadata.cpp, and similar files
Properly translates to .hsail files as 'wsh' and 'vth'
MDParser: Flex scanner now reads new hsail metadata, 'wsh' and 'vth'
Acl_metadata: added the two new metadata
Uint32_t wsh[3]; // Added case: RT_WORK_GROUP_SIZE_HINT
Char *vth; // Added case: RT_VEC_TYPE_HINT
Since vth is std::string, it was required to serialize, and then de-serialize for aclMetadata
Affected files ...
... //depot/stg/opencl/drivers/opencl/compiler/legacy-lib/backends/common/v0_8/if_acl.cpp#5 edit
... //depot/stg/opencl/drivers/opencl/compiler/legacy-lib/backends/gpu/MDParser/AMDILMDInterface.h#3 integrate
... //depot/stg/opencl/drivers/opencl/compiler/legacy-lib/backends/gpu/MDParser/AMDILMDParser.l#4 integrate
... //depot/stg/opencl/drivers/opencl/compiler/legacy-lib/backends/gpu/MDParser/AMDILMDTypes.cpp#3 integrate
... //depot/stg/opencl/drivers/opencl/compiler/legacy-lib/backends/gpu/MDParser/lex.yy.cpp#4 edit
... //depot/stg/opencl/drivers/opencl/compiler/legacy-lib/backends/gpu/metadata.cpp#4 integrate
... //depot/stg/opencl/drivers/opencl/compiler/legacy-lib/include/v0_8/aclEnums.h#4 integrate
... //depot/stg/opencl/drivers/opencl/compiler/legacy-lib/include/v0_8/aclStructs.h#4 integrate
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/common/v0_8/if_acl.cpp#81 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/gpu/MDParser/AMDILMDInterface.h#6 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/gpu/MDParser/AMDILMDParser.l#7 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/gpu/MDParser/AMDILMDTypes.cpp#6 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/gpu/MDParser/lex.yy.cpp#8 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/gpu/metadata.cpp#12 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/include/v0_8/aclEnums.h#26 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/include/v0_8/aclStructs.h#21 edit
... //depot/stg/opencl/drivers/opencl/compiler/llvm/lib/Target/HSAIL/HSAILKernel.h#15 edit
... //depot/stg/opencl/drivers/opencl/compiler/llvm/lib/Target/HSAIL/HSAILKernelManager.cpp#40 edit
... //depot/stg/opencl/drivers/opencl/compiler/llvm/lib/Target/HSAIL/HSAILModuleInfo.cpp#18 edit
... //depot/stg/opencl/drivers/opencl/compiler/llvm/lib/Target/HSAIL/HSAILParseMetadata.cpp#16 edit
... //depot/stg/opencl/drivers/opencl/tests/ocltst/module/complib/CLAssumptionCheck.cpp#47 edit
... //depot/stg/opencl/drivers/opencl/tests/ocltst/module/complib/CLEnumCheck.cpp#51 edit
SWDEV-79695 - HSAIL Metadata Workgroup Size Hint and Vec Type Hint added to HSAIL
HSAIL does not handle kernel attributes for work_group_size_hint or vec_type_hint.
Adding these two kernel attributes to metadata requires multiple changes:
HSAIL: Added parsing functions to HSAILParseMetadata.cpp, and similar files
Properly translates to .hsail files as 'wsh' and 'vth'
MDParser: Flex scanner now reads new hsail metadata, 'wsh' and 'vth'
Acl_metadata: added the two new metadata
Uint32_t wsh[3]; // Added case: RT_WORK_GROUP_SIZE_HINT
Char *vth; // Added case: RT_VEC_TYPE_HINT
Since vth is std::string, it was required to serialize, and then de-serialize for aclMetadata
TODO: Runtime changes required for the use of these two metadata:
Runtime's gpukernel.cpp requires 4 new aclQueries during HSAILKernel::Init
Runtime changes are showing issues when testing
Affected files ...
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/common/v0_8/if_acl.cpp#79 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/gpu/MDParser/AMDILMDInterface.h#4 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/gpu/MDParser/AMDILMDParser.l#5 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/gpu/MDParser/AMDILMDTypes.cpp#4 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/gpu/MDParser/lex.yy.cpp#6 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/gpu/metadata.cpp#10 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/include/v0_8/aclEnums.h#24 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/include/v0_8/aclStructs.h#19 edit
... //depot/stg/opencl/drivers/opencl/compiler/llvm/lib/Target/HSAIL/HSAILKernel.h#13 edit
... //depot/stg/opencl/drivers/opencl/compiler/llvm/lib/Target/HSAIL/HSAILKernelManager.cpp#38 edit
... //depot/stg/opencl/drivers/opencl/compiler/llvm/lib/Target/HSAIL/HSAILModuleInfo.cpp#16 edit
... //depot/stg/opencl/drivers/opencl/compiler/llvm/lib/Target/HSAIL/HSAILParseMetadata.cpp#14 edit
... //depot/stg/opencl/drivers/opencl/tests/ocltst/module/complib/CLAssumptionCheck.cpp#45 edit
... //depot/stg/opencl/drivers/opencl/tests/ocltst/module/complib/CLEnumCheck.cpp#49 edit
SWDEV-77174 - Change compiler lib def and sc lib def to be consistent.
SC interface depends on some compile options which need to be consistent between compiler library and SC.
This change will add the SC interface dependent build options to opencldefs so that they are shared between compiler lib def and sc lib def.
Both compilier lib def and sc lib def will include scinterfacedefs, which will generate consistent compile options required by sc interface based on variables defined in opencldefs.
Affected files ...
... //depot/stg/opencl/drivers/opencl/compiler/lib/complibdefs#45 edit
... //depot/stg/opencl/drivers/opencl/opencldefs#163 edit
SWDEV-2 - Change OpenCL version number from 1898 to 1899.
Affected files ...
... //depot/stg/opencl/drivers/opencl/runtime/utils/versions.hpp#1645 edit
SWDEV-77584 - HSA HLC: fixed reflection metadata generation on HSAIL OCL 1.2 path
We are producing 6 extra arguments, but metadata was produced only for 3.
Removed KE_OCL12_NUM_ARGS define to avoid confusion.
Testing: smoke, precheckin
Reviewed by Yaxun Liu
Affected files ...
... //depot/stg/opencl/drivers/opencl/compiler/llvm/include/llvm/AMDOpenCLKernenv.h#4 edit
... //depot/stg/opencl/drivers/opencl/compiler/llvm/lib/Transforms/Scalar/AMDInsertOpenCLKernenv.cpp#10 edit
SWDEV-77164 - Remove libelf differences from original elftoolchain. These erroneously make ELF_C_RDWR not to load existing section headers.
Testing: pre-checkin
Affected files ...
... //depot/stg/opencl/drivers/opencl/compiler/lib/loaders/elf/utils/libelf/elf_scn.c#4 edit
ECR #304775 - Modify caching library code to be used by HSAIL runtime
1. Remove dependencies on shader compiler version, amd::Os and amd::option
2. Let version be one the of input
3. Change all prefix "Kernel" to prefix "String", e.g., class name is modified from KernelCache to StringCache, etc.
Affected files ...
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/common/cache.cpp#5 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/common/cache.hpp#5 edit
... //depot/stg/opencl/drivers/opencl/compiler/tools/caching/cache.cpp#1 branch
... //depot/stg/opencl/drivers/opencl/compiler/tools/caching/cache.hpp#1 branch
ECR #333753 - Compiler Lib: Bug 10985 - Print compiler options as comment in .cl file when dumping using -save-temps
Affects all targets.
Also fixes rare problem with dumping cl as a raw binary.
Testing: pre check-in
Reviewers: Brian Sumner, Nikolay Haustov, Matthew Arsenault
Affected files ...
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/common/frontend.cpp#36 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/common/frontend.hpp#10 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/common/frontend_clang.cpp#23 edit