Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
fbd4b38
Added some math funcs implementation (#500)
kuzminrobin Feb 9, 2021
4f8aaee
QirRuntime: eliminate usage of word 'dummy' (#510)
IrinaYatsenko Feb 9, 2021
e164957
Better error reporting on failure to load the fullstate simulator (#515)
IrinaYatsenko Feb 11, 2021
78d68dc
Clean up target package and simulator files. (#516)
swernli Feb 12, 2021
0c36469
Generate ll file for QIR-static tests from Q# project (#517)
IrinaYatsenko Feb 12, 2021
8d71bc2
Update C# generation for access modifier changes in Q# compiler (#481)
bamarsha Feb 13, 2021
19039f6
Generate QIR during pipeline (#522)
swernli Feb 17, 2021
ec763fb
Added DrawRandomInt() and Message() (#511)
kuzminrobin Feb 18, 2021
df59efb
Cleanup qdk.dll build (#524)
IrinaYatsenko Feb 18, 2021
46ea64d
QIR-based tracer (#475)
IrinaYatsenko Feb 20, 2021
71e6bb3
Added a few more math funcs (#526)
kuzminrobin Feb 23, 2021
d9d0808
Updating ClassicalControls to reduce intrinsics (#529)
swernli Feb 24, 2021
a61a98e
QirRuntime: support ApplyIf* and ApplyConditionally* intrinsics (#527)
IrinaYatsenko Feb 25, 2021
cd360b3
Tracer: Fix the target.qs file and link in QIS lib (#533)
IrinaYatsenko Feb 25, 2021
80d7a50
Added Parity() to the Q# library, and the tests. (#531)
kuzminrobin Feb 26, 2021
03fe767
Clean up ClassicalControl.qs (#541)
swernli Feb 27, 2021
78c7cd7
Tracer: Support of conditionals on measurement results (#539)
IrinaYatsenko Mar 1, 2021
d34d2c5
Update NuGet.Config (#546)
anjbur Mar 5, 2021
7fae770
Revert "Update NuGet.Config (#546)" (#548)
anjbur Mar 6, 2021
419a6e6
Update scripts to LLVM 11, add devcontainer (#545)
swernli Mar 6, 2021
2001b9a
QIR Entry Point Driver Samples (#520)
cesarzc Mar 9, 2021
ebd350a
Added PauliArrayAsInt() and tests. (#543)
kuzminrobin Mar 9, 2021
c832ef3
Refactor QIR runtime CMakeLists and dynamic libraries (#549)
swernli Mar 10, 2021
c0c0c71
Refactor and rename QIR runtime headers and interfaces (#553)
swernli Mar 11, 2021
fe87cf9
Deprecate M.Q.Environment.* (microsoft/quantumlibraries#418) (#555)
Mar 11, 2021
8b4a430
Remove llvm-ar depenency (#556)
swernli Mar 12, 2021
00dfac4
Copy generated import lib for QIR on Windows (#558)
swernli Mar 12, 2021
5e5c597
Copy generated import lib for QIR on Windows (#558)
swernli Mar 12, 2021
7825716
Adapt runtime to latest LSP package. (#547)
Mar 12, 2021
fd73c91
Update concrete intrinsic naming conventions (#538)
swernli Mar 13, 2021
6ec8be9
Merge branch 'main' into samarsha/qep2-main
Mar 15, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 8 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM mcr.microsoft.com/dotnet/sdk:3.1-focal
RUN apt update \
&& apt-get install -y cmake \
&& apt-get install -y ninja-build \
&& apt-get install -y clang-11 \
&& apt-get install -y clang-tidy-11
RUN apt-get install -y build-essential
CMD [ "pwsh" ]
5 changes: 5 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"build": {
"dockerfile": "Dockerfile"
}
}
61 changes: 61 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto
*.sh text eol=lf

###############################################################################
# diff behavior for some non-binary formats
###############################################################################
#*.cs diff=csharp

###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary

###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary

###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
*.md diff=astextplain
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ bld/
[Oo]bj/
[Ll]og/
[Dd]rops/
**/qir-gen.ll

# Visual Studio 2015/2017 cache/options directory
.vs/
Expand Down
2 changes: 1 addition & 1 deletion AdvantageBenchmark/privateBuild/host.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.Quantum.Sdk/0.14.2012122063-beta">
<Project Sdk="Microsoft.Quantum.Sdk/0.15.2103130749-beta">
<!-- Add project references to Simulator and other required packages: -->
<Import Project="..\..\src\Simulation\Common\Simulators.Dev.props" />

Expand Down
2 changes: 1 addition & 1 deletion AdvantageBenchmark/releasedBuild/quantum/quantum.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.Quantum.Sdk/0.14.2012122063-beta">
<Project Sdk="Microsoft.Quantum.Sdk/0.15.2103130749-beta">

<ItemGroup>
<QSharpCompile Include="..\..\privateBuild\quantum.qs" />
Expand Down
22 changes: 10 additions & 12 deletions build/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,6 @@ if ($Env:ENABLE_NATIVE -ne "false") {
Write-Host "Skipping build of native simulator because ENABLE_NATIVE variable is set to: $Env:ENABLE_NATIVE."
}


if ($Env:ENABLE_QIRRUNTIME -eq "true") {
$qirRuntime = (Join-Path $PSScriptRoot "../src/QirRuntime")
& "$qirRuntime/build-qir-runtime.ps1"
if ($LastExitCode -ne 0) {
$script:all_ok = $False
}
} else {
Write-Host "Skipping build of qir runtime because ENABLE_QIRRUNTIME variable is set to: $Env:ENABLE_QIRRUNTIME"
}


function Build-One {
param(
[string]$action,
Expand Down Expand Up @@ -57,6 +45,16 @@ Build-One 'publish' '../src/Simulation/CSharpGeneration.App'

Build-One 'build' '../Simulation.sln'

if ($Env:ENABLE_QIRRUNTIME -eq "true") {
$qirRuntime = (Join-Path $PSScriptRoot "../src/QirRuntime")
& "$qirRuntime/build-qir-runtime.ps1"
if ($LastExitCode -ne 0) {
$script:all_ok = $False
}
} else {
Write-Host "Skipping build of qir runtime because ENABLE_QIRRUNTIME variable is set to: $Env:ENABLE_QIRRUNTIME"
}

if (-not $all_ok) {
throw "At least one project failed to compile. Check the logs."
}
2 changes: 1 addition & 1 deletion build/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ variables:
Drops.Dir: $(Build.ArtifactStagingDirectory)/drops
Drop.Native: $(System.DefaultWorkingDirectory)/xplat
CI: "true"
ENABLE_QIRRUNTIME: "true"
ENABLE_QIRRUNTIME: "false"

jobs:
- job: build
Expand Down
6 changes: 2 additions & 4 deletions build/set-env.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@ If ($Env:BUILD_VERBOSITY -eq $null) { $Env:BUILD_VERBOSITY ="m" }
If ($Env:ASSEMBLY_VERSION -eq $null) { $Env:ASSEMBLY_VERSION ="$Env:BUILD_BUILDNUMBER" }
If ($Env:NUGET_VERSION -eq $null) { $Env:NUGET_VERSION ="$Env:ASSEMBLY_VERSION-alpha" }

If ($Env:ENABLE_QIRRUNTIME -eq "true") {
If (($Env:ENABLE_NATIVE -ne "false") -and ($Env:NATIVE_SIMULATOR -eq $null) ) {
$Env:NATIVE_SIMULATOR = (Join-Path $PSScriptRoot "..\src\Simulation\Native\build\drop")
}
If (($Env:ENABLE_NATIVE -ne "false") -and ($Env:NATIVE_SIMULATOR -eq $null) ) {
$Env:NATIVE_SIMULATOR = (Join-Path $PSScriptRoot "..\src\Simulation\Native\build\drop")
}

If ($Env:DROPS_DIR -eq $null) { $Env:DROPS_DIR = [IO.Path]::GetFullPath((Join-Path $PSScriptRoot "..\drops")) }
Expand Down
6 changes: 3 additions & 3 deletions build/steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ steps:
- template: steps-init.yml


- powershell: ./build.ps1
- pwsh: ./build.ps1
displayName: "Building Q# runtime"
workingDirectory: $(System.DefaultWorkingDirectory)/build


- powershell: ./test.ps1
- pwsh: ./test.ps1
displayName: "Testing Q# runtime"
workingDirectory: $(System.DefaultWorkingDirectory)/build
condition: and(succeeded(), ne(variables['Skip.Tests'], 'true'))


- powershell: ./pack.ps1
- pwsh: ./pack.ps1
displayName: "Pack Q# runtime (Windows only)"
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
workingDirectory: $(System.DefaultWorkingDirectory)/build
Expand Down
23 changes: 11 additions & 12 deletions build/test.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,6 @@ if ($Env:ENABLE_NATIVE -ne "false") {
} else {
Write-Host "Skipping test of native simulator because ENABLE_NATIVE variable is set to: $Env:ENABLE_NATIVE."
}

if (($Env:ENABLE_NATIVE -ne "false") -and ($Env:ENABLE_QIRRUNTIME -eq "true")) {
$qirRuntime = (Join-Path $PSScriptRoot "../src/QirRuntime")
& "$qirRuntime/test-qir-runtime.ps1"
if ($LastExitCode -ne 0) {
$script:all_ok = $False
}
} else {
Write-Host "Skipping test of qir runtime because ENABLE_QIRRUNTIME variable is set to: $Env:ENABLE_QIRRUNTIME `
and ENABLE_NATIVE variable is set to: $Env:ENABLE_NATIVE."
}

function Test-One {
Param($project)

Expand All @@ -49,6 +37,17 @@ function Test-One {

Test-One '../Simulation.sln'

if (($Env:ENABLE_NATIVE -ne "false") -and ($Env:ENABLE_QIRRUNTIME -eq "true")) {
$qirRuntime = (Join-Path $PSScriptRoot "../src/QirRuntime")
& "$qirRuntime/test-qir-runtime.ps1"
if ($LastExitCode -ne 0) {
$script:all_ok = $False
}
} else {
Write-Host "Skipping test of qir runtime because ENABLE_QIRRUNTIME variable is set to: $Env:ENABLE_QIRRUNTIME `
and ENABLE_NATIVE variable is set to: $Env:ENABLE_NATIVE."
}

if (-not $all_ok) {
throw "At least one project failed during testing. Check the logs."
}
94 changes: 8 additions & 86 deletions src/QirRuntime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,99 +27,21 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")

set(public_includes "${PROJECT_SOURCE_DIR}/public")
set(test_includes "${PROJECT_SOURCE_DIR}/externals/catch2" "${PROJECT_SOURCE_DIR}/test")

#===============================================================================
# testing related
#
include(CTest)
macro(add_unit_test target)
add_test(
NAME ${target}
COMMAND ${target} ~[skip] -o "${target}_results.xml" -r junit
)

# set the environment path for loading shared libs the tests are using
if(DEFINED ENV{NATIVE_SIMULATOR})
set(TEST_DEPS1 $ENV{NATIVE_SIMULATOR})
else()
set(TEST_DEPS1 "${PROJECT_SOURCE_DIR}/../Simulation/native/build/${CMAKE_BUILD_TYPE}")
endif()

set(TEST_DEPS2 "${CMAKE_BINARY_DIR}/bin")
set_property(TEST ${target} PROPERTY ENVIRONMENT
"LD_LIBRARY_PATH=${TEST_DEPS1}:${TEST_DEPS2}:${LD_LIBRARY_PATH}"
"PATH=${TEST_DEPS1}\;${TEST_DEPS2}\;${PATH}"
"DYLD_LIBRARY_PATH=${TEST_DEPS1}:${TEST_DEPS2}:${DYLD_LIBRARY_PATH}"
)
endmacro(add_unit_test)

#===============================================================================
# compiling from IR
#
# CMake doesn't support LLVM IR files as sources so we compile them with custom
# commands, which produce UTILITY libs that can only be linked in using abs paths
# (rather than the target name):
# Target "qir_bridge_qis" of type UTILITY may not be linked into another
# target. One may link only to INTERFACE, OBJECT, STATIC or SHARED
# libraries, or to executables with the ENABLE_EXPORTS property set.
#
macro(compile_from_qir source_file target)
set(CLANG_ARGS "-c")
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
set(CLANG_ARGS
"${CLANG_ARGS}"
"-O0"
"-D_DEBUG"
)
endif()

set(INFILE
"${CMAKE_CURRENT_SOURCE_DIR}/${source_file}.ll"
)
set(OBJFILE
"${CMAKE_CURRENT_BINARY_DIR}/${source_file}.obj"
)

set(OBJFILE_COMPILE "${source_file}-compile")
add_custom_command(OUTPUT ${OBJFILE_COMPILE}
COMMAND ${CMAKE_CXX_COMPILER}
ARGS ${CLANG_ARGS} ${INFILE} "-o" ${OBJFILE}
DEPENDS ${INFILE}
COMMENT "Compiling ${source_file}.ll"
VERBATIM
)

add_custom_target(${source_file}_compile DEPENDS ${OBJFILE_COMPILE})

if (WIN32)
set(QIR_UTILITY_LIB "${CMAKE_CURRENT_BINARY_DIR}/${source_file}-u.lib" )
else()
set(QIR_UTILITY_LIB "${CMAKE_CURRENT_BINARY_DIR}/lib${source_file}-u.a")
endif()

add_custom_command(OUTPUT ${QIR_UTILITY_LIB}
COMMAND ${CMAKE_AR}
ARGS "rc" ${QIR_UTILITY_LIB} ${OBJFILE}
DEPENDS ${source_file}_compile ${INFILE}
COMMENT "Creating a lib from ${source_file}.ll"
VERBATIM
)

if (NOT ${target} STREQUAL "")
add_custom_target(${target} DEPENDS ${QIR_UTILITY_LIB})
endif()
endmacro(compile_from_qir)
include(qir_cmake_include)

if (WIN32)
set(QIR_BRIDGE_UTILITY_LIB "${PROJECT_BINARY_DIR}/lib/QIR/bridge-rt-u.lib")
set(QIR_BRIDGE_QIS_UTILITY_LIB "${PROJECT_BINARY_DIR}/lib/QIR/bridge-qis-u.lib")
set(QSHARP_FOUNDATION_BRIDGE_QIS_UTILITY_LIB "${PROJECT_BINARY_DIR}/lib/QSharpFoundation/qsharp-foundation-qis-u.lib")
set(QSHARP_CORE_BRIDGE_QIS_UTILITY_LIB "${PROJECT_BINARY_DIR}/lib/QSharpCore/qsharp-core-qis-u.lib")
set(QIR_BRIDGE_TRACER_UTILITY_LIB "${PROJECT_BINARY_DIR}/lib/Tracer/tracer-bridge-u.lib")
else()
set(QIR_BRIDGE_UTILITY_LIB "${PROJECT_BINARY_DIR}/lib/QIR/libbridge-rt-u.a")
set(QIR_BRIDGE_QIS_UTILITY_LIB "${PROJECT_BINARY_DIR}/lib/QIR/libbridge-qis-u.a")
set(QSHARP_FOUNDATION_BRIDGE_QIS_UTILITY_LIB "${PROJECT_BINARY_DIR}/lib/QSharpFoundation/libqsharp-foundation-qis-u.a")
set(QSHARP_CORE_BRIDGE_QIS_UTILITY_LIB "${PROJECT_BINARY_DIR}/lib/QSharpCore/libqsharp-core-qis-u.a")
set(QIR_BRIDGE_TRACER_UTILITY_LIB "${PROJECT_BINARY_DIR}/lib/Tracer/libtracer-bridge-u.a")
endif()


add_subdirectory(lib)
add_subdirectory(samples)
add_subdirectory(test)

Loading