(
name: str,
op: parser.InstDef,
inputs: list[parser.InputEffect],
uops: dict[str, Uop],
)
| 1033 | return stack |
| 1034 | |
| 1035 | def 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 | |
| 1084 | def add_op(op: parser.InstDef, uops: dict[str, Uop]) -> None: |
no test coverage detected
searching dependent graphs…