question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Track adding control flow passes for optimization level 1

See original GitHub issue

What should we add?

This issue is to track the target set of passes to enable control flow handling for transpiler optimization_level=1.

  • SetLayout (no change)
  • TrivialLayout (no change)
  • DenseLayout (#8742)
  • EnlargeWithAncilla (no change)
  • FullAncillaAllocation (no change)
  • ApplyLayout (no change)
  • VF2Layout (#8804)
  • VF2PostLayout (#8804)
  • CheckMap (#8793 )
  • CheckGateDirection (#8822)
  • GateDirection (#8822)
  • StochasticSwap (#8418)
  • ContainsInstruction (#8763)
  • GatesInBasis (#8823)
  • UnitarySynthesis (#8565 )
  • Unroll3qOrMore (#8752 )
  • UnrollCustomDefinitions (#8752)
  • BasisTranslator(#7808)
  • BarrierBeforeFinalMeasurements (no change)
  • Depth (#8763)
  • FixedPoint (no changes)
  • Size (#8763)
  • Optimize1qGatesDecomposition (#8766)
  • CXCancellation (#8752)
  • RemoveResetInZeroState (no change required)

We also need to update the preset pass managers (esp level 1) to suitably modify the defaults / reject scheduling_method != None if a given circuit has control flow:

  • Update preset pass managers (#8830)

Time permitting:

  • SabreSwap
  • SabreLayout
  • Layout2qDistance - we elected to swap the O1 PM to use CheckMap instead, to avoid adding the questionable “weighting” of control-flow blocks to another pass (#8733)

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
jakelishmancommented, Sep 12, 2022

I’ll handle all the trivial passes in a PR that I’ll post tomorrow.

Just a note: BarrierBeforeFinalMeasure doesn’t need to recurse in, because any measurements in a control-flow block can’t be final measurements by the original definition. ResetInZeroState can’t trivially recurse, because the start of a block cannot be assumed to be zero.

0reactions
jakelishmancommented, Sep 30, 2022

I found some more transpiler passes while trying to update the preset pass managers, so I’ve added them to the list.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Optimize Options (Using the GNU Compiler Collection (GCC))
This option enables simple constant folding optimizations at all optimization levels. In addition, other optimization passes in GCC use this flag to control...
Read more >
Optimization passes
GCC jump optimization pass was implemented using simplistic RTL instruction chain analysis and it disturbed control flow graph completely during optimizing.
Read more >
Control-Flow and Low-Level Optimizations Outline
– Requires that we determine that the loop is entered. Requires that we determine that the loop is entered at least once! Loop...
Read more >
Optimization Compiler Passes Optimizations The Role of the ...
1. Optimization. Before and after generating machine code, devote one or more passes over the program to “improve” code quality. 2. Compiler. Passes....
Read more >
LLVM's Analysis and Transform Passes - Documentation
This pass, only available in opt , prints the control flow graph into a .dot graph, omitting the function bodies. This graph can...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found