diff options
| author | Sai Praveen Bangaru <31557731+saipraveenb25@users.noreply.github.com> | 2022-10-20 14:22:00 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-10-20 11:22:00 -0700 |
| commit | 1093218d6f0e114eb9fa52d60ca525bf9dd9f98a (patch) | |
| tree | e85158637680f783caaf7f4433a6844398cd8f7b /source/slang/slang-emit.cpp | |
| parent | 576c8407e60143682cd40c68101c6eae8563ca3d (diff) | |
Modified the new type system to support generic differentiable types … (#2413)
* Modified the new type system to support generic differentiable types and added support for differentiating overloaded functions.
* Changed a few asserts to release asserts to avoid unreferenced variable errors
* Fixed a naming issue with TypeWitnessBreadcumb::Flavor::Decl
* Added logic to avoid tracking differentiable types if the module does not use auto-diff or define differentiable types.
* Moved the auto-diff passes to after the specialization step, added a more complex generics test
* Added a generics stress test and fixed AST-side logic. IR side needs some more work
* Added differential getter and setter logic, fixed multiple issues with DifferentiableTypeDictionary, added support for loops and conditions
* Changed differential getters to use pointer types, added getter type checking
* Fixed some bugs related to diff type registration and differential getters
* Removed some superfluous code
* Removed some more unused code.
* Fixed an issue with witness substitution
* Minor fix
Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'source/slang/slang-emit.cpp')
| -rw-r--r-- | source/slang/slang-emit.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/source/slang/slang-emit.cpp b/source/slang/slang-emit.cpp index 4666e80d8..1ea54475e 100644 --- a/source/slang/slang-emit.cpp +++ b/source/slang/slang-emit.cpp @@ -10,6 +10,8 @@ #include "slang-ir-collect-global-uniforms.h" #include "slang-ir-cleanup-void.h" #include "slang-ir-dce.h" +#include "slang-ir-diff-call.h" +#include "slang-ir-diff-jvp.h" #include "slang-ir-dll-export.h" #include "slang-ir-dll-import.h" #include "slang-ir-eliminate-phis.h" @@ -365,6 +367,29 @@ Result linkAndOptimizeIR( lowerReinterpret(targetRequest, irModule, sink); validateIRModuleIfEnabled(codeGenContext, irModule); + + // Inline calls to any functions marked with [__unsafeInlineEarly] again, + // since we may be missing out cases prevented by the functions that we just specialzied. + performMandatoryEarlyInlining(irModule); + + dumpIRIfEnabled(codeGenContext, irModule, "BEFORE-AUTODIFF"); + + // Process higher-order calles to auto-diff passes. + // 1. Generate JVP code wherever necessary. (Linearization or "forward-mode" pass) + processJVPDerivativeMarkers(irModule, sink); + + // 2. Transpose JVP to VJP code wherever needed. (Transposition or "reverse-mode" pass) + // processVJPDerivativeMarkers(module); // Disabled currently. No impl yet. + + // 3. Fill in higher-order invocations with the generated functions. + processDerivativeCalls(irModule); + + dumpIRIfEnabled(codeGenContext, irModule, "AFTER-AUTODIFF"); + + validateIRModuleIfEnabled(codeGenContext, irModule); + + applySparseConditionalConstantPropagation(irModule); + eliminateDeadCode(irModule); // For targets that supports dynamic dispatch, we need to lower the // generics / interface types to ordinary functions and types using |
