From fd67133edea5f6df1a1d5c5cc075410054da65bf Mon Sep 17 00:00:00 2001 From: mingrui Date: Tue, 18 Oct 2022 11:04:21 +0800 Subject: [PATCH] [autodiff] Skip gradient kernel compilation for validation kernel --- taichi/transforms/compile_to_offloads.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/taichi/transforms/compile_to_offloads.cpp b/taichi/transforms/compile_to_offloads.cpp index 20988d456578e..f50a0caac9a73 100644 --- a/taichi/transforms/compile_to_offloads.cpp +++ b/taichi/transforms/compile_to_offloads.cpp @@ -109,7 +109,8 @@ void compile_to_offloads(IRNode *ir, irpass::analysis::verify(ir); } - if (autodiff_mode != AutodiffMode::kNone) { + if (autodiff_mode == AutodiffMode::kReverse || + autodiff_mode == AutodiffMode::kForward) { // Remove local atomics here so that we don't have to handle their gradients irpass::demote_atomics(ir, config);