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

Conversation

@troels-im
Copy link
Contributor

@troels-im troels-im commented Nov 1, 2021

This PR introduces the QIR adaptor tool (QAT) to the main repository. This tool allows the user to take a generic QIR and adapt to a specific profile. Through these transformations, the use is able to adapt a generic QIR to a constrained QIR that is more suitable for a specific architecture.

troels-im and others added 30 commits July 30, 2021 07:18
* Initial proposal for a QsPasses structure

* Updating CMake

* Adding CI stuff

* Making CLI interface for CI tasks

* Finishing V1 of CI script with updated clang tidy and format

* Refactoring CI module

* Refactoring

* Removing binary IR

* Updating gitignore

* Creating root tool for performing CI tasks

* Updating documentation

* Refactoring pass

* Preparing analysis module

* Adding a style proposal

* Adding style proposal

* Updating documentation

* Template based pass generator

* Updating template and writing more documentation

* Adding introduction on how to create a pass

* Improving code quality

* Improving code quality

* Adding namespaces to passes

* Adding comments to the source

* Small refactor

* Adding QIR example using opt for optimisation and refactoring library structure

* Adding documentation

* Updating linter and formatter

* Updating code to meet PR comments

* Revising as per PR.
* Initial proposal for a QsPasses structure

* Updating CMake

* Adding CI stuff

* Making CLI interface for CI tasks

* Finishing V1 of CI script with updated clang tidy and format

* Refactoring CI module

* Refactoring

* Removing binary IR

* Updating gitignore

* Creating root tool for performing CI tasks

* Updating documentation

* Refactoring pass

* Preparing analysis module

* Adding a style proposal

* Adding style proposal

* Updating documentation

* Template based pass generator

* Updating template and writing more documentation

* Adding introduction on how to create a pass

* Improving code quality

* Improving code quality

* Adding namespaces to passes

* Adding comments to the source

* Small refactor

* Adding QIR example using opt for optimisation and refactoring library structure

* Adding documentation

* Updating linter and formatter

* Updating code to meet PR comments

* Adding function analysis template

* Update of template

* Adding boiler plate for const size array analysis

* Adding constant allocation identification

* Removing garbage

* Adding slightly harder example

* Updating with additional example

* Adding static analysis for qubit allocation

* Refactoring pass

* More refactoring

* Adding documenation

* CI and style

* Adding documentation as per request

* Minor documentation update

* Adding lit tests

* Finalising expansion pass

* Adding expansion pass to allow allocating arrays statically

* Removing leading % from command line snippets

* Fixing broken things from merge

* Removing garbage
* Adding Python to the CI process

* Creating development script

* Udpating development script

* Disabling Linux for the time being

* Reactivating linux CI

* Removing the need for virtualenv

* Updating linux image

* Updating name of linux build

* Updating name of linux build

* Updating working directory

* Updating scripts

* Fixing linux path and updating clang search function

* Upgrading clang-format to version 11

* Formatting to LLVM 11 toolchain

* Removing visibility check in CMake

* Forcing Clang as compiler

* Removing llvm-toolchain-11

* Improving search for clang tidy

* Extending Clang tidy search

* Fixing apt install

* Fixing apt install

* Refactoring names and updating windows

* Minor Windows CI update

* Improving search for excutables

* Adding Windos debug and OS X CI

* Fixing OS X tests

* Updating links and paths to executables

* Updating OS X build

* Attempting to fix Windows build

* Fixing CMake config

* Attempting to fix Windows path

* Adding message to CMake

* Updating with VCWhere

* Updating CI for Windows

* Disabling CMake install

* Changing to Conda package manager

* Adding conda environment

* Adding conda environment

* Updating the environment

* Updating conda

* Attempting to load LLVM in CMake

* Disbaling Windows CI

* Update build/test.ps1

* Update build/passes-linux.yml

* Update src/Passes/site-packages/TasksCI/toolchain.py
* Adding initial doc

* Updating specs

* Smaller updates

* More thoughts on the QIR mapping to restricted QIR

* Updating proposal

* Updating proposal

* Update src/Passes/docs/base-profile-transformations.md

Co-authored-by: bettinaheim <[email protected]>

* Update src/Passes/docs/base-profile-transformations.md

Co-authored-by: bettinaheim <[email protected]>

* Update src/Passes/docs/base-profile-transformations.md

Co-authored-by: bettinaheim <[email protected]>

* Update src/Passes/docs/base-profile-transformations.md

Co-authored-by: Alan Geller <[email protected]>

* Update src/Passes/docs/base-profile-transformations.md

Co-authored-by: Alan Geller <[email protected]>

* Update src/Passes/docs/base-profile-transformations.md

Co-authored-by: Alan Geller <[email protected]>

* Update src/Passes/docs/base-profile-transformations.md

Co-authored-by: Alan Geller <[email protected]>

Co-authored-by: bettinaheim <[email protected]>
Co-authored-by: Alan Geller <[email protected]>
* Initial proposal for a QsPasses structure

* Updating CMake

* Adding CI stuff

* Making CLI interface for CI tasks

* Finishing V1 of CI script with updated clang tidy and format

