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

Refactoring py/ports #131

Merged
merged 43 commits into from
Feb 16, 2022
Merged
Show file tree
Hide file tree
Changes from 42 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
f456afb
- Initial enablement of RefPort and VarPorts
PhilippPlank Nov 12, 2021
2d0ec74
- Initial enablement of RefPort and VarPorts
PhilippPlank Nov 12, 2021
25a3a68
- Initial enablement of RefPort and VarPorts
PhilippPlank Nov 12, 2021
a2d1765
- Initial enablement of RefPort and VarPorts
PhilippPlank Nov 12, 2021
74dfdf6
Merge branch 'lava-nc:main' into main
PhilippPlank Nov 15, 2021
1daa9af
- Enablement of RefPorts and VarPorts - addressed change requests fro…
PhilippPlank Nov 16, 2021
5908401
- Enablement of RefPorts and VarPorts - addressed change requests fro…
PhilippPlank Nov 16, 2021
3df2847
- Enablement of RefPorts and VarPorts - addressed change requests fro…
PhilippPlank Nov 16, 2021
9581fae
Merge branch 'lava-nc:main' into main
PhilippPlank Nov 16, 2021
6e4716a
- Enablement of RefPorts and VarPorts - addressed change requests fro…
PhilippPlank Nov 16, 2021
e22def6
Merge branch 'lava-nc:main' into main
PhilippPlank Nov 17, 2021
bd25a80
Merge branch 'lava-nc:main' into main
PhilippPlank Nov 17, 2021
7edeb1f
Merge branch 'lava-nc:main' into main
PhilippPlank Nov 18, 2021
23fb8d7
Merge branch 'lava-nc:main' into main
PhilippPlank Nov 18, 2021
f6686b4
Merge branch 'lava-nc:main' into main
PhilippPlank Nov 23, 2021
86867c2
Merge branch 'lava-nc:main' into main
PhilippPlank Nov 23, 2021
859a195
Merge branch 'lava-nc:main' into main
PhilippPlank Nov 24, 2021
f7007f8
Merge branch 'lava-nc:main' into main
PhilippPlank Nov 25, 2021
0163202
Merge branch 'lava-nc:main' into main
PhilippPlank Nov 25, 2021
bf934ef
modified connection tutorial for release 0.2.0
PhilippPlank Nov 26, 2021
0eef67e
Merge branch 'lava-nc:main' into main
PhilippPlank Nov 26, 2021
f08a35c
fixed typos
PhilippPlank Nov 26, 2021
ceddf2a
Merge branch 'lava-nc:main' into main
PhilippPlank Nov 26, 2021
f798b0a
Merge branch 'lava-nc:main' into main
PhilippPlank Nov 30, 2021
ef19aa7
- refactor creation of ImplicitVarPort into a common function
PhilippPlank Nov 30, 2021
d39bcae
- refactor creation of ImplicitVarPort into a common function
PhilippPlank Nov 30, 2021
7389c4e
- refactor inheritage of PyInPort and PyOutPort to a common parent cl…
PhilippPlank Nov 30, 2021
7943953
Merge branch 'main' into refactor_ports
mgkwill Dec 8, 2021
7cd1b27
Merge branch 'main' into refactor_ports
PhilippPlank Jan 25, 2022
0ef0b43
Merge branch 'main' into refactor_ports
PhilippPlank Feb 1, 2022
e084ac9
Merge branch 'main' into refactor_ports
mgkwill Feb 2, 2022
2b4113c
Merge branch 'lava-nc:main' into refactor_ports
PhilippPlank Feb 7, 2022
e685e01
- Adressed requested changes of PR (rename of class, adding comments)
PhilippPlank Feb 7, 2022
ded1239
- fix unit tests
PhilippPlank Feb 9, 2022
41e7a03
Merge branch 'main' of https://github.com/lava-nc/lava into lava-nc-main
PhilippPlank Feb 9, 2022
3d5b850
Merge branch 'lava-nc-main' into refactor_ports
PhilippPlank Feb 9, 2022
9b98915
Merge branch 'main' into refactor_ports
mgkwill Feb 9, 2022
0a06712
- Adressed requested changes of PR (adding comments)
PhilippPlank Feb 10, 2022
025e39a
- Adressed requested changes of PR (adding comments)
PhilippPlank Feb 10, 2022
e09b783
Merge branch 'lava-nc:main' into refactor_ports
PhilippPlank Feb 10, 2022
5a287be
Merge branch 'main' into refactor_ports
mgkwill Feb 11, 2022
4325bc1
- Adressed requested changes of PR (adding comments)
PhilippPlank Feb 15, 2022
6d306e8
- Adressed requested changes of PR (adding comments)
PhilippPlank Feb 16, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/lava/magma/compiler/builders/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from lava.magma.compiler.utils import VarInitializer, PortInitializer, \
VarPortInitializer
from lava.magma.core.model.py.ports import (
AbstractPyPort,
AbstractPyIOPort,
PyInPort,
PyOutPort,
PyRefPort,
Expand Down Expand Up @@ -340,7 +340,7 @@ def build(self):
for name, p in self.py_ports.items():
# Build PyPort
lt = self._get_lava_type(name)
port_cls = ty.cast(ty.Type[AbstractPyPort], lt.cls)
port_cls = ty.cast(ty.Type[AbstractPyIOPort], lt.cls)
csp_ports = []
if name in self.csp_ports:
csp_ports = self.csp_ports[name]
Expand Down
17 changes: 3 additions & 14 deletions src/lava/magma/compiler/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
from lava.magma.core.model.py.ports import RefVarTypeMapping
from lava.magma.core.model.sub.model import AbstractSubProcessModel
from lava.magma.core.process.ports.ports import AbstractPort, VarPort, \
ImplicitVarPort
ImplicitVarPort, RefPort
from lava.magma.core.process.process import AbstractProcess
from lava.magma.core.resources import CPU, NeuroCore
from lava.magma.core.run_configs import RunConfig
Expand Down Expand Up @@ -217,21 +217,10 @@ def _propagate_var_ports(proc: AbstractProcess):
for vp in proc.var_ports:
v = vp.var.aliased_var
if v is not None:
sub_proc = v.process
# Create an implicit Var port in the sub process
new_vp = ImplicitVarPort(v)
# Propagate name and parent process of Var to VarPort
new_vp.name = "_" + v.name + "_implicit_port"
new_vp.process = sub_proc
# VarPort name could shadow existing attribute
if hasattr(sub_proc, new_vp.name):
raise AssertionError(
"Name of implicit VarPort might conflict"
" with existing attribute.")
setattr(sub_proc, new_vp.name, new_vp)
sub_proc.var_ports.add_members({new_vp.name: new_vp})
imp_vp = RefPort.create_implicit_var_port(v)
# Connect the VarPort to the new VarPort
vp.connect(new_vp)
vp.connect(imp_vp)

def _expand_sub_proc_model(self,
model_cls: ty.Type[AbstractSubProcessModel],
Expand Down