qiskit-advocate/qamp-fall-21

Build a timeline debugger for the Qiskit transpiler

Opened this issue · 9 comments

kdk commented

Description

The Qiskit transpiler and PassManager have built-in logging and callback mechanisms to "open the hood" and help users understand what changes are being made to their circuit, at which stage in the process, and why. These tools have also been invaluable in investigating and debuggging issues in the transpiler. However, issues often require writing specialized callback functions which require a deep knowledge of the transpiler internals, limiting the utility of these tools for most Qiskit users.

The goal of this project will be to produce a tool which can automatically, on a call to qiskit.transpile or PassManager.run, generate a widget (ideally compatible across Jupyter Notebooks and JupyterLab) to allow users to step through the sequence of passes run by the transpiler, and see 1) the current state of the circuit (for TransformationPasses and 2) changes made to the PropertySet (by AnalysisPasses).

Mentor/s

Kevin Krsulich (@kdk)
Qiskit-terra core developer

Type of participant

Prior software development experience will be important, though it need not necessarily be in python. Prior experience building jupyter widgets would be ideal.

Number of participants

2+

Deliverable

A commit adding this functionality to Qiskit Terra.

I am quite interested in working on this project!

@EgrettaThula Can you please comment in the issue so that I can assign you?

@HuangJunye,
Sure! I'm definitely interested in contributing to this project.

These are the presentation slides for the October 7 review
#24 Build a timeline debugger for the Qiskit transpiler.pdf

These are the November 11 review reports.

Written Report

November-Checkpoint-#24-timeline-debugger-for-transpiler.pdf

Visual Representation

The following images contain the proposed final design for the timeline debugger. For some initial implementations, please refer to the written report. Design is subject to change by some amount in the final implementation.

1. Description

description-sketch

2. Overview

overview-sketch

3. Main Pass Panel

main-pass-sketch

Thank you for the updates! @TheGupta2012 could you also please provide the short (500 words or less) update on the work you've achieved since Checkpoint 1 via comment here?

Project Update - November 11

Developed two working prototypes for the transpiler timeline debugger which would enable users to see how and what changes are happening while transpiling a single quantum circuit

Finalised Design

  • Our final debugger is being developed as a jupyter widget and consists of three main components :
    • Description of the circuit, backend and transpiler arguments provided during transpilation
    • Transpilation Overview for the final circuit which provides a quick summary of the complete process
    • Main Passes of the transpiler, where each component contains a description of circuit state (depth < 100), properties, logs of pass and documentation.

image

image

image

Features Developed

1. Circuit State diff

  • Incorporated circuit images in debugger as circuit goes through the transpilation process. Allows user to analyse visual diffs of back to back transpilation passes.
  • Our debugger uses the DAG representation of circuit and calculates the Longest Common Subsequence between two successive DAGs to find the visual diffs
  • Users also have the opportunity to download the state and further inspect the circuit diff

image

2. Logs and Docs of Transpiler passes

  • Parsed Logs emitted by each transpiler pass and developed a panel for the pass doc strings.
  • Each log entry is color coded according to level of severity of the log i.e. INFO, WARNING, etc and allows the user to see a greater level of detail during execution
  • Seeing the documentation block allows a user to understand the goal of a particular transpiler pass and every doc string is formatted accordingly to highlight the explanation, arguments and return values of each pass, if any

image

image

3. Circuit Property changes

  • There exist two collapsible headings in which highlight the property set and the circuit properties after each pass
  • The changes in properties are highlighted in the code by changing the color of the property value which has been changed or added to the set
  • This allows users to find which passes are responsible for major changes in the circuits and their property sets

image

Current Work

  • Working on developing the final passes panels and making the debugger efficient in terms of memory and CPU utilisation.
  • Looking for ways to best integrate this widget with the qiskit-terra repository.

Thank you for the updates! @TheGupta2012 could you also please provide the short (500 words or less) update on the work you've achieved since Checkpoint 1 via comment here?

I have also added the implementation images here for quick referencing. Hope this is fine!

These are the presentation slides for the final review :
Timeline Debugger for Transpiler - December checkpoint
This is just a small presentation in addition to our final demo for the project!