Skip to content
Draft
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
9 changes: 7 additions & 2 deletions badger-optimiser/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use tket::optimiser::badger::log::BadgerLogger;
use tket::optimiser::{BadgerOptimiser, ECCBadgerOptimiser};
use tket::serialize::pytket::{DecodeOptions, EncodeOptions};
use tket::serialize::{load_tk1_json_file, save_tk1_json_file};
use tket_qsystem::QSystemPlatform;

#[cfg(feature = "peak_alloc")]
#[global_allocator]
Expand Down Expand Up @@ -147,7 +148,9 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {

let mut circ: Circuit = load_tk1_json_file(
input_path,
DecodeOptions::new().with_config(tket_qsystem::pytket::qsystem_decoder_config()),
DecodeOptions::new().with_config(tket_qsystem::pytket::qsystem_decoder_config(
QSystemPlatform::Helios,
)),
)?
.into();
if opts.rewrite_tracing {
Expand Down Expand Up @@ -192,7 +195,9 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
save_tk1_json_file(
opt_circ.hugr(),
output_path,
EncodeOptions::new().with_config(tket_qsystem::pytket::qsystem_encoder_config()),
EncodeOptions::new().with_config(tket_qsystem::pytket::qsystem_encoder_config(
QSystemPlatform::Helios,
)),
)?;

#[cfg(feature = "peak_alloc")]
Expand Down
2 changes: 1 addition & 1 deletion devenv.lock
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@
},
"root": "root",
"version": 7
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
def compile_to_bitcode(pkg_bytes: bytes, opt_level: int = 2) -> bytes:
def compile_to_bitcode(
pkg_bytes: bytes,
opt_level: int = 2,
target_triple: str = "native",
platform: str = "helios",
) -> bytes:
"""Compile serialized HUGR to LLVM IR bitcode"""
...

def compile_to_llvm_ir(pkg_bytes: bytes, opt_level: int = 2) -> str:
def compile_to_llvm_ir(
pkg_bytes: bytes,
opt_level: int = 2,
target_triple: str = "native",
platform: str = "helios",
) -> str:
"""Compile serialized HUGR to LLVM IR string"""
...

Expand Down
18 changes: 18 additions & 0 deletions qis-compiler/python/tests/generate_hugrs.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@
from pathlib import Path

from guppylang import guppy
from guppylang.std.angles import pi
from guppylang.std.builtins import array, exit, panic, result
from guppylang.std.qsystem.random import RNG
from guppylang.std.qsystem.utils import get_current_shot
from guppylang.std.quantum import (
crz,
cx,
discard,
discard_array,
Expand Down Expand Up @@ -219,6 +221,21 @@ def main() -> None:
return main.compile().to_bytes()


def qft_32() -> bytes:
@guppy
def main() -> None:
qs = array(qubit() for _ in range(32))
for i in range(32):
h(qs[i])
angle = pi / 2
for j in range(31 - i):
crz(qs[i], qs[i + j + 1], angle)
angle /= 2
result("cs", measure_array(qs))

return main.compile().to_bytes()


def entry_args() -> bytes:
@guppy
def foo(a: int) -> None:
Expand All @@ -241,6 +258,7 @@ def foo(a: int) -> None:
postselect_panic,
rus,
print_current_shot,
qft_32,
rng,
entry_args,
]:
Expand Down
Binary file not shown.
Binary file not shown.
Loading
Loading