* Refactoring CI module

* Refactoring

* Removing binary IR

* Updating gitignore

* Creating root tool for performing CI tasks

* Updating documentation

* Refactoring pass

* Preparing analysis module

* Adding a style proposal

* Adding style proposal

* Updating documentation

* Template based pass generator

* Updating template and writing more documentation

* Adding introduction on how to create a pass

* Improving code quality

* Improving code quality

* Adding namespaces to passes

* Adding comments to the source

* Small refactor

* Adding QIR example using opt for optimisation and refactoring library structure

* Adding documentation

* Updating linter and formatter

* Updating code to meet PR comments

* Adding function analysis template

* Update of template

* Adding boiler plate for const size array analysis

* Adding constant allocation identification

* Removing garbage

* Adding slightly harder example

* Updating with additional example

* Adding static analysis for qubit allocation

* Refactoring pass

* More refactoring

* Adding documenation

* CI and style

* Adding documentation as per request

* Minor documentation update

* Adding lit tests

* Finalising expansion pass

* Adding expansion pass to allow allocating arrays statically

* Removing leading % from command line snippets

* Fixing broken things from merge

* Removing garbage

* WiP replacement pass

* Creating initial tree matching algorithm

* Finishing access analysis

* Implementing the replacements

* Tidying code

* Finalising refactor

* Fixing bug relating to pattern creation

* Intermediate reorganisation

* Finishing refacto

* Updating PoC

* Finishing feasibility

* Improving repository structure and preparing for dual build system support

* Adding QAT commandline template

* Restructuring

* Finalising refactoring phase 1

* Renaming pass to more suitable name

* Updating Python tasks

* Addingn teleportation example

* Fixing include

* Updating replacements

* Finalising positive branching

* Rewriting qubit use analysis

* Updates to make last bit a transformation work

* Migrating ruleset to shared ptr

* Refactoring how to define a QIR profile transformation

* Removing orig files

* Removing garbage files

* Creating prototype QAT

* Preparing profile directory

* Adding profile interface

* Updating CLI

* Fixing profile bug

* Fixing various bugs

* Adding documentation

* Adding additional optimisation

* Updating README

* Correcting mistake

* Removing debug output

* Fixing bug

* Documentation and refactoring

* Refactor location of operands

* More refactor

* Fixing style

* Fixing CI and style

* Deprecating LL tests

* Update src/Passes/README.md

Co-authored-by: Stefan J. Wernli <[email protected]>

* Update src/Passes/Source/Rules/OperandPrototype.cpp

* PR revisions

* Updating README

* Updating with review items

* Updating linux build

* Fixing yaml file

* Removing LLVM 12

* Update src/Passes/Source/Rules/ReplacementRule.hpp

Co-authored-by: bettinaheim <[email protected]>

* Update src/Passes/Source/AllocationManager/AllocationManager.hpp

Co-authored-by: bettinaheim <[email protected]>

* Adding variaous suggestions

* Updating documentation

* Fixing broken link

Co-authored-by: Stefan J. Wernli <[email protected]>
Co-authored-by: bettinaheim <[email protected]>
…icrosoft#1122)

* Simplying adding libraries

* Refactor with initial test structure

* Updating documentation

* Fixing style

* Updating LLVM dependencies

* Fixing CI

* Fixing target name

* Updating CI for mac

* Following log suggestion

* Disabling lit

* Disabling lit

* Fixing broken link

* Introducing name checker for quantum instructions

* Updating style checker

* Updating allocation manager

* Preparing test tools

* Fixing style

* Updating IR builder test component

* Finishing test helper

* Updating style

* Static qubit allocation tests

* Updating tests and documentation

* Updating style

* Fixing CI

* Updating CI

* Updating CI

* Updating Linux CI

* Fixing issues

* Fixing bug

* Making constructor explicit

* Adding test coverage reports

* Changing TODOs

* Changing TODOs

* Updating test suite

* String tests

* Adding results test

* Finishing most of factory tests

* Fixing links

* Incorporating the changes in microsoft#1121

* Updating coverage report

* Attempting to fix CI

* Making submodule shallow

* Working document on qubit allocation analysis

* Updating target
* Removing garbage

* Adding new profile

* Adding module transformation and configurable ruleset

* Adding README

* Enabling passing the call tree

* Preparing traversal for function calls

* Adding constant folding

* Basic branching analysis

* Updating to follow possible branches

* Deleting dead code

* Updating with qubit allocation

* Fixing replication pass

* Fixing qubit array index

* Refacotring pass

* Refactoring module name

* Preparing code deletion

* Deleting legacy passes

* Fixing tests

* Adding name to TODOs

* Fixing tests

* Removing garbage

* Restructuring teleport example

* Refactoring examples

* Formatting

* Removing dead pass code

* Finish examples refactor

* Removing Passes directory

* Deprecating passes templates

* Removing deprecated tests and activating name checking

* Removing outdated documentation

* Removing example IR

* Update src/Passes/Source/ProfilePass/Profile.hpp

Co-authored-by: bettinaheim <[email protected]>

* Update src/Passes/Source/Profiles/BaseProfile.cpp

