Loading CMakeLists.txt +2 −1 Original line number Diff line number Diff line Loading @@ -61,6 +61,7 @@ add_subdirectory(handlers) add_subdirectory(runtime) add_subdirectory(tools) add_subdirectory(lib) add_subdirectory(scripts/debian) if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") if (NOT MLIR_DIR) Loading Loading @@ -105,7 +106,7 @@ set(CPACK_PACKAGE_VERSION_MINOR "${MINOR_VERSION}") set(CPACK_PACKAGE_VERSION_PATCH "${PATCH_VERSION}") set(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}") set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}") set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_SOURCE_DIR}/scripts/debian/postinst") set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_BINARY_DIR}/scripts/debian/postinst") #dependencies for this service menu if (${QCOR_CPACK_DEB_PLATFORM} STREQUAL "bionic") Loading docker/qsharp/Dockerfile +2 −0 Original line number Diff line number Diff line Loading @@ -6,6 +6,8 @@ RUN wget https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-p apt-get update && apt-get install -y apt-transport-https && apt-get update && apt-get install -y dotnet-sdk-3.1 # Install Q# SDK # Add QDK-alpha source RUN dotnet nuget add source "https://pkgs.dev.azure.com/ms-quantum-public/Microsoft Quantum (public)/_packaging/alpha/nuget/v3/index.json" -n qdk-alpha RUN dotnet new -i Microsoft.Quantum.ProjectTemplates # XACC and QCOR Loading examples/qcor_demos/pirq_workshop/qir_qasm3/demo1_simple/README.md 0 → 100644 +39 −0 Original line number Diff line number Diff line # QASM3 MLIR and QIR Simple Here we demonstrate the utility of the QIR and MLIR for enabling the development of compilers for available quantum languages. We show simple GHZ and Bell circuits for NISQ and FTQC execution, respectively. ## Goals - Demonstrate the utility of the MLIR and QIR for creating compilers and executable code for available quantum languages. - Demonstrate write-once, run-on-any available quantum backend. - Demonstrate accessibility of MLIR and QIR for available Pythonic circuit construction frameworks. ## Outline GHZ (nisq) and Bell (ftqc) QASM3 codes, compile and run on simulator, IBM, Rigetti (in JupyterLab), IonQ. Walk through generated MLIR and QIR. - Show pre-written GHZ and Bell QASM3 codes, note how GHZ is written for NISQ execution, while Bell is written for FTQC. - Lower GHZ to MLIR, show off the result. Lower GHZ to QIR, show off the result. - Lower Bell to MLIR, show off the result. Lower Bell to QIR, show off the result. - Compile and run the Bell code on QPP, note qcor -verbose and show the commands being run - Compile the GHZ code for the IBM backend and execute. Note automated placement. ## Notes: Count how many qvs instructions in the MLIR text ```bash qcor --emit-mlir trotter_decompose.qasm &> out.log && cat out.log | grep 'qvs.' | tee out2.log | wc -l && rm -rf out*.log ``` and with optimizations ```bash qcor --q-optimize --emit-mlir trotter_decompose.qasm &> out.log && cat out.log | grep 'qvs.' | tee out2.log | wc -l && rm -rf out*.log ``` No newline at end of file examples/qcor_demos/pirq_workshop/qir_qasm3/demo1_simple/bell.qasm 0 → 100644 +21 −0 Original line number Diff line number Diff line OPENQASM 3; qubit q[2]; const shots = 1024; int count = 0; for i in [0:shots] { h q[0]; ctrl @ x q[0], q[1]; bit c[2]; c = measure q; if (c[0] == c[1]) { count += 1; } reset q; } print("count is ", count); examples/qcor_demos/pirq_workshop/qir_qasm3/demo1_simple/ghz.qasm 0 → 100644 +17 −0 Original line number Diff line number Diff line // Compile and run with // qcor ghz.qasm -o ghz.x // ./ghz.x -qrt nisq -shots 1000 OPENQASM 3; const n_qubits = 8; qubit q[n_qubits]; h q[0]; for i in [0:n_qubits-1] { ctrl @ x q[i], q[i+1]; } bit c[n_qubits]; c = measure q; No newline at end of file Loading
CMakeLists.txt +2 −1 Original line number Diff line number Diff line Loading @@ -61,6 +61,7 @@ add_subdirectory(handlers) add_subdirectory(runtime) add_subdirectory(tools) add_subdirectory(lib) add_subdirectory(scripts/debian) if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") if (NOT MLIR_DIR) Loading Loading @@ -105,7 +106,7 @@ set(CPACK_PACKAGE_VERSION_MINOR "${MINOR_VERSION}") set(CPACK_PACKAGE_VERSION_PATCH "${PATCH_VERSION}") set(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}") set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}") set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_SOURCE_DIR}/scripts/debian/postinst") set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_BINARY_DIR}/scripts/debian/postinst") #dependencies for this service menu if (${QCOR_CPACK_DEB_PLATFORM} STREQUAL "bionic") Loading
docker/qsharp/Dockerfile +2 −0 Original line number Diff line number Diff line Loading @@ -6,6 +6,8 @@ RUN wget https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-p apt-get update && apt-get install -y apt-transport-https && apt-get update && apt-get install -y dotnet-sdk-3.1 # Install Q# SDK # Add QDK-alpha source RUN dotnet nuget add source "https://pkgs.dev.azure.com/ms-quantum-public/Microsoft Quantum (public)/_packaging/alpha/nuget/v3/index.json" -n qdk-alpha RUN dotnet new -i Microsoft.Quantum.ProjectTemplates # XACC and QCOR Loading
examples/qcor_demos/pirq_workshop/qir_qasm3/demo1_simple/README.md 0 → 100644 +39 −0 Original line number Diff line number Diff line # QASM3 MLIR and QIR Simple Here we demonstrate the utility of the QIR and MLIR for enabling the development of compilers for available quantum languages. We show simple GHZ and Bell circuits for NISQ and FTQC execution, respectively. ## Goals - Demonstrate the utility of the MLIR and QIR for creating compilers and executable code for available quantum languages. - Demonstrate write-once, run-on-any available quantum backend. - Demonstrate accessibility of MLIR and QIR for available Pythonic circuit construction frameworks. ## Outline GHZ (nisq) and Bell (ftqc) QASM3 codes, compile and run on simulator, IBM, Rigetti (in JupyterLab), IonQ. Walk through generated MLIR and QIR. - Show pre-written GHZ and Bell QASM3 codes, note how GHZ is written for NISQ execution, while Bell is written for FTQC. - Lower GHZ to MLIR, show off the result. Lower GHZ to QIR, show off the result. - Lower Bell to MLIR, show off the result. Lower Bell to QIR, show off the result. - Compile and run the Bell code on QPP, note qcor -verbose and show the commands being run - Compile the GHZ code for the IBM backend and execute. Note automated placement. ## Notes: Count how many qvs instructions in the MLIR text ```bash qcor --emit-mlir trotter_decompose.qasm &> out.log && cat out.log | grep 'qvs.' | tee out2.log | wc -l && rm -rf out*.log ``` and with optimizations ```bash qcor --q-optimize --emit-mlir trotter_decompose.qasm &> out.log && cat out.log | grep 'qvs.' | tee out2.log | wc -l && rm -rf out*.log ``` No newline at end of file
examples/qcor_demos/pirq_workshop/qir_qasm3/demo1_simple/bell.qasm 0 → 100644 +21 −0 Original line number Diff line number Diff line OPENQASM 3; qubit q[2]; const shots = 1024; int count = 0; for i in [0:shots] { h q[0]; ctrl @ x q[0], q[1]; bit c[2]; c = measure q; if (c[0] == c[1]) { count += 1; } reset q; } print("count is ", count);
examples/qcor_demos/pirq_workshop/qir_qasm3/demo1_simple/ghz.qasm 0 → 100644 +17 −0 Original line number Diff line number Diff line // Compile and run with // qcor ghz.qasm -o ghz.x // ./ghz.x -qrt nisq -shots 1000 OPENQASM 3; const n_qubits = 8; qubit q[n_qubits]; h q[0]; for i in [0:n_qubits-1] { ctrl @ x q[i], q[i+1]; } bit c[n_qubits]; c = measure q; No newline at end of file