Skip to content

Commit a2be316

Browse files
dlei6gigcbot
authored andcommitted
Skip add implicit arg metadata when IA=0 to allow for intrinsic usage
When the flag ForceInlineStackCallWithImplArg(IA)=0, we don't need to force inlining, and can use intrinsics to represent implicit arg usage inside stack-called functions. When IA=1, we need to write the implicit arg metadata such that we can detect and inline stack calls that has implicit arguments in its function signature.
1 parent 356d190 commit a2be316

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

IGC/AdaptorCommon/AddImplicitArgs.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -729,12 +729,18 @@ void BuiltinCallGraphAnalysis::writeBackAllIntoMetaData(const ImplicitArgumentDe
729729

730730
for (const auto& A : data.ArgsMaps)
731731
{
732+
// For the implicit args that have GenISAIntrinsic support,
733+
// they do not require to be added as explicit arguments other than in the caller kernel.
732734
ImplicitArg::ArgType argId = A.first;
733-
if (!isEntry && !isStackCall && IGC_IS_FLAG_ENABLED(EnableImplicitArgAsIntrinsic))
735+
if (IGC_IS_FLAG_ENABLED(EnableImplicitArgAsIntrinsic) &&
736+
!isEntry &&
737+
ImplicitArgs::hasIntrinsicSupport(argId))
734738
{
735-
// The following implicit args have GenISAIntrinsic support.
736-
// They do not require to be added as explicit arguments other than in the caller kernel.
737-
if (ImplicitArgs::hasIntrinsicSupport(argId))
739+
// Only write the implicit arg metadata if ForceInlineStackCallWithImplArg=1,
740+
// since it's needed to check implicit arg usage to determine inlining.
741+
// If ForceInlineStackCallWithImplArg=0, we can still use intrinsics to represent
742+
// implicit arg usage inside a stackcalled function.
743+
if (!isStackCall || IGC_IS_FLAG_DISABLED(ForceInlineStackCallWithImplArg))
738744
continue;
739745
}
740746
if (argId < ImplicitArg::ArgType::STRUCT_START)

0 commit comments

Comments
 (0)