Co-authored-by: bettinaheim <[email protected]>

* Update src/Passes/Source/Profiles/RuleSetProfile.cpp

Co-authored-by: bettinaheim <[email protected]>

* Update src/Passes/Source/Profiles/BaseProfile.cpp

* Update src/Passes/Source/Profiles/RuleSetProfile.cpp

* Update src/Passes/Source/Rules/Tests/Unit/SingleQubitAllocation.cpp

Co-authored-by: bettinaheim <[email protected]>

Co-authored-by: bettinaheim <[email protected]>
@troels-im troels-im requested a review from kuzminrobin November 5, 2021 12:39
// Licensed under the MIT License.

#include "Llvm/Llvm.hpp"
#include "Rules/Notation/Notation.hpp"
Copy link
Contributor

Choose a reason for hiding this comment

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

Cyclical inclusion between Notation.hpp and Call.ipp. Applicable to a number of headers.

(To me personally the inclusion order tells in which order to read the sources in the unfamiliar code base. Cyclical inclusion somewhat confuses)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This should clearly be fixed.

Copy link
Contributor

@kuzminrobin kuzminrobin left a comment

Choose a reason for hiding this comment

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

Approving.
I have run through the C++ files (.?pp) except for Tests (and I didn't re-run through the files changed during the CR).

In general - very pleasant reading. I liked the code style, layout, naming. Everything looked very reasonable and relatively easy to follow (I don't say I understand all the logic). No any serious flaws found. Rather broad set of C++ features is used, some of which I hardly have experience with.
The code seems to me more advanced and functional than I could have written in the same time frame.
Thank you for this PR!

@troels-im troels-im disabled auto-merge November 6, 2021 08:05
@bettinaheim
Copy link
Contributor

There are still a couple of comments open that should be addressed in a follow up PR. As per offline discussions, merging this with the expectation that there will be a follow up PR addressing these comments.
@troelsfr @kuzminrobin @DmitryVasilevsky

@bettinaheim bettinaheim merged commit c3d82f0 into microsoft:main Nov 8, 2021
cesarzc added a commit that referenced this pull request Nov 16, 2021
* added MSBuild_Logs to gitignore (#1171)

* Command Line Support for Project File Input (#1192)

* Change --inputs to --input (#1210)

* Deprecate new array expression (#956)

* Removing temporary project (#1225)

* Formatter Updates Deprecated Boolean Operator Syntax (#1214)

* Update the documentation found in the Q# Formatter Project (#1203)

* Formatter Updates Deprecated Specialization Declaration Parameters (#1226)

* Adding Sdk integration, and formatting support + code action for syntax updates to the language server (#1207)

* QAT v. 0.1 (#1230)

* Sdk changes to support Qir targets (#1238)

* Quantum Development Kit Telemetry Library (#1199)

Co-authored-by: Sarah Marshall <[email protected]>
Co-authored-by: Scott Carda <[email protected]>

* Allowing to use the LLVM intrinsic readcyclecounter from Q# (#1248)

* Do case-insensitive comparisons for targets names (#1241)

During the build stage of a Q# job submission via the CLI or the stand-alone executable, there is a case sensitive enforcement of target names.

Since this limitation does not exist in the service or in other clients, we're aligning by making the corresponding comparison case insensitive.

* Refactor language server code for extracting symbols from Q# fragments (#1220)

* Start adding SymbolOccurrence module

* Replace SymbolInformation implementation

* Add C# interop for SymbolOccurrence

* Rename SymbolInformation.cs to match class name

* Mark SymbolInformation as obsolete

* Add SymbolOccurrence.fsi

* Add doc comments

* Fix nullable errors with .NET Core 3.1

* Use as instead of is

* Take in fragment instead of file in SymbolOccurrence

* Update todo comments

* Return NS in open directive as UsedVariable

* Use TryGet for SymbolOccurrence C# API

* Statement Kinds Support (#1212)

* Addressing last comments - QAT v0.1 (#1240)

* Type renaming

* Removing redudant setModulePassManager

* Fixing recursion

* Refactoring filenames

* Renaming directory

* Updating names and files

* Formatting

* Fixing include

* Updates for QIR validation (#1250)

* Type renaming

* Removing redudant setModulePassManager

* Fixing recursion

* Refactoring filenames

* Renaming directory

* Updating names and files

* Formatting

* Changing default to interop friendly

* Updating base profile

* Styling

* Updating logger

* Fixing style

* Removing comment

* Moving testing to run before linting

* Updating CMake

* Attempting to solve tests issue

* Updating according to PR comments

* Complete NamespaceItem in qsfmt (#1239)

Co-authored-by: Filip W <[email protected]>
Co-authored-by: Scott Carda <[email protected]>
Co-authored-by: Sarah Marshall <[email protected]>
Co-authored-by: bettinaheim <[email protected]>
Co-authored-by: Jintao YU <[email protected]>
Co-authored-by: Troels F. Rønnow <[email protected]>
Co-authored-by: XField <[email protected]>
Co-authored-by: Ricardo Espinoza <[email protected]>
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.

6 participants