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

newDirectedModule does not return a new version after a pass has been run #797

Open
leonardt opened this issue Oct 2, 2019 · 0 comments

Comments

@leonardt
Copy link
Collaborator

leonardt commented Oct 2, 2019

This code

coreir/src/ir/module.cpp

Lines 54 to 59 in b167247

DirectedModule* Module::newDirectedModule() {
if (!directedModule) {
directedModule = new DirectedModule(this);
}
return directedModule;
}
always returns the first and only directed module that is created. This creates issues for code such as the following (pycoreir):

import coreir
def test_directed_upsample():
    c = coreir.Context()
    context = coreir.Context()
    context.load_library('commonlib')
    top_module = context.load_from_file('./tests/upsample.json')
    print(len(top_module.definition.instances))
    print(len(top_module.directed_module.connections))
    context.run_passes(['rungenerators', 'removebulkconnections',  'flattentypes', 'flatten'])
    top_def = top_module.definition
    print(len(top_def.instances))
    print(len(top_module.directed_module.connections))
    for con in top_module.directed_module.connections:
        print(1)
        src = con.source
        print(2)
        dst = con.sink
        print(3)
        size = con.size
        print(4)

upsample.json.txt

Notice that directed module is invoked before running passes, then invoked after (operating on a stale copy which causes a segfault).

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

No branches or pull requests

1 participant