catalyst icon indicating copy to clipboard operation
catalyst copied to clipboard

[Frontend] The lack of a device specific decomposition logic

Open maliasadi opened this issue 2 years ago • 1 comments

We currently serve all backend devices in a way that they all support an identical set of quantum gates. This design assumption would lead to the failure of decomposition rules for the OpenQasm3/Braket device. We may need to implement a device specific decomposition logic for every supported backend devices in the frontend to properly tackle this issue.

Check the test_unsupported_gate_braket test unit in test_aws_braket_devices.py for an example.

maliasadi avatar Jun 28 '23 21:06 maliasadi

Possible implementation

    def __call__(self, *args, **kwargs):
        if isinstance(self, qml.QNode):
            if self.device.short_name not in QFunc.RUNTIME_DEVICES:
                raise CompileError(
                    f"The {self.device.short_name} device is not "
                    "supported for compilation at the moment."
                )
            ...
            # instead of generating the same QJITDevice with the same supported operations
            # we can easily pass the list of supported operations from the QNode.
            device = QJITDevice(
                self.device.shots, self.device.wires, self.device.short_name, backend_kwargs
                # we can easily access:
               , self.device.operations
               , self.device.observables
            )

erick-xanadu avatar Oct 13 '23 13:10 erick-xanadu