Skip to content

Commit bdaea42

Browse files
matborzyszkowskipszymich
authored andcommitted
Manual revert for fp64 emu
Manual revert for fp64 emu
1 parent 3c8d8a5 commit bdaea42

File tree

5 files changed

+21
-39
lines changed

5 files changed

+21
-39
lines changed

IGC/AdaptorCommon/AddImplicitArgs.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -747,25 +747,19 @@ void BuiltinCallGraphAnalysis::combineTwoArgDetail(
747747

748748
void BuiltinCallGraphAnalysis::writeBackAllIntoMetaData(const ImplicitArgumentDetail& data, Function * f)
749749
{
750-
CodeGenContext* pCtx = getAnalysis<CodeGenContextWrapper>().getCodeGenContext();
751750
FunctionInfoMetaDataHandle funcInfo = m_pMdUtils->getFunctionsInfoItem(f);
752751
funcInfo->clearImplicitArgInfoList();
753752

754753
bool isEntry = isEntryFunc(m_pMdUtils, f);
755754

756-
// Check if DP emulation is used and the function uses DP operations. Emulation needs r0 and private_base
757-
// implicit args, so these args have to exist. r0 and private_base args are adding by analysis passes.
758-
bool needImplicitArgs = pCtx->m_hasDPEmu && f->hasFnAttribute("uses-fp64-math");
759-
760755
for (const auto& A : data.ArgsMaps)
761756
{
762757
// For the implicit args that have GenISAIntrinsic support used in subroutines,
763758
// they do not require to be added as explicit arguments other than in the caller kernel.
764759
// Always add metadata for stackcalls to provide info for inlining. They won't be added
765760
// to function argument list.
766-
// For DP emulation the implicit args are required
767761
ImplicitArg::ArgType argId = A.first;
768-
if (!isEntry && ImplicitArgs::hasIntrinsicSupport(argId) && !needImplicitArgs)
762+
if (!isEntry && ImplicitArgs::hasIntrinsicSupport(argId))
769763
{
770764
bool isStackCall = f->hasFnAttribute("visaStackCall");
771765
if (!isStackCall && IGC_IS_FLAG_ENABLED(EnableImplicitArgAsIntrinsic))

IGC/Compiler/CodeGenPublic.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -904,7 +904,6 @@ namespace IGC
904904
bool m_hasLegacyDebugInfo = false;
905905
bool m_hasEmu64BitInsts = false;
906906
bool m_hasDPDivSqrtEmu = false;
907-
bool m_hasDPEmu = false;
908907

909908
// Flag for staged compilation
910909
CG_FLAG_t m_CgFlag = FLAG_CG_ALL_SIMDS;

IGC/Compiler/Optimizer/OpenCLPasses/ErrorCheckPass.cpp

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -104,36 +104,30 @@ void ErrorCheck::visitInstruction(llvm::Instruction& I)
104104
{
105105
auto ctx = getAnalysis<CodeGenContextWrapper>().getCodeGenContext();
106106

107-
// This is the condition that double emulation is used.
108-
if ((IGC_IS_FLAG_ENABLED(ForceDPEmulation) ||
109-
(ctx->m_DriverInfo.NeedFP64(ctx->platform.getPlatformInfo().eProductFamily) && ctx->platform.hasNoFP64Inst())))
110-
{
111-
ctx->m_hasDPEmu = true;
112-
}
113-
114107
bool poisonFP64KernelsEnabled = false;
115108
if (ctx->type == ShaderType::OPENCL_SHADER)
116109
{
117110
OpenCLProgramContext *OCLContext = static_cast<OpenCLProgramContext*>(ctx);
118111
poisonFP64KernelsEnabled = OCLContext->m_InternalOptions.EnableUnsupportedFP64Poisoning;
119112
}
120113

121-
// chcek that has HW DP support and DP emu is disabled
122-
if (!ctx->platform.hasNoFP64Inst() && !ctx->m_hasDPEmu)
123-
return;
124-
125-
// check that input does not use double
126-
const bool usesDouble = isFP64Operation(&I);
127-
if (!usesDouble)
128-
return;
129-
130-
if (!poisonFP64KernelsEnabled && !ctx->m_hasDPEmu) {
131-
ctx->EmitError("Double type is not supported on this platform.", &I);
132-
m_hasError = true;
133-
return;
114+
if (!ctx->m_DriverInfo.NeedFP64(ctx->platform.getPlatformInfo().eProductFamily) && ctx->platform.hasNoFP64Inst()
115+
&& IGC_IS_FLAG_DISABLED(ForceDPEmulation))
116+
{
117+
// check that input does not use double
118+
// For testing purpose, this check is skipped if ForceDPEmulation is on.
119+
const bool usesDouble = isFP64Operation(&I);
120+
if (!usesDouble)
121+
return;
122+
123+
if (!poisonFP64KernelsEnabled) {
124+
ctx->EmitError("Double type is not supported on this platform.", &I);
125+
m_hasError = true;
126+
return;
127+
}
128+
Function *F = I.getParent()->getParent();
129+
F->addFnAttr("uses-fp64-math");
134130
}
135-
Function *F = I.getParent()->getParent();
136-
F->addFnAttr("uses-fp64-math");
137131
}
138132

139133
void ErrorCheck::visitCallInst(CallInst& CI)

IGC/Compiler/Optimizer/OpenCLPasses/PoisonFP64KernelsPass.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,6 @@ bool PoisonFP64Kernels::doInitialization(CallGraph &CG) {
5252
}
5353

5454
bool PoisonFP64Kernels::runOnSCC(CallGraphSCC &SCC) {
55-
auto ctx = getAnalysis<CodeGenContextWrapper>().getCodeGenContext();
56-
// If DP emu is enabled we don't need poison fp64 pass
57-
if (ctx->m_hasDPEmu)
58-
{
59-
return false;
60-
}
61-
6255
bool modified = false;
6356
for (CallGraphNode *Node : SCC) {
6457
Function *F = Node->getFunction();

IGC/Compiler/Optimizer/OpenCLPasses/PrivateMemory/PrivateMemoryUsageAnalysis.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,10 @@ bool PrivateMemoryUsageAnalysis::runOnFunction(Function& F)
124124
CodeGenContext* pCtx = getAnalysis<CodeGenContextWrapper>().getCodeGenContext();
125125
if (!m_hasPrivateMem)
126126
{
127-
// For double emulation, need to add private base (conservative).
128-
if (pCtx->m_hasDPEmu)
127+
CodeGenContext* pCtx = getAnalysis<CodeGenContextWrapper>().getCodeGenContext();
128+
// This is the condition that double emulation is used.
129+
if ((IGC_IS_FLAG_ENABLED(ForceDPEmulation) ||
130+
(pCtx->m_DriverInfo.NeedFP64(pCtx->platform.getPlatformInfo().eProductFamily) && pCtx->platform.hasNoFP64Inst())))
129131
{
130132
m_hasPrivateMem = true;
131133
}

0 commit comments

Comments
 (0)