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

Method processDecoratorCall

python/cudaq/kernel/ast_bridge.py:2734–2763  ·  view source on GitHub ↗
(symName)

Source from the content-addressed store, hash-verified

2732 return name
2733
2734 def processDecoratorCall(symName):
2735 assert symName in self.symbolTable
2736 self.visit(ast.Name(symName))
2737 kernel = self.popValue()
2738 if not cc.CallableType.isinstance(kernel.type):
2739 self.emitFatalError(
2740 f"`{symName}` object is not callable, found symbol of type {kernel.type}",
2741 node)
2742 functionTy = FunctionType(
2743 cc.CallableType.getFunctionType(kernel.type))
2744 nrArgs = len(functionTy.inputs)
2745 values = self.__groupValues(node.args, [(nrArgs, nrArgs)])
2746 values = convertArguments([t for t in functionTy.inputs], values)
2747 call = cc.CallCallableOp(functionTy.results, kernel, values)
2748 call.attributes.__setitem__('symbol', StringAttr.get(symName))
2749
2750 if len(functionTy.results) == 0:
2751 return
2752 if len(functionTy.results) == 1:
2753 result = call.results[0]
2754 else:
2755 for val in call.results:
2756 self.__validate_container_entry(val, node)
2757 result = self.__createStructWithKnownValues(call.results)
2758
2759 # The logic for calls that return values must match the logic in
2760 # `visit_Return`; anything copied to the heap during return must be
2761 # copied back to the stack. Compiler optimizations should take care
2762 # of eliminating unnecessary copies.
2763 return self.__migrateLists(result, copy_list_to_stack)
2764
2765 def resolveQualifiedName(pyVal):
2766 if isinstance(pyVal, ast.Name):

Callers

nothing calls this directly

Calls 9

visitMethod · 0.95
popValueMethod · 0.95
emitFatalErrorMethod · 0.95
__groupValuesMethod · 0.95
__migrateListsMethod · 0.95
__setitem__Method · 0.80
getMethod · 0.45

Tested by

no test coverage detected