MCPcopy Index your code
hub / github.com/python/cpython / make_uop

Function make_uop

Tools/cases_generator/analyzer.py:1035–1081  ·  view source on GitHub ↗
(
    name: str,
    op: parser.InstDef,
    inputs: list[parser.InputEffect],
    uops: dict[str, Uop],
)

Source from the content-addressed store, hash-verified

1033 return stack
1034
1035def make_uop(
1036 name: str,
1037 op: parser.InstDef,
1038 inputs: list[parser.InputEffect],
1039 uops: dict[str, Uop],
1040) -> Uop:
1041 result = Uop(
1042 name=name,
1043 context=op.context,
1044 annotations=op.annotations,
1045 stack=analyze_stack(op),
1046 caches=analyze_caches(inputs),
1047 local_stores=find_variable_stores(op),
1048 body=op.block,
1049 properties=compute_properties(op),
1050 )
1051 for anno in op.annotations:
1052 if anno.startswith("replicate"):
1053 text = anno[10:-1]
1054 start, stop = text.split(":")
1055 result.replicated = range(int(start), int(stop))
1056 break
1057 else:
1058 return result
1059 for oparg in result.replicated:
1060 name_x = name + "_" + str(oparg)
1061 properties = compute_properties(op)
1062 properties.oparg = False
1063 stack = analyze_stack(op)
1064 if not variable_used(op, "oparg"):
1065 stack = scalarize_stack(stack, oparg)
1066 else:
1067 properties.const_oparg = oparg
1068 rep = Uop(
1069 name=name_x,
1070 context=op.context,
1071 annotations=op.annotations,
1072 stack=stack,
1073 caches=analyze_caches(inputs),
1074 local_stores=find_variable_stores(op),
1075 body=op.block,
1076 properties=properties,
1077 )
1078 rep.replicates = result
1079 uops[name_x] = rep
1080
1081 return result
1082
1083
1084def add_op(op: parser.InstDef, uops: dict[str, Uop]) -> None:

Callers 2

add_opFunction · 0.85
desugar_instFunction · 0.85

Calls 10

UopClass · 0.85
analyze_stackFunction · 0.85
analyze_cachesFunction · 0.85
find_variable_storesFunction · 0.85
compute_propertiesFunction · 0.85
strFunction · 0.85
variable_usedFunction · 0.85
scalarize_stackFunction · 0.85
startswithMethod · 0.45
splitMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…