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
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/Qir/Runtime/build-qir-runtime.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,18 @@
if (-not (Build-CMakeProject $PSScriptRoot "QIR Runtime")) {
throw "At least one project failed to compile. Check the logs."
}

# Copy the results of runtime compilation and the corresponding headers to the drops folder so
# they can be included in pipeline artifacts.
$qirDropsFolder = (Join-Path $Env:DROPS_DIR QIR)
$qirDropsBin = (Join-Path $qirDropsFolder bin)
$qirDropsInclude = (Join-Path $qirDropsFolder include)
if (-not (Test-Path $qirDropsFolder)) {
New-Item -Path $qirDropsFolder -ItemType "directory"
New-Item -Path $qirDropsBin -ItemType "directory"
New-Item -Path $qirDropsInclude -ItemType "directory"
}
$qirBinaries = (Join-Path $PSScriptRoot build $Env:BUILD_CONFIGURATION bin *)
$qirIncludes = (Join-Path $PSScriptRoot public *)
Copy-Item $qirBinaries $qirDropsBin
Copy-Item $qirIncludes $qirDropsInclude
8 changes: 8 additions & 0 deletions src/Qir/Runtime/lib/QIR/bridge-rt.ll
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ declare void @llvm.va_end(i8*)
declare i8* @quantum__rt__tuple_create(i64)
declare void @quantum__rt__tuple_update_reference_count(i8*, i32)
declare void @quantum__rt__tuple_update_alias_count(i8*, i32)
declare i8* @quantum__rt__tuple_copy(i8*, i1)

declare void @quantum__rt__callable_update_reference_count(%"struct.QirCallable"*, i32)
declare %"struct.QirCallable"* @quantum__rt__callable_create(void (i8*, i8*, i8*)**, void (i8*, i64)**, i8*)
Expand Down Expand Up @@ -341,6 +342,13 @@ define dllexport void @__quantum__rt__tuple_update_alias_count(%Tuple* %.th, i32
ret void
}

define dllexport %Tuple* @__quantum__rt__tuple_copy(%Tuple* %.th, i1 %force) {
%th = bitcast %Tuple* %.th to i8*
%th2 = call i8* @quantum__rt__tuple_copy(i8* %th, i1 %force)
%.th2 = bitcast i8* %th2 to %Tuple*
ret %Tuple* %.th2
}

;------------------------------------------------------------------------------
; callables bridge
;
Expand Down
6 changes: 5 additions & 1 deletion src/Qir/Runtime/prerequisites.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@
if ($Env:ENABLE_QIRRUNTIME -ne "false") {
if (($IsWindows) -or ((Test-Path Env:AGENT_OS) -and ($Env:AGENT_OS.StartsWith("Win")))) {
if (!(Get-Command clang -ErrorAction SilentlyContinue)) {
choco install llvm
choco install llvm --version=11.1.0
choco install ninja
}
} elseif ($IsMacOS) {
# temporary workaround for Bintray sunset
# remove this after Homebrew is updated to 3.1.1 on MacOS image, see:
# https://github.com/actions/virtual-environments/blob/main/images/macos/macos-10.15-Readme.md
brew update
brew install ninja
} else {
sudo apt update
Expand Down
4 changes: 4 additions & 0 deletions src/Simulation/Native/prerequisites.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
if (($IsMacOS) -or ((Test-Path Env:AGENT_OS) -and ($Env:AGENT_OS.StartsWith("Darwin")))) {
# building with gcc-9 succeeds but some of the unit tests fail
Write-Host "Install gcc-7 as pre-req for building native simulator on MacOS"
# temporary workaround for Bintray sunset
# remove this after Homebrew is updated to 3.1.1 on MacOS image, see:
# https://github.com/actions/virtual-environments/blob/main/images/macos/macos-10.15-Readme.md
brew update
brew install gcc@7
} else {
Write-Host "No pre-reqs for building native simulator on platforms other than MacOS"
Expand Down