From c6680f196067647918d8493d0dff34796a8fa750 Mon Sep 17 00:00:00 2001 From: Ezekiel Warren Date: Fri, 31 May 2024 16:24:16 -0700 Subject: [PATCH 1/2] feat: respect parallel system parameter feat: new parallel value meaning --- rt_entt_codegen/shared/parallel.cc | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/rt_entt_codegen/shared/parallel.cc b/rt_entt_codegen/shared/parallel.cc index 477202d..6b116df 100644 --- a/rt_entt_codegen/shared/parallel.cc +++ b/rt_entt_codegen/shared/parallel.cc @@ -178,6 +178,25 @@ auto ecsact::rt_entt_codegen::parallel::can_entities_parallel( return true; } +/** + * Quick check to see if a system should run independently regardless of it's + * system capbilities. + */ +static auto should_run_independently(ecsact_system_like_id id) -> bool { + // User has explicitly marked a system as not parallel; respect that. + if(ecsact_meta_get_system_parallel_execution(id) == ECSACT_PARA_EXEC_DENY) { + return true; + } + + // Generator systems increase storage so they may not run in parallel with + // other systems. + if(!ecsact::meta::get_system_generates_ids(id).empty()) { + return true; + } + + return false; +} + static auto loop_iterator( const std::vector& system_list, const std::vector::iterator begin, @@ -190,10 +209,8 @@ static auto loop_iterator( for(auto iterator = begin; iterator != system_list.end(); iterator++) { auto sys_like_id = *iterator; - auto capabilities = ecsact::meta::system_capabilities(sys_like_id); - auto generate_ids = ecsact::meta::get_system_generates_ids(sys_like_id); - if(!generate_ids.empty()) { + if(should_run_independently(sys_like_id)) { if(!parallel_system_list.empty()) { parallel_system_cluster.push_back(parallel_system_list); } @@ -209,8 +226,8 @@ static auto loop_iterator( return; } - std::set child_unsafe_comps{}; - + auto capabilities = ecsact::meta::system_capabilities(sys_like_id); + auto child_unsafe_comps = std::set{}; auto child_systems = ecsact::meta::get_child_system_ids(sys_like_id); for(auto child_sys_id : child_systems) { From fd95cd952ca67d247f4b0980f48ddecb12b09c28 Mon Sep 17 00:00:00 2001 From: Ezekiel Warren Date: Tue, 2 Jul 2024 13:30:23 -0700 Subject: [PATCH 2/2] fix: wrong enum value --- rt_entt_codegen/shared/parallel.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/rt_entt_codegen/shared/parallel.cc b/rt_entt_codegen/shared/parallel.cc index 6b116df..3b68f4a 100644 --- a/rt_entt_codegen/shared/parallel.cc +++ b/rt_entt_codegen/shared/parallel.cc @@ -4,7 +4,6 @@ #include #include #include - #include "ecsact/lang-support/lang-cc.hh" #include "rt_entt_codegen/shared/system_variant.hh" #include "system_variant.hh" @@ -184,7 +183,7 @@ auto ecsact::rt_entt_codegen::parallel::can_entities_parallel( */ static auto should_run_independently(ecsact_system_like_id id) -> bool { // User has explicitly marked a system as not parallel; respect that. - if(ecsact_meta_get_system_parallel_execution(id) == ECSACT_PARA_EXEC_DENY) { + if(ecsact_meta_get_system_parallel_execution(id) == ECSACT_PAR_EXEC_DENY) { return true; }