From 1167a5066b2c78be1dac1406338a1d9f08071cdf Mon Sep 17 00:00:00 2001 From: cianciosa Date: Mon, 30 Mar 2026 15:23:23 -0400 Subject: [PATCH] Fix issue in cuda context where kernel prefix was would wrong if an output was reduced to a variable. Fix the jit test tolarance. --- graph_framework/cuda_context.hpp | 22 +++++++++++----------- graph_tests/jit_test.cpp | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/graph_framework/cuda_context.hpp b/graph_framework/cuda_context.hpp index 4ed324a..d03b9f4 100644 --- a/graph_framework/cuda_context.hpp +++ b/graph_framework/cuda_context.hpp @@ -756,23 +756,23 @@ namespace gpu { } } for (size_t i = 0, ie = outputs.size(); i < ie; i++) { - if (i == 0) { - if (inputs.size()) { - source_buffer << ", // " - << inputs[inputs.size() - 1]->get_symbol(); + if (!used_args.contains(outputs[i].get())) { + if (i == 0) { + if (inputs.size()) { + source_buffer << ", // " + << inputs[inputs.size() - 1]->get_symbol(); #ifndef USE_INPUT_CACHE #ifdef SHOW_USE_COUNT - source_buffer << " used " - << usage.at(inputs[inputs.size() - 1].get()); + source_buffer << " used " + << usage.at(inputs[inputs.size() - 1].get()); #endif #endif - source_buffer << std::endl; + source_buffer << std::endl; + } + } else { + source_buffer << "," << std::endl; } - } else { - source_buffer << "," << std::endl; - } - if (!used_args.contains(outputs[i].get())) { source_buffer << " "; jit::add_type (source_buffer); source_buffer << " * __restrict__ " diff --git a/graph_tests/jit_test.cpp b/graph_tests/jit_test.cpp index 1d12fa6..7b811b9 100644 --- a/graph_tests/jit_test.cpp +++ b/graph_tests/jit_test.cpp @@ -332,7 +332,7 @@ template void run_math_tests() { auto sin_node = graph::sin(v1); compile ({graph::variable_cast(v1)}, {sin_node}, {}, - sin_node->evaluate().at(0), 0.0); + sin_node->evaluate().at(0), result); auto cos_node = graph::cos(v1); compile ({graph::variable_cast(v1)}, -- GitLab