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

Passthrough removal is too aggressive #212

Open
arvoelke opened this issue Apr 1, 2019 · 1 comment
Open

Passthrough removal is too aggressive #212

arvoelke opened this issue Apr 1, 2019 · 1 comment
Labels

Comments

@arvoelke
Copy link
Contributor

arvoelke commented Apr 1, 2019

Passthrough nodes should only be removed if they are connecting chip -> chip (according to the convert_passthroughs docstring), that is, any nodes between x and y (not shown).

However, it will remove passthrough nodes that are on host that never connect back to the chip. For example, if those nodes are not probed.

import nengo
import nengo_loihi
from nengo_loihi.passthrough import is_passthrough

import logging
logging.basicConfig(level=logging.INFO)

for remove_passthrough in (True, False):
    with nengo.Network() as model:

        x = nengo.Ensemble(10, 1, label="x")
        y = nengo.Ensemble(10, 1, label="y")
        a = nengo.Node(size_in=1, label="a")
        b = nengo.Node(size_in=1, label="b")
        assert is_passthrough(a)
        assert is_passthrough(b)

        nengo.Connection(x, a)
        nengo.Connection(x, b)
        nengo.Probe(a)

    with nengo_loihi.Simulator(model, remove_passthrough=remove_passthrough) as sim:
        pass

    for obj in (a, b):
        print("remove_passthrough=%s, %s in params=%s" % (
            remove_passthrough, obj.label, obj in sim.sims["host"].model.params))
remove_passthrough=True, a in params=True
remove_passthrough=True, b in params=False
remove_passthrough=False, a in params=True
remove_passthrough=False, b in params=True

The ideal output should be:

remove_passthrough=True, a in params=True
remove_passthrough=True, b in params=True
remove_passthrough=False, a in params=True
remove_passthrough=False, b in params=True

because none of the nodes here are in between chip -> chip connections.

@arvoelke arvoelke added the bug label Apr 1, 2019
arvoelke added a commit that referenced this issue Apr 1, 2019
Outstanding issues for True include: #210, #212, #213
hunse pushed a commit that referenced this issue Apr 3, 2019
Most of the work done by the splitter is now done in the builder.
This should give more clarity and control over the mapping between
pre-build and post-build objects. The `SplitterDirective` class
takes on the organizational tasks of the old `Splitter`, giving
directives to the builder about what should be on- or off-chip.

Also:
- Add unit tests for splitter refactoring.
- Raise `BuildError` if learning objects are on_chip. Fixes #208
  and #209.
- Pass no decoder cache to sub-models. Decoder cache wasn't working
  due to lack of context manager which is normally constructed by
  the top-level network build. Fixes #207.
- Various improvements to passthrough removal, including not removing
  useful passthrough nodes.
  Outstanding issues include: #210, #212, #213
- Handle sliced probes. Closes #205.
- Check that splitter handles sliced probes. Closes #206.
- Test that splitter does not mutate network. Closes #211.
hunse pushed a commit that referenced this issue Apr 3, 2019
Most of the work done by the splitter is now done in the builder.
This should give more clarity and control over the mapping between
pre-build and post-build objects. The `SplitterDirective` class
takes on the organizational tasks of the old `Splitter`, giving
directives to the builder about what should be on- or off-chip.

Also:
- Add unit tests for splitter refactoring.
- Raise `BuildError` if learning objects are on_chip. Fixes #208
  and #209.
- Pass no decoder cache to sub-models. Decoder cache wasn't working
  due to lack of context manager which is normally constructed by
  the top-level network build. Fixes #207.
- Various improvements to passthrough removal, including not removing
  useful passthrough nodes.
  Outstanding issues include: #210, #212, #213
- Handle sliced probes. Closes #205.
- Check that splitter handles sliced probes. Closes #206.
- Test that splitter does not mutate network. Closes #211.
@drasmuss
Copy link
Member

Result of internal discussion: While this would be nice to support, it's difficult because we don't know which parts of the model will be on or off chip until after the passthrough removal completes (since it can change which parts are on/off chip). We could work around that by reworking that whole build pipeline, but it also seems relatively low priority, since a) removing passthroughs on the host side should have relatively little impact, and b) the main use case for nengo-loihi is models where most or all of the model is running on-chip (so adding that feature wouldn't affect them).

So our plan for now is just to update the documentation to clarify that remove-passthroughs removes all passthroughs (on or off chip).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants