Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

Conversation

theRoughCode
Copy link
Contributor

@theRoughCode theRoughCode commented Jul 24, 2020

This PR addresses #158 and merges the feature/path_visualizer branch into master. This PR contains the following implementations:

  • ExecutionPathVisualizer JS/TS code + Jest tests
  • Updates IQ# to a version that points to the necessary changes in qsharp-runtime for this feature to work
  • ExecutionPathTracer C# code that hooks on to a simulator and traces out incoming operations and their RuntimeMetadata to generate the corresponding ExecutionPath JSON string
  • New %trace magic command to trigger this visualization process
  • --depth flag for %trace command that allows users to select the render depth of operations
  • Allow users to set the default depth (by default 1) in %config
  • Create DisplayableHtmlElement and DisplayableHtmlElementEncoder to render HTML elements to Jupyter cells

Note: Waiting on #219 to get merged in to this branch as well, but facing issues with writing tests that involve Microsoft.Quantum.Canon.

@theRoughCode theRoughCode self-assigned this Jul 24, 2020
@theRoughCode theRoughCode marked this pull request as draft July 24, 2020 16:27
* Add ExecutionPathTracer to repo

* Add WithExecutionPathTracer extension method to SimulatorBase

* Respond to PR feedback

* Use GetRuntimeMetadata

* Remove ApplyToEach

* Add tests

* Use Newtonsoft instead of System.Text.Json

* Rename ArgStr to DisplayArgs

* Clean up code

* Fix typo in tsconfig

* Fix tests
* Add view magic command

* Rename ExecutionPathEncoder to DisplayableHtmlEncoder

* Add documentation to view command

* Rename %view to %trace

* Fix JSON parsing

* Add TraceMagic test

* Add flag for depth

* Fix nested test

* Empty commit to trigger CI

* Empty commit to trigger CI
* Change depth flag to --depth

* Add parentheses around DisplayArgs if it doesn't have it

* Trigger CI rebuild
* Add tests for operations with operations as arguments

* Build 0.12.2007.2301.

Co-authored-by: Project Collection Build Service (ms-quantum) <>
* Implement isMeasurement flag for execution path operations

* Rename 'controlled' and 'adjoint' to 'isControlled' and 'isAdjoint'
* Allow default depth for %trace to be set in %config

* Fix config magic description
@theRoughCode theRoughCode force-pushed the feature/path_visualizer branch from add8675 to 64fdbd2 Compare July 25, 2020 03:32
@theRoughCode theRoughCode marked this pull request as ready for review July 30, 2020 17:41
@theRoughCode theRoughCode requested review from anpaz, cgranade, ricardo-espinoza and rmshaffer and removed request for anpaz and cgranade July 30, 2020 17:42
@theRoughCode
Copy link
Contributor Author

I'm making this PR open for review because #219 is blocked on me figuring out how to write tests involving ApplyToEach and ForEach without importing Microsoft.Quantum.Canon. That PR can be merged in after this one if it doesn't get done on time.

rmshaffer
rmshaffer previously approved these changes Jul 30, 2020
Copy link
Contributor

@rmshaffer rmshaffer left a comment

Choose a reason for hiding this comment

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

Looks good to me! Didn't look at this in much detail, since I know this has been reviewed in separate PRs that were merged into the feature branch.

@rmshaffer
Copy link
Contributor

One thing that just occurred to me: If you want syntax highlighting for %trace, you should add it here:

regex: String.raw`(%(config|estimate|lsmagic|package|performance|simulate|toffoli|version|who|workspace))\b`,

(I also notice that the new-ish command %lsopen isn't in that list...)

@theRoughCode
Copy link
Contributor Author

@rmshaffer opened a PR for that at #240 :)

* Add composite operation handling

* Add ForEach tests

* Add Canon.qs to Tests.IQSharp.csproj

* Build 0.12.2007.2412.

* Fix ResetAll tests

* Fix tests to allow using Microsoft.Quantum.Canon

* Add newline

* Build 0.12.2007.3008.

* Reformat ExecutionPathTracer stylistically

* Fix iqsharp.sln

* Empty commit to retrigger CI

* Remove dotnet test args

* Fix broken build

* Fix TraceMagic test

* Fix broken build tests

Co-authored-by: Project Collection Build Service (ms-quantum) <>
* Add syntax highlighting for %trace command

* Fix ordering and add lsopen
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants