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

Conversation

@swernli
Copy link
Collaborator

@swernli swernli commented Jun 15, 2020

This change refactors the Microsoft.Quantum.QSharp.Core project to introduce a new Microsoft.Quantum.QSharp.Foundation project, where Core is build on top of Foundation. This is the first step toward allowing for alternative decomposition packages (see #249). The Foundation project includes those fundamental elements of the language that all decomposition packages rely on, while the implementation that remains in Core is expected to be overridden/replaced with alternative implementation defined in a specific decomposition package. These decomposition packages will be introduced as part of a later change.

@swernli
Copy link
Collaborator Author

swernli commented Jun 15, 2020

To make the larger effort of introducing decomposition packages easier to review and discuss, I'm going to have separate PRs that should roughly line up with the tasks in #249. This set of changes incorporates feedback from my earlier draft PR, #240.

@swernli swernli force-pushed the swernli/qsharp-base branch from cf93950 to d19a5bc Compare June 15, 2020 21:34
@swernli swernli force-pushed the swernli/qsharp-base branch 2 times, most recently from b825b8c to 76db882 Compare June 15, 2020 23:08
@swernli swernli force-pushed the swernli/qsharp-base branch from 76db882 to a54fa33 Compare June 15, 2020 23:55
Copy link
Contributor

@cesarzc cesarzc left a comment

Choose a reason for hiding this comment

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

I liked that Intrinsics.qs is now divided into Assert.qs and Utils.qs!

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

namespace Microsoft.Quantum.Intrinsic {
Copy link
Contributor

Choose a reason for hiding this comment

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

It doesn't have any user-facing impact, but I'm not sure the name "Utils.qs" communicates to me that this source file contains definitions for two intrinsic callables that are classical, by contrast with the quantum intrinsics in Intrinsic.qs.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I struggled to come up with a name for this, actually... the only clearer option I could think of would be separating them into Message.qs and Random.qs and having only one operation per file, which feels silly to do for body-intrinsic methods where there isn't any complicated implementation. Anyone have any suggestions here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You know, the more I think about it the more I like splitting them anyway, even if it does make very small files. This will kind of line up with what I'm imagining later parts of this decomposition work will look like anyway.

@swernli
Copy link
Collaborator Author

swernli commented Jun 16, 2020

I just noticed that ClassicalControl.qs opens the Microsoft.Quantum.Intrinsic namespace but doesn't use it. Between that and the fact that there are rewrite dependencies on it, it should get moved out of the Core and into the Foundation.

Copy link
Contributor

@bettinaheim bettinaheim left a comment

Choose a reason for hiding this comment

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

I haven't looked though it yet, but one thing I wanted to point out:
Several files are listed twice in this diff here. Usually that occurs when there are indeed two versions of the file differing in capitalization. Could you please open your branch on a linux machine (only way to fix it - WSL works too), and make sure you only keep the correct file version such that there are no duplications?

Copy link
Contributor

@bettinaheim bettinaheim left a comment

Choose a reason for hiding this comment

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

Blocking to ensure the PR doesn't have any accidental file duplications.

@swernli swernli force-pushed the swernli/qsharp-base branch 3 times, most recently from 3379775 to 22f25a9 Compare June 16, 2020 20:46
@swernli swernli force-pushed the swernli/qsharp-base branch from 22f25a9 to c01e9b5 Compare June 16, 2020 20:46
@swernli
Copy link
Collaborator Author

swernli commented Jun 16, 2020

@bettinaheim I was able to confirm that there are no file duplications. I think the reason it seems like there are is because I moved several files that have both a .qs and .cs version, such as
src/Simulation/QsharpCore/Bitwise/Bitwise.cs → src/Simulation/QsharpFoundation/Bitwise/Bitwise.cs
src/Simulation/QsharpCore/Bitwise/Bitwise.qs → src/Simulation/QsharpFoundation/Bitwise/Bitwise.qs

@swernli swernli requested a review from bettinaheim June 17, 2020 20:55
@swernli swernli merged commit 01b135f into feature/decomp Jun 18, 2020
@swernli swernli deleted the swernli/qsharp-base branch June 23, 2020 18:17
swernli added a commit that referenced this pull request Jan 26, 2021
* Refactor QSharp.Core into Foundation + Core

* Trying to fix sln

* Splitting Utils.qs

* Moving ClassicalControl.qs

* Reverting Intrinsic.I change
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