-
Notifications
You must be signed in to change notification settings - Fork 90
Get the build artifacts together #587
Description
Problem description
Currently upon build (pwsh build-qir-runtime.ps1) the build files are generated in the multiple folders inside of QirRuntime folder. In particular:
# (1)
build\
# (2)
samples\StandaloneInputReference\qsharp\{bin, obj, qir}
samples\StandaloneInputReference\qir-standalone-input-reference.ll
# (3)
test\{FullstateSimulator, QIR-dynamic, QIR-static, QIR-tracer}\qsharp\{bin, obj, qir}
# (4)
test\FullstateSimulator\qir-test-simulator.ll
test\QIR-dynamic\qir-test-random.ll
test\QIR-static\qir-gen.ll
test\QIR-tracer\tracer-qir.llThis has a few disadvantages:
- If somebody needs to rebuild all (e.g. they updated some of the files), they need to remove all those built folders/files (
(1)..(4)). If they just removebuild\then the .ll files will not be regenerated upon local build (pwsh build-qir-runtime.ps1), showing the confusing errors. - The documentation/instructions about how to rebuild all, have to be more complicated than could be (which will likely make the reader frown :-\ ).
Would be nice if all the build files were generated in a single directory, e.g. build\{Debug | Release}.
Consider making the following changes.
- Change the
{test, samples}\**\*.csprojfiles such that they generate the build files inside ofbuild\{Debug | Release}. - Change the
build-qir-runtime.ps1such that in the end offunction Build-QirProject(the first of the twoCopy-Itemcommands) it either does not copy the .ll files to{test, samples}(see(4)above) or copies withinbuild\{Debug | Release}. - Update
README.mdwith the instructions about how to rebuild all (by removing thebuild\folder).
Optionally consider the following
[8:27 AM] Robin Kuzmin
Another thing is worth mentioning is that the .ll files are regenerated from .qs, only if .ll is absent.
If the .qs is newer than .ll, the .ll is not re-generated. Looks like a certain dependency is missing in the CMake files or .ps1 files.
[8:35 AM] Stefan Wernli
Yes, that’s correct, and intentional. The pipeline gets very mad when the script tries to build the individual csproj files, which is why I added them to the solution. The expected workflow is to use the QIR scripts to build the QIR runtime, and if any changes to .qs files has been made to rebuild those using dotnet build on the Simulation.sln
[8:35 AM] Stefan Wernli
Yet another thing it would be good to clarify in the readme, now that I’m thinking of it
[10:34 AM] Robin Kuzmin
Stefan, I assume you meant the following:
"The pipeline gets very mad when the script (e.g. qsharp-runtime\src\QirRuntime\build-qir-runtime.ps1 ) tries to build the individual csproj files (e.g. qsharp-runtime\src\QirRuntime\test\QIR-static\qsharp\qir-gen.csproj ), which is why I added them to the solution (qsharp-runtime\Simulation.sln)".
As I now understand, the dependency that causes the regeneration of the .ll files upon the update of the .qs files, is observed in (or is built into) the Simulation.sln.
If that's the way such dependencies work, then may be we can create one more .sln somewhere inside of qsharp-runtime\src\QirRuntime and add the .csproj files (e.g. test\QIR-static\qsharp\qir-gen.csproj) to that .sln too? As a result, the .csproj will be included into two solutions - Simualtion.sln and QirRuntime local .sln. And the .ll files will be rebuilt upon update to the .qs, both when building QirRuntime only, and when building the whole repo qsharp-runtime. (Just an idea to consider. I'm not sure if this idea works or is needed at all)
Edited[10:39 AM] Stefan Wernli
that's an interesting idea, yeah. The second solution could be for local development only, such that the pipeline doesn't build it at all and only relies on the Simulation.sln. There is a bit of extra overhead in keeping the two solutions in sync, which we should take into account; eg: a new qir test project is created and added to the second solution but not the first. In that case the pipeline will fail, which should prevent anything like that from getting checked in.
[10:41 AM] Stefan Wernli
for me personally, I try to keep my local development flow to be as similar to what runs in the pipeline as possible that way I get fewer surprises when submitting PRs, so I try to always use the same scripts the pipeline uses and not introduce too much local-dev-specific tooling into the repo. But not everyone likes to work that way. There was a long thread on the C&R channel somewhere regarding the disconnect between build scripts the pipeline uses and what people do locally on their machines, and opinions on the team vary.
[10:45 AM] Robin Kuzmin
Very good points. I totally agree.
Curious, can Simulation.sln
instead of directly including the .csproj files (like src\QirRuntime\test\QIR-static\qsharp\qir-gen.csproj)
include another .sln (QirRuntime local .sln, that includes the QirRuntime local .csproj files)?
[10:51 AM] Cesar Zaragoza Cortes
Another option that we could do for local development is to add a generateQirAlways parameter to the script which is false by default. I've been doing something similar and it has been convenient.