Skip to content

Commit

Permalink
Delinting
Browse files Browse the repository at this point in the history
Signed-off-by: Risbud, Sumedh <[email protected]>
  • Loading branch information
srrisbud committed May 15, 2024
1 parent 5342baa commit 05cdd6b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
11 changes: 6 additions & 5 deletions src/lava/magma/compiler/channel_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import itertools
import os
import pickle
import pickle # noqa # nosec
import typing as ty
from collections import defaultdict
from dataclasses import dataclass
Expand Down Expand Up @@ -33,6 +33,7 @@ class Payload:
def lmt_init_id():
return -1


class ChannelMap(dict):
"""The ChannelMap is used by the SubCompilers during compilation to
communicate how they are planning to partition Processes onto their
Expand Down Expand Up @@ -193,15 +194,15 @@ def read_from_cache(self,
src_port_process: AbstractProcess = procname_to_proc_map[
src_port_info[0]]
src: AbstractPort = getattr(src_port_process,
src_port_info[1])
src_port_info[1])
dst_port_process: AbstractProcess = procname_to_proc_map[
dst_port_info[0]]
dst: AbstractPort = getattr(dst_port_process,
dst_port_info[1])
dst_port_info[1])
for port_pair, pld in self.items():
s, d = port_pair.src, port_pair.dst
if s.name == src.name and d.name == dst.name and \
s.process.name == src_port_process.name and \
d.process.name == dst_port_process.name:
d.process.name == dst_port_process.name:
pld.src_port_initializer = payload.src_port_initializer
pld.dst_port_initializer = payload.dst_port_initializer
pld.dst_port_initializer = payload.dst_port_initializer
10 changes: 4 additions & 6 deletions src/lava/magma/compiler/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import itertools
import logging
import os
import pickle
import pickle # noqa # nosec
import typing as ty
from collections import OrderedDict, defaultdict

Expand Down Expand Up @@ -231,9 +231,8 @@ def _compile_proc_groups(
if self._compile_config.get("cache", False):
cache_dir = self._compile_config["cache_dir"]
if os.path.exists(os.path.join(cache_dir, "cache")):
with open(os.path.join(cache_dir, "cache"), "rb") \
as cache_file:
cache_object = pickle.load(cache_file)
with open(os.path.join(cache_dir, "cache"), "rb") as cache_file:
cache_object = pickle.load(cache_file) # noqa # nosec

proc_builders_values = cache_object["procname_to_proc_builder"]
proc_builders = {}
Expand Down Expand Up @@ -283,8 +282,7 @@ def _compile_proc_groups(
# Validate All Processes are Named
procname_to_proc_builder = {}
for p, pb in proc_builders.items():
if p.name in procname_to_proc_builder or \
"Process_" in p.name:
if p.name in procname_to_proc_builder or "Process_" in p.name:
msg = f"Unable to Cache. " \
f"Please give unique names to every process. " \
f"Violation Name: {p.name=}"
Expand Down

0 comments on commit 05cdd6b

Please sign in to comment.