| 180 | } |
| 181 | |
| 182 | static std::future<state> get_state_async_impl(const std::string &shortName, |
| 183 | MlirModule module, |
| 184 | std::size_t qpu_id, |
| 185 | nanobind::args args) { |
| 186 | // Launch the asynchronous execution. |
| 187 | auto mod = unwrap(module); |
| 188 | std::string kernelName = shortName; |
| 189 | auto &platform = get_platform(); |
| 190 | auto fnOp = getKernelFuncOp(mod, shortName); |
| 191 | auto opaques = marshal_arguments_for_module_launch(mod, args, fnOp); |
| 192 | |
| 193 | nanobind::gil_scoped_release release; |
| 194 | auto clonedMod = std::shared_ptr<mlir::ModuleOp>( |
| 195 | new mlir::ModuleOp(mod.clone()), [](mlir::ModuleOp *p) { |
| 196 | p->erase(); |
| 197 | delete p; |
| 198 | }); |
| 199 | return detail::runGetStateAsync( |
| 200 | detail::make_copyable_function( |
| 201 | [opaques = std::move(opaques), kernelName, clonedMod]() mutable { |
| 202 | [[maybe_unused]] auto result = |
| 203 | clean_launch_module(kernelName, *clonedMod, opaques); |
| 204 | }), |
| 205 | platform, qpu_id); |
| 206 | } |
| 207 | |
| 208 | /// @brief Python implementation of the `QPUState`. |
| 209 | // Note: Python kernel arguments are wrapped hence need to be unwrapped |
no test coverage detected