summaryrefslogtreecommitdiff
path: root/source/slang/slang-emit.cpp
diff options
context:
space:
mode:
authorEllie Hermaszewska <ellieh@nvidia.com>2023-05-13 06:33:26 +0800
committerGitHub <noreply@github.com>2023-05-12 15:33:26 -0700
commit65103bc9a0c72117d3c9410e361947cdd568ae55 (patch)
tree9dcb3dea5082d12366e078b3c7b62faa89ef5c73 /source/slang/slang-emit.cpp
parent332f60c19336252d907b83882aa70665ca93a9d2 (diff)
Fusion pass for saturated_cooperation (#2874)
* Fusion pass for saturated_cooperation * simplify assert * regenerate vs projects * missing test output files * rename shadowing variable to appease msvc * Fuse calls to sat_coop with differing inputs * formatting * add cpu test for hof simple * Make higher-order functions into compute comparison tests * comment tests * remove redundant test * Add test to confirm inlining in sat_coop fuse * Add clarifying comment for sat coop fusing * Add KnownBuiltin decoration * s/CanUseFuncSignature/TypesFullyResolved for higher order function checking * Add TODO * spelling * Correct detection of sat_coop calls * Disable tests which are unsupported on testing infra
Diffstat (limited to 'source/slang/slang-emit.cpp')
-rw-r--r--source/slang/slang-emit.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/source/slang/slang-emit.cpp b/source/slang/slang-emit.cpp
index 8a04e5cc8..071ea9639 100644
--- a/source/slang/slang-emit.cpp
+++ b/source/slang/slang-emit.cpp
@@ -21,6 +21,7 @@
#include "slang-ir-entry-point-raw-ptr-params.h"
#include "slang-ir-explicit-global-context.h"
#include "slang-ir-explicit-global-init.h"
+#include "slang-ir-fuse-satcoop.h"
#include "slang-ir-glsl-legalize.h"
#include "slang-ir-insts.h"
#include "slang-ir-inline.h"
@@ -350,6 +351,11 @@ Result linkAndOptimizeIR(
#endif
validateIRModuleIfEnabled(codeGenContext, irModule);
+ // It's important that this takes place before defunctionalization as we
+ // want to be able to easily discover the cooperate and fallback funcitons
+ // being passed to saturated_cooperation
+ fuseCallsToSaturatedCooperation(irModule);
+
// Next, we need to ensure that the code we emit for
// the target doesn't contain any operations that would
// be illegal on the target platform. For example,
@@ -397,6 +403,12 @@ Result linkAndOptimizeIR(
return SLANG_FAIL;
}
+ // Few of our targets support higher order functions, and
+ // we don't have the backend code to emit higher order functions for those
+ // which do.
+ // Specialize away these parameters
+ // TODO: We should implement a proper defunctionalization pass
+ changed |= specializeHigherOrderParameters(codeGenContext, irModule);
dumpIRIfEnabled(codeGenContext, irModule, "BEFORE-AUTODIFF");
enableIRValidationAtInsert();
@@ -617,13 +629,6 @@ Result linkAndOptimizeIR(
break;
}
- // Few of our targets support higher order functions, and
- // we don't have the backend code to emit higher order functions for those
- // which do.
- // Specialize away these parameters
- // TODO: We should implement a proper defunctionalization pass
- specializeHigherOrderParameters(codeGenContext, irModule);
-
// For all targets, we translate load/store operations
// of aggregate types from/to byte-address buffers into
// stores of individual scalar or vector values.