summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-ir-inline.cpp
diff options
context:
space:
mode:
authorArielG-NV <159081215+ArielG-NV@users.noreply.github.com>2024-04-26 01:27:30 -0400
committerGitHub <noreply@github.com>2024-04-26 01:27:30 -0400
commite91bd3b0bdc50f66bfd302ff079c65fba5126474 (patch)
tree73c1ce23a93b895216031e0071e954fa4ff641ea /source/slang/slang-ir-inline.cpp
parentbc7231bbcf32819bed37012db3f01b34b5dd856a (diff)
WIP: Force Inline If RefType (#4005)
* Force Inline if reftype Fixes #3997. If we are using a refType, we now ForceInline. remarks: 1. Modifications were made in slang-ir-glsl-legalize to change how we translate GlobalParam proxy's into GlobalParam. a. We now handle the senario where a globalParam is used in multiple disjoint blocks (like 2 different functions). * try to figure out why CI fails but local works try to inline DispatchMesh, works locally, may fail on CI(?) * try another fix * add task tests + don't allow semi-early task-shader inline Task shader uses DispatchMesh which is a very big 'hack' where we check for the function name and modify the callees in very large ways. This function does inline, but it cannot inline early due to future mangling that this operation requires todo. This is reflected with the `[noRefInline]` modifier. It is a modifier so users may stop mandatory inlines with `__ref` parameter.
Diffstat (limited to 'source/slang/slang-ir-inline.cpp')
-rw-r--r--source/slang/slang-ir-inline.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/source/slang/slang-ir-inline.cpp b/source/slang/slang-ir-inline.cpp
index a5538425f..1e8c1462f 100644
--- a/source/slang/slang-ir-inline.cpp
+++ b/source/slang/slang-ir-inline.cpp
@@ -709,15 +709,15 @@ void performMandatoryEarlyInlining(IRModule* module)
namespace { // anonymous
// Inlines calls that involve String types
-struct StringInliningPass : InliningPassBase
+struct TypeInliningPass : InliningPassBase
{
typedef InliningPassBase Super;
- StringInliningPass(IRModule* module)
+ TypeInliningPass(IRModule* module)
: Super(module)
{}
- bool doesTypeRequireInline(IRType* type)
+ bool doesTypeRequireInline(IRType* type, IRFunc* callee)
{
// TODO(JS):
// I guess there is a question here about what type around string requires
@@ -727,6 +727,12 @@ struct StringInliningPass : InliningPassBase
const auto op = type->getOp();
switch (op)
{
+ case kIROp_RefType:
+ {
+ if(callee->findDecoration<IRNoRefInlineDecoration>())
+ return false;
+ return true;
+ }
case kIROp_StringType:
case kIROp_NativeStringType:
{
@@ -742,7 +748,7 @@ struct StringInliningPass : InliningPassBase
{
auto callee = info.callee;
- if (doesTypeRequireInline(callee->getResultType()))
+ if (doesTypeRequireInline(callee->getResultType(), callee))
{
return true;
}
@@ -750,7 +756,7 @@ struct StringInliningPass : InliningPassBase
const auto count = Count(callee->getParamCount());
for (Index i = 0; i < count; ++i)
{
- if (doesTypeRequireInline(callee->getParamType(UInt(i))))
+ if (doesTypeRequireInline(callee->getParamType(UInt(i)), callee))
{
return true;
}
@@ -762,7 +768,7 @@ struct StringInliningPass : InliningPassBase
} // anonymous
-Result performStringInlining(IRModule* module, DiagnosticSink* sink)
+Result performTypeInlining(IRModule* module, DiagnosticSink* sink)
{
SLANG_UNUSED(sink);
@@ -780,7 +786,7 @@ Result performStringInlining(IRModule* module, DiagnosticSink* sink)
//
while(true)
{
- StringInliningPass pass(module);
+ TypeInliningPass pass(module);
if (pass.considerAllCallSites())
{
// If there was a change try inlining again