P4 to Git Change 1273450 by smekhano@stas-rampitec-hsa on 2016/05/26 14:04:49
SWDEV-93545 - HSA HLC: target option interface between complib and BE and denorm control refactoring Global variables and associated options to control target GPU for optimizations and fp32 denorm support are removed. Instead standard llvm -mcpu=<cpu> is used to pass chip family name and fp32 denorm is turned into a subtarget feature. Subtarget feature can be set for llc as standard -mattr=+fp32-denormals and corresponding code to pass feature string to the BE is added to the compiler lib, mimicing what we used to have for AMDIL. Device name HSAIL metadata will now reflect an actual GPU family passed to the HSAIL BE instead of "generic". Denorm support can be switched on as a feature bit in the target mapping. It is on starting from VI. However, just switching this bit for a family will not produce denorm supporting code. The option -cl-denorms-are-zero can be used to override this and runtime passes it for configs where CL_FP_DENORM is not reported. Currently CL_FP_DENORM is not reported for any device, however it can be changed with AMD_GPU_FORCE_SINGLE_FP_DENORM environment variable. If set it will be honored only starting from VI as set in the target mapping. Implemented isFMAFasterThanFMulAndFAdd to handle use of v_fma_f32 on GFX9 instead of a direct chip family check. Testing: smoke, precheckin Reviewed by Evgeny Mankov Affected files ... ... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/common/codegen.cpp#70 edit ... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/common/linker.cpp#146 edit ... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/common/opt_level.cpp#30 edit ... //depot/stg/opencl/drivers/opencl/compiler/lib/utils/v0_8/libUtils.cpp#18 edit ... //depot/stg/opencl/drivers/opencl/compiler/lib/utils/v0_8/libUtils.h#27 edit ... //depot/stg/opencl/drivers/opencl/compiler/lib/utils/v0_8/target_mappings.h#42 edit ... //depot/stg/opencl/drivers/opencl/compiler/lib/utils/v0_8/target_mappings_hsail.h#32 edit ... //depot/stg/opencl/drivers/opencl/compiler/lib/utils/v0_8/target_mappings_hsail64.h#27 edit ... //depot/stg/opencl/drivers/opencl/compiler/llvm/lib/Target/HSAIL/BRIGAsmPrinter.cpp#155 edit ... //depot/stg/opencl/drivers/opencl/compiler/llvm/lib/Target/HSAIL/BRIGAsmPrinter.h#69 edit ... //depot/stg/opencl/drivers/opencl/compiler/llvm/lib/Target/HSAIL/HSAIL.td#11 edit ... //depot/stg/opencl/drivers/opencl/compiler/llvm/lib/Target/HSAIL/HSAILISelDAGToDAG.cpp#71 edit ... //depot/stg/opencl/drivers/opencl/compiler/llvm/lib/Target/HSAIL/HSAILISelLowering.cpp#116 edit ... //depot/stg/opencl/drivers/opencl/compiler/llvm/lib/Target/HSAIL/HSAILISelLowering.h#29 edit ... //depot/stg/opencl/drivers/opencl/compiler/llvm/lib/Target/HSAIL/HSAILInstrInfo.cpp#42 edit ... //depot/stg/opencl/drivers/opencl/compiler/llvm/lib/Target/HSAIL/HSAILInstrInfo.h#18 edit ... //depot/stg/opencl/drivers/opencl/compiler/llvm/lib/Target/HSAIL/HSAILInstructions.td#22 edit ... //depot/stg/opencl/drivers/opencl/compiler/llvm/lib/Target/HSAIL/HSAILKernelManager.cpp#55 edit ... //depot/stg/opencl/drivers/opencl/compiler/llvm/lib/Target/HSAIL/HSAILSubtarget.cpp#14 edit ... //depot/stg/opencl/drivers/opencl/compiler/llvm/lib/Target/HSAIL/HSAILSubtarget.h#15 edit ... //depot/stg/opencl/drivers/opencl/compiler/llvm/lib/Target/HSAIL/HSAILTargetMachine.cpp#57 edit ... //depot/stg/opencl/drivers/opencl/tests/hsa/bin/test_driver.pl#29 edit ... //depot/stg/opencl/drivers/opencl/tests/hsa/tlst/llc_opt.tlst#97 edit ... //depot/stg/opencl/drivers/opencl/tests/hsa/tlst/ocl_features.tlst#58 edit
This commit is contained in:
1 parent
24b23e3f72
commit
712c0c4009
8 files changed
+91
-97
No files matched your search
@@ -42,10 +42,6 @@
|
||||
using namespace amdcl;
|
||||
using namespace llvm;
|
||||
|
||||
namespace llvm {
|
||||
extern int HsailOptimizeFor;
|
||||
}
|
||||
|
||||
//!--------------------------------------------------------------------------!//
|
||||
// JIT Memory manager
|
||||
//!--------------------------------------------------------------------------!//
|
||||
@@ -499,72 +495,33 @@ llvmCodeGen(
|
||||
TheTriple.setArch(Type);
|
||||
|
||||
// Package up features to be passed to target/subtarget
|
||||
std::string FeatureStr;
|
||||
if ((Type == Triple::amdil || Type == Triple::amdil64) &&
|
||||
targetMap[famID].chip_options) {
|
||||
uint64_t y = targetMap[famID].chip_options;
|
||||
for (uint64_t x = 0; y != 0; y >>= 1, ++x) {
|
||||
if (!(y & 0x1) && (x >= 11 && x < 16)) {
|
||||
continue;
|
||||
}
|
||||
std::string FeatureStr = getFeatureString(binary->target, OptionsObj);
|
||||
|
||||
if ((1 << x) == F_NO_ALIAS) {
|
||||
FeatureStr += (!OptionsObj->oVariables->AssumeAlias ? '+' : '-');
|
||||
} else if ((1 << x) == F_STACK_UAV) {
|
||||
FeatureStr += (OptionsObj->oVariables->UseStackUAV ? '+' : '-');
|
||||
} else if ((1 << x) == F_MACRO_CALL) {
|
||||
FeatureStr += (OptionsObj->oVariables->UseMacroForCall ? '+' : '-');
|
||||
} else if ((1 << x) == F_64BIT_PTR) {
|
||||
FeatureStr += (binary->target.arch_id == aclAMDIL64) ? '+' : '-';
|
||||
} else {
|
||||
FeatureStr += ((y & 0x1) ? '+' : '-');
|
||||
}
|
||||
llvm::TargetOptions targetOptions;
|
||||
targetOptions.NoFramePointerElim = false;
|
||||
targetOptions.StackAlignmentOverride =
|
||||
OptionsObj->oVariables->CPUStackAlignment;
|
||||
// jgolds
|
||||
//targetOptions.EnableEBB = (optimize && OptionsObj->oVariables->CGEBB);
|
||||
//targetOptions.EnableBFO = OptionsObj->oVariables->CGBFO;
|
||||
//targetOptions.NoExcessFPPrecision = !OptionsObj->oVariables->EnableFMA;
|
||||
|
||||
FeatureStr += GPUCodeGenFlagTable[x];
|
||||
if (y != 0x1) {
|
||||
FeatureStr += ',';
|
||||
}
|
||||
}
|
||||
}
|
||||
// Don't allow unsafe optimizations for CPU because the library
|
||||
// contains code that is not safe. See bug 9567.
|
||||
if (isGPU)
|
||||
targetOptions.UnsafeFPMath = OptionsObj->oVariables->UnsafeMathOpt;
|
||||
targetOptions.LessPreciseFPMADOption = OptionsObj->oVariables->MadEnable ||
|
||||
OptionsObj->oVariables->EnableMAD;
|
||||
targetOptions.NoInfsFPMath = OptionsObj->oVariables->FiniteMathOnly;
|
||||
// Need to add a support for OptionsObj->oVariables->NoSignedZeros,
|
||||
targetOptions.NoNaNsFPMath = OptionsObj->oVariables->FiniteMathOnly;
|
||||
|
||||
if (Type == Triple::amdil64) {
|
||||
if (OptionsObj->oVariables->SmallGlobalObjects)
|
||||
FeatureStr += ",+small-global-objects";
|
||||
}
|
||||
|
||||
#if 1 || LLVM_TRUNK_INTEGRATION_CL >= 1463
|
||||
llvm::TargetOptions targetOptions;
|
||||
targetOptions.NoFramePointerElim = false;
|
||||
targetOptions.StackAlignmentOverride =
|
||||
OptionsObj->oVariables->CPUStackAlignment;
|
||||
// jgolds
|
||||
//targetOptions.EnableEBB = (optimize && OptionsObj->oVariables->CGEBB);
|
||||
//targetOptions.EnableBFO = OptionsObj->oVariables->CGBFO;
|
||||
//targetOptions.NoExcessFPPrecision = !OptionsObj->oVariables->EnableFMA;
|
||||
|
||||
// Don't allow unsafe optimizations for CPU because the library
|
||||
// contains code that is not safe. See bug 9567.
|
||||
if (isGPU)
|
||||
targetOptions.UnsafeFPMath = OptionsObj->oVariables->UnsafeMathOpt;
|
||||
targetOptions.LessPreciseFPMADOption = OptionsObj->oVariables->MadEnable ||
|
||||
OptionsObj->oVariables->EnableMAD;
|
||||
targetOptions.NoInfsFPMath = OptionsObj->oVariables->FiniteMathOnly;
|
||||
// Need to add a support for OptionsObj->oVariables->NoSignedZeros,
|
||||
targetOptions.NoNaNsFPMath = OptionsObj->oVariables->FiniteMathOnly;
|
||||
|
||||
std::auto_ptr<TargetMachine>
|
||||
target(TheTarget->createTargetMachine(TheTriple.getTriple(),
|
||||
aclutGetCodegenName(binary->target), FeatureStr, targetOptions,
|
||||
WINDOWS_SWITCH(Reloc::DynamicNoPIC, Reloc::PIC_),
|
||||
CodeModel::Default, OLvl));
|
||||
#else
|
||||
std::auto_ptr<TargetMachine>
|
||||
target(TheTarget->createTargetMachine(TheTriple.getTriple(),
|
||||
aclutGetCodegenName(binary->target), FeatureStr,
|
||||
WINDOWS_SWITCH(Reloc::DynamicNoPIC, Reloc::PIC_),
|
||||
CodeModel::Default));
|
||||
target(TheTarget->createTargetMachine(TheTriple.getTriple(),
|
||||
aclutGetCodegenName(binary->target), FeatureStr, targetOptions,
|
||||
WINDOWS_SWITCH(Reloc::DynamicNoPIC, Reloc::PIC_),
|
||||
CodeModel::Default, OLvl));
|
||||
assert(target.get() && "Could not allocate target machine!");
|
||||
#endif
|
||||
|
||||
// MCJIT(Jan)
|
||||
if(!isGPU && OptionsObj->oVariables->UseJIT) {
|
||||
@@ -618,7 +575,6 @@ llvmCodeGen(
|
||||
|
||||
#ifdef WITH_TARGET_HSAIL
|
||||
if (isHSAILTarget(binary->target)) {
|
||||
llvm::HsailOptimizeFor = getIsaType(aclutGetTargetInfo(binary));
|
||||
if (Target.addPassesToEmitFile(Passes, *Out, TargetMachine::CGFT_ObjectFile, true)) {
|
||||
delete Out;
|
||||
return 1;
|
||||
|
||||
Reference in new issue
Block a user