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

Expose channel slack parameter to user interface #529

Merged
merged 10 commits into from
Jan 13, 2023
1 change: 1 addition & 0 deletions src/lava/magma/compiler/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,7 @@ def _create_runtime_service_builder(
model_ids,
loihi_version,
log.level,
compile_config,
**rs_kwargs
)
rs_builders[sync_domain] = rs_builder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ class ChannelBroker(AbstractChannelBroker):

def __init__(self,
board: NxBoard,
compile_config: ty.Optional[ty.Dict[str, ty.Any]] = None,
*args,
**kwargs,):
"""Initialize ChannelBroker with NxBoard.
Expand All @@ -89,6 +90,7 @@ def __init__(self,
"""
super().__init__(*args, **kwargs)
self.board = board
self._compile_config = compile_config
self.has_started: bool = False
# Need to poll for CInPorts
self.c_inports_to_poll: ty.Dict[CInPort, Channel] = {}
Expand Down Expand Up @@ -170,11 +172,13 @@ def _create_channel(self,
channel_name: str,
message_size: int,
number_elements: int,
host_idx: int = 0):
host_idx: int = 0,
slack: int = 16):
return self.board.hosts[host_idx].createChannel(
name=channel_name,
messageSize=message_size,
numElements=number_elements
numElements=number_elements,
slack=slack
)

def create_channel(self,
Expand All @@ -185,6 +189,7 @@ def create_channel(self,
c_builder_idx: int) -> ty.List[Channel]:
channels: ty.List[Channel] = []
MESSAGE_SIZE_IN_C = 128 * 4
channel_slack = self._compile_config.get("slack", 16)
mathisrichter marked this conversation as resolved.
Show resolved Hide resolved
if input_channel:
for csp_port in c_port.csp_ports:
channel_name = generate_channel_name("in_grpc_",
Expand All @@ -194,7 +199,8 @@ def create_channel(self,
channels.append(self._create_channel(
channel_name=channel_name,
message_size=MESSAGE_SIZE_IN_C,
number_elements=csp_port.size
number_elements=csp_port.size,
slack=channel_slack
))
else:
for csp_port in c_port.csp_ports:
Expand Down