MCPcopy Create free account
hub / github.com/NVIDIA/cuda-quantum / getKernelFuncOp

Function getKernelFuncOp

python/utils/OpaqueArguments.h:48–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46/// @brief Search the given Module for the function with provided name.
47template <bool noThrow = false>
48mlir::func::FuncOp getKernelFuncOp(mlir::ModuleOp mod,
49 const std::string &name) {
50 std::string lookupName = name;
51 if (mod->hasAttr(cudaq::runtime::pythonUniqueAttrName)) {
52 mlir::StringRef uniqName = cast<mlir::StringAttr>(
53 mod->getAttr(cudaq::runtime::pythonUniqueAttrName));
54 if (uniqName.substr(0, name.size()) == name) {
55 // FIXME: The path to this call used the wrong name.
56 lookupName = uniqName;
57 }
58 }
59 lookupName = cudaq::runtime::cudaqGenPrefixName + lookupName;
60 if (auto result = mod.lookupSymbol<mlir::func::FuncOp>(lookupName))
61 return result;
62 if constexpr (noThrow) {
63 return {};
64 } else /*constexpr*/ {
65 mod.dump();
66 throw std::runtime_error("Could not find " + lookupName +
67 " function in current module.");
68 }
69}
70
71template <bool noThrow = false>
72mlir::func::FuncOp getKernelFuncOp(MlirModule module,

Callers 15

linkResolvedCallableFunction · 0.85
toOpaqueArgsMethod · 0.85
pyLaunchModuleFunction · 0.85
clean_launch_moduleMethod · 0.85
synthesizeKernelFunction · 0.85
lower_to_codegenFunction · 0.85
get_launch_args_requiredFunction · 0.85
pySamplePTSBEFunction · 0.85
pySampleAsyncPTSBEFunction · 0.85
sample_async_implFunction · 0.85

Calls 2

sizeMethod · 0.45
dumpMethod · 0.45

Tested by

no test coverage detected