From 67c91b8a7e3348b9009aeadedcb65165b246a06d Mon Sep 17 00:00:00 2001 From: yashward Date: Thu, 28 Jul 2022 13:03:54 -0700 Subject: [PATCH 1/3] Fixed the issue with the sync domain of hierarichal process --- src/lava/magma/compiler/compiler.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/lava/magma/compiler/compiler.py b/src/lava/magma/compiler/compiler.py index a0add53de..a2a070751 100644 --- a/src/lava/magma/compiler/compiler.py +++ b/src/lava/magma/compiler/compiler.py @@ -614,8 +614,15 @@ def _create_sync_domains( # Add process to existing or new default sync domain if not part # of custom sync domain + # TODO: This will only work if c and ncc process end up on same sync domain and python in different + # TODO: In future if we have CProcess running with Python on same node, this will fail. + default_py_sd_name = proto.__name__ + "_PY" + "_SyncDomain" + default_c_nc_sd_name = proto.__name__ + "_NC" + "_SyncDomain" if p not in proc_to_domain_map: - default_sd_name = proto.__name__ + "_SyncDomain" + if issubclass(pm, AbstractPyProcessModel): + default_sd_name = default_py_sd_name + else: + default_sd_name = default_c_nc_sd_name if default_sd_name in sync_domains: # Default sync domain for current protocol already exists sd = sync_domains[default_sd_name] From 2787e9d3a9a3562c08b3419a424ec8682651acba Mon Sep 17 00:00:00 2001 From: yashward Date: Thu, 28 Jul 2022 13:10:30 -0700 Subject: [PATCH 2/3] Fixed lint issue --- src/lava/magma/compiler/compiler.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lava/magma/compiler/compiler.py b/src/lava/magma/compiler/compiler.py index a2a070751..1dc06bca8 100644 --- a/src/lava/magma/compiler/compiler.py +++ b/src/lava/magma/compiler/compiler.py @@ -614,8 +614,9 @@ def _create_sync_domains( # Add process to existing or new default sync domain if not part # of custom sync domain - # TODO: This will only work if c and ncc process end up on same sync domain and python in different - # TODO: In future if we have CProcess running with Python on same node, this will fail. + # TODO: This will only work if c and ncc process end up on same + # sync domain and python in different. In future, if we have + # CProcess running with Python on same node, this will fail. default_py_sd_name = proto.__name__ + "_PY" + "_SyncDomain" default_c_nc_sd_name = proto.__name__ + "_NC" + "_SyncDomain" if p not in proc_to_domain_map: From 1da30b1e471c047d318a3740b46d95223c071634 Mon Sep 17 00:00:00 2001 From: yashward Date: Thu, 28 Jul 2022 14:51:44 -0700 Subject: [PATCH 3/3] Changed the implementation of splitting of sync domain --- src/lava/magma/compiler/compiler.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/lava/magma/compiler/compiler.py b/src/lava/magma/compiler/compiler.py index 1dc06bca8..a35934850 100644 --- a/src/lava/magma/compiler/compiler.py +++ b/src/lava/magma/compiler/compiler.py @@ -614,16 +614,10 @@ def _create_sync_domains( # Add process to existing or new default sync domain if not part # of custom sync domain - # TODO: This will only work if c and ncc process end up on same - # sync domain and python in different. In future, if we have - # CProcess running with Python on same node, this will fail. - default_py_sd_name = proto.__name__ + "_PY" + "_SyncDomain" - default_c_nc_sd_name = proto.__name__ + "_NC" + "_SyncDomain" if p not in proc_to_domain_map: - if issubclass(pm, AbstractPyProcessModel): - default_sd_name = default_py_sd_name - else: - default_sd_name = default_c_nc_sd_name + default_sd_name = proto.__name__ + "_SyncDomain" + if not issubclass(pm, AbstractPyProcessModel): + default_sd_name = proto.__name__ + "_Nc_C" + "_SyncDomain" if default_sd_name in sync_domains: # Default sync domain for current protocol already exists sd = sync_domains[default_sd_name]