github PennyLaneAI/pennylane v0.46.0b1
Release 0.46.0 Beta 1

pre-release6 hours ago
  • Functionality for heterogeneous compilation and low-latency execution of QNodes across GPUs, CPUs, FPGAs, and QPUs has been added to PennyLane. qp.Backline builds a device from a qp.Controller, zero or more qp.Coprocessor, and a transport, describing where each part of a workload runs and how the parts communicate. The resulting device binds to a QNode, and requires the Catalyst compiler to execute. (#9772) (#9970) (#9975)

    import pennylane as qp
    
    
    qdev = qp.device("lightning.qubit", wires=4)
    
    CPU = qp.Controller(
        device=qdev,
        remote=True,
        executor_options={"host": "192.168.3.15", "port": 7810},
    )
    
    GPU = qp.Coprocessor(
        coprocessor_fn="decoder",
        hardware="gpu",
        endpoint=qp.Endpoint("192.168.1.3", 18590),
    )
    
    dev = qp.Backline(controller=CPU, coprocessors=[GPU], transport="rdma")
    
    @qp.qjit(capture=True)
    @qp.qnode(dev)
    def circuit(x):
        qp.RX(x, wires=0)
        return qp.expval(qp.Z(0))

    When using a backline to execute a quantum program, there are multiple ways to incorporate quantum error correction (QEC) encoding and decoding:

    • Implicit QEC: provide the qec_code argument to qp.Backline, and encoding (as an MLIR compilation pass) and decoding are automatically applied.

    • Explicit QEC: if the qec_code argument is not provided, no automatic encoding or decoding will occur. It will be assumed that the circuit defined in the PennyLane frontend represents a physical circuit; encoding and decoding (via qp.backline.decode) should be manually defined in the frontend.

      @qp.qjit(capture=True, autograph=True)
      @qp.qnode(dev)
      def circuit():
          # encoded logical circuit
          ...
      
          # measure syndromes, decode, and correct
          syndrome = extract_syndromes() # via qp.measure
      
          correction = qp.backline.decode(syndrome)
      
          if correction[0] == 1:
              qp.X(0)
      
          return qp.expval(qp.Z(0))

    The decoding function to be executed on the coprocessor can be specified in multiple ways:

    • A Triton kernel: The provided function qp.backline.triton_decoder compiles a Python Triton decoder function into a shared library that can be used as a coprocessing function. Alternatively, qp.backline.css_bp_decoder is a convenience function to compile a CSS Tanner graph to a belief propagation decoder using Triton.

    • A precompiled library: CoprocessorFunction registers a precompiled library symbol and (optionally) the library path.

    For more details, see the backline documentation and the Backline demo.

  • The ability for a compiled program to call a runtime entry point directly via its C symbol name has been added. A symbol's signature is declared once with qp.runtime_declare and called with qp.runtime_call from inside a qjit program. (#9970)

    import pennylane as qp
    
    qp.runtime_declare("example_local_rounds", "(ptr, u32) -> u64", library="/path/librounds.so")
    
    def program(session):
        return qp.runtime_call("example_local_rounds", session, 100000)

Don't miss a new pennylane release

NewReleases is sending notifications on new releases.