From 1058f32882ee90d91bddd0409083a3cb325f5181 Mon Sep 17 00:00:00 2001 From: Luc Grosheintz Date: Tue, 29 Oct 2024 13:46:44 +0100 Subject: [PATCH] SIMD only for thread safe code. --- src/codegen/codegen_neuron_cpp_visitor.cpp | 6 ++++++ src/codegen/codegen_neuron_cpp_visitor.hpp | 3 +++ 2 files changed, 9 insertions(+) diff --git a/src/codegen/codegen_neuron_cpp_visitor.cpp b/src/codegen/codegen_neuron_cpp_visitor.cpp index 2dec0c39b..1e0fe92f7 100644 --- a/src/codegen/codegen_neuron_cpp_visitor.cpp +++ b/src/codegen/codegen_neuron_cpp_visitor.cpp @@ -74,6 +74,12 @@ int CodegenNeuronCppVisitor::position_of_int_var(const std::string& name) const } +bool CodegenNeuronCppVisitor::parallel_iteration_condition(BlockType type, + const ast::Block* block) { + return info.thread_safe && CodegenCppVisitor::parallel_iteration_condition(type, block); +} + + /****************************************************************************************/ /* Backend specific routines */ /****************************************************************************************/ diff --git a/src/codegen/codegen_neuron_cpp_visitor.hpp b/src/codegen/codegen_neuron_cpp_visitor.hpp index b98951f94..ea939f10f 100644 --- a/src/codegen/codegen_neuron_cpp_visitor.hpp +++ b/src/codegen/codegen_neuron_cpp_visitor.hpp @@ -147,6 +147,9 @@ class CodegenNeuronCppVisitor: public CodegenCppVisitor { int position_of_int_var(const std::string& name) const override; + bool parallel_iteration_condition(BlockType type, const ast::Block* block) override; + + /****************************************************************************************/ /* Backend specific routines */ /****************************************************************************************/