Commit 49d32cd4 authored by Nguyen, Thien Minh's avatar Nguyen, Thien Minh
Browse files

Merge branch 'master' into tnguyen/qir-qrt-update

parents c236167f ada6947e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
#pragma once

#define QCOR_LIB_SUFFIX "${CMAKE_SHARED_LIBRARY_SUFFIX}"
#define QCOR_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}"
#define XACC_ROOT "${XACC_ROOT}"
+6 −6
Original line number Diff line number Diff line
@@ -32,8 +32,10 @@ add_subdirectory(tools)

set(LIBRARY_NAME qcor-mlir-api)

file(GLOB SRC *.cpp)
file(GLOB SRC qcor_mlir_api.cpp)

include_directories(${CMAKE_BINARY_DIR})
include_directories(${CMAKE_SOURCE_DIR}/runtime/jit)
get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)
get_property(conversion_libs GLOBAL PROPERTY MLIR_CONVERSION_LIBS)
set(LIBS
@@ -44,14 +46,15 @@ set(LIBS
        MLIRTargetLLVMIR
        MLIRExecutionEngine
        MLIRStandard
        MLIRAffine
        openqasm-mlir-generator
        openqasmv3-mlir-generator
        quantum-to-llvm-lowering
        qcor-jit
        )

add_mlir_library(${LIBRARY_NAME} SHARED ${SRC} LINK_LIBS PUBLIC ${LIBS})
target_compile_options(${LIBRARY_NAME} PUBLIC "-fexceptions")

#add_library(${LIBRARY_NAME} SHARED ${SRC})
target_compile_features(${LIBRARY_NAME} 
                        PUBLIC
                        cxx_std_17)
@@ -60,9 +63,6 @@ target_include_directories(
  ${LIBRARY_NAME}
  PUBLIC . dialect/include ${CMAKE_BINARY_DIR}/mlir/dialect/include) 

#get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)
#target_link_libraries(${LIBRARY_NAME} PUBLIC MLIRQuantum MLIRIR MLIRStandard ${dialect_libs} MLIROptLib openqasm-mlir-generator quantum-to-llvm-lowering)

if(APPLE)
  set_target_properties(${LIBRARY_NAME}
                        PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib;${MLIR_INSTALL_DIR}/lib;${LLVM_INSTALL_PREFIX}/lib")
+14 −3
Original line number Diff line number Diff line
@@ -10,20 +10,21 @@ def ResultType : OpaqueType<"quantum", "Result", "opaque result type">;
def ArrayType : OpaqueType<"quantum", "Array", "opaque array type">;
def ArgvType : OpaqueType<"quantum", "ArgvType", "opaque argv type">;
def QregType : OpaqueType<"quantum", "QregType", "opaque qreg type">;
def StringType : OpaqueType<"quantum", "StringType", "opaque string type">;

def QallocOp : QuantumOp<"qalloc", []> {
    let arguments = (ins AnyI64Attr:$size, StrAttr:$name);
    let results = (outs ArrayType:$qubits);
}

def ExtractQubitOp : QuantumOp<"extract", []> {
    let arguments = (ins ArrayType:$qreg, I64:$idx);
def ExtractQubitOp : QuantumOp<"qextract", []> {
    let arguments = (ins ArrayType:$qreg, AnyInteger:$idx);
    let results = (outs QubitType:$qbit);
}

def InstOp : QuantumOp<"inst", [AttrSizedOperandSegments]> {
    let arguments = (ins StrAttr:$name, Variadic<QubitType>:$qubits, Variadic<F64>:$params);
    let results = (outs Optional<I64>:$bit);
    let results = (outs Optional<ResultType>:$bit);
}

def DeallocOp : QuantumOp<"dealloc", []> {
@@ -46,4 +47,14 @@ def SetQregOp : QuantumOp<"set_qreg", []> {
    let results = (outs);
}

def PrintOp : QuantumOp<"print", []> {
    let arguments = (ins Variadic<AnyType>:$print_args);
    let results = (outs);
}

def CreateStringLiteralOp : QuantumOp<"createString", []> {
    let arguments = (ins StrAttr:$text, StrAttr:$varname);
    let results = (outs StringType:$result);
}

#endif // Quantum_OPS
 No newline at end of file
+2 −1
Original line number Diff line number Diff line
add_subdirectory(openqasm)
 No newline at end of file
add_subdirectory(qasm2)
add_subdirectory(qasm3)
Loading