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

Transpiler to support advanced functionality #824

Closed
wants to merge 116 commits into from

Conversation

1ucian0
Copy link
Member

@1ucian0 1ucian0 commented Aug 24, 2018

Fix #825

Summary

The current transpiler is very basic and does not implement several of the discussed ideas. This PR tries to be an implementation of them. See details in #825

Copy link
Contributor

@delapuente delapuente left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new revision removes a lot of the previous coupling and we are ready to move forward. I've left some non-blocking comments but we can merge and polish in the future. Just remember to open issues for tracking the issues you find most important.

if isinstance(value, Hashable):
arguments.append((name, type(value), value))
else:
arguments.append((name, type(value), str(value)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking but perhaps we should raise and enforce you use hashable parameters. Don't know.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should allow non-hashable params, at least for now. Chanching str to repr in 400be85

**kwargs: kwargs to normalize

Returns:
Tuple: normalized (args, kwargs)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking, can we indicate the type (list and dict) of args and kwargs?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in d261a96

'max_iteration': max_iteration}

# Default controllers
FlowController.add_flow_controller('condition', ConditionalController)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should not be module-level code? It is weird to register and re-register each time there we instantiate a new pass manage.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in e08e230.

super().__init__(passes, options, **partial_controller)

def __iter__(self):
iteration = 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking although I think this is more readable as follows (at least, it avoids the infinite look and make it clear reaching the max_iteration is something bad):

for iteration in range(self.max_iteration):
  for pass_ in self.passes
    yield pass_

  if not self.do_while():
    return

raise TranspileError(...)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much better. Fixed in 4e7d862

qiskit/transpiler/_passmanager.py Show resolved Hide resolved
@delapuente
Copy link
Contributor

@1ucian0, defore merging, can we squash the 111 commits into 1 and provide a meaningful description for the commit?

@1ucian0
Copy link
Member Author

1ucian0 commented Oct 8, 2018

"meaningful description":

The main goal of Qiskit Terra's transpiler is to provide an extensible infrastructure of pluggable passes that allows flexibility in customizing the compilation pipeline through the creation and combination of new passes. Includes:
- Pass manager.
- Dependency control.
- Pass scheduling.
- Control Flow modules.
More info in `qiskit/transpiler/README.md`

@delapuente
Copy link
Contributor

Merged in #1060

@delapuente delapuente closed this Oct 9, 2018
@1ucian0 1ucian0 deleted the transpiler branch October 11, 2018 12:25
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

Successfully merging this pull request may close these issues.

4 participants