From 6bb32aa976494466bd6303f8ae6e348b297edb44 Mon Sep 17 00:00:00 2001 From: Sai Praveen Bangaru <31557731+saipraveenb25@users.noreply.github.com> Date: Tue, 27 Aug 2024 21:13:00 -0400 Subject: Adds a warning for using `[PreferRecompute]` on methods that may contain side effects (#4707) * Adds a warning for using prefer-recompute on methods that contain side effects * Rename `SideEffects` -> `SideEffectBehavior` --------- Co-authored-by: Yong He --- source/slang/slang-emit.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'source/slang/slang-emit.cpp') diff --git a/source/slang/slang-emit.cpp b/source/slang/slang-emit.cpp index e91209108..103cd15ab 100644 --- a/source/slang/slang-emit.cpp +++ b/source/slang/slang-emit.cpp @@ -637,6 +637,13 @@ Result linkAndOptimizeIR( default: break; } + + if (requiredLoweringPassSet.autodiff) + { + // Generate warnings for potentially incorrect or badly-performing autodiff patterns. + checkAutodiffPatterns(targetProgram, irModule, sink); + } + // 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, -- cgit v1.2.3