Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sender and receiver information in watchdog logs #796

Merged
merged 1 commit into from
Oct 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 34 additions & 8 deletions src/lava/magma/compiler/builders/channel_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,29 @@


class WatchdogEnabledMixin:
SEND = "send"
RECV = "recv"
JOIN = "join"

@staticmethod
def watch(watchdog_manager: WatchdogManager,
queue: Queue,
process: "AbstractProcess",
other_process: "AbstractProcess",
pi: PortInitializer,
other_pi: PortInitializer,
method_type: str) -> Watchdog:
process_cls: str = process.__class__.__name__
port_name: str = pi.name
name: str = f"{process_cls}.{port_name}"
if other_process and other_pi:
other_process_cls: str = other_process.__class__.__name__
other_port_name: str = other_pi.name
other_name: str = f"{other_process_cls}.{other_port_name}"
if method_type is WatchdogEnabledMixin.SEND:
name += f"->{other_name}"
elif method_type is WatchdogEnabledMixin.RECV:
name = f"{other_name}->{name}"
w: Watchdog = watchdog_manager.create_watchdog(queue=queue,
channel_name=name,
method_type=method_type)
Expand All @@ -49,21 +63,33 @@ def create_watchdogs(self,
queues: Queues,
port_initializers: PortInitializers) -> Watchdogs:
src_send_watchdog: Watchdog = self.watch(watchdog_manager,
queues[0], self.src_process,
queues[0],
self.src_process,
self.dst_process,
port_initializers[0],
"send")
port_initializers[1],
WatchdogEnabledMixin.SEND)
src_join_watchdog: Watchdog = self.watch(watchdog_manager,
queues[1], self.src_process,
queues[1],
self.src_process,
self.dst_process,
port_initializers[0],
"join")
port_initializers[1],
WatchdogEnabledMixin.JOIN)
dst_recv_watchdog: Watchdog = self.watch(watchdog_manager,
queues[2], self.dst_process,
queues[2],
self.dst_process,
self.src_process,
port_initializers[1],
"recv")
port_initializers[0],
WatchdogEnabledMixin.RECV)
dst_join_watchdog: Watchdog = self.watch(watchdog_manager,
queues[3], self.dst_process,
queues[3],
self.dst_process,
self.src_process,
port_initializers[1],
"join")
port_initializers[0],
WatchdogEnabledMixin.JOIN)
return (src_send_watchdog, src_join_watchdog,
dst_recv_watchdog, dst_join_watchdog)

Expand Down