From 081e0005049f4e29eb75aae3bf6b62d8ab538305 Mon Sep 17 00:00:00 2001 From: Daniel Wennberg Date: Wed, 4 Sep 2024 09:24:29 -0400 Subject: [PATCH] Suggest workaround in error for overwritten active by ref --- src/rules/customrules.jl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/rules/customrules.jl b/src/rules/customrules.jl index 749ec36cfd..0f77d37a9d 100644 --- a/src/rules/customrules.jl +++ b/src/rules/customrules.jl @@ -136,7 +136,12 @@ function enzyme_custom_setup_args(B, orig::LLVM.CallInst, gutils::GradientUtils, ptr = inbounds_gep!(B, llty, al, [LLVM.ConstantInt(LLVM.IntType(64), 0), LLVM.ConstantInt(LLVM.IntType(32), 0)]) if value_type(val) != eltype(value_type(ptr)) if overwritten[end] - emit_error(B, orig, "Enzyme: active by ref type $Ty is overwritten in application of custom rule for $mi val=$(string(val)) ptr=$(string(ptr))") + emit_error( + B, + orig, + "Enzyme: active by ref type $Ty is overwritten in application of custom rule for $mi val=$(string(val)) ptr=$(string(ptr)). " + * "As a workaround until support for this is added, try passing values as separate arguments rather than as an aggregate of type $Ty.", + ) end if arty == eltype(value_type(val)) val = load!(B, arty, val)