This code creates an MLIRContext singleton for this python process. We do not want to have a brand new context every time Python does something with a kernel.
()
| 71 | |
| 72 | |
| 73 | def getMLIRContext(): |
| 74 | """ |
| 75 | This code creates an MLIRContext singleton for this python process. We do |
| 76 | not want to have a brand new context every time Python does something with a |
| 77 | kernel. |
| 78 | """ |
| 79 | global cudaq__global_mlir_context |
| 80 | try: |
| 81 | cudaq__global_mlir_context |
| 82 | except NameError: |
| 83 | cudaq__global_mlir_context = Context() |
| 84 | register_all_dialects(cudaq__global_mlir_context) |
| 85 | quake.register_dialect(context=cudaq__global_mlir_context) |
| 86 | cc.register_dialect(context=cudaq__global_mlir_context) |
| 87 | cudaq_runtime.registerLLVMDialectTranslation(cudaq__global_mlir_context) |
| 88 | return cudaq__global_mlir_context |
| 89 | |
| 90 | |
| 91 | class Initializer: |
no test coverage detected