Skip to content

Commit a911905

Browse files
committed
pythongh-134294: Fix Uop.replicated field definition and usage
1 parent 46d7c11 commit a911905

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

Tools/cases_generator/analyzer.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ class Uop:
182182
properties: Properties
183183
_size: int = -1
184184
implicitly_created: bool = False
185-
replicated = 0
185+
replicated: int = 0
186186
replicates: "Uop | None" = None
187187
# Size of the instruction(s), only set for uops containing the INSTRUCTION_SIZE macro
188188
instruction_size: int | None = None
@@ -866,6 +866,11 @@ def make_uop(
866866
inputs: list[parser.InputEffect],
867867
uops: dict[str, Uop],
868868
) -> Uop:
869+
replicated = 0
870+
for anno in op.annotations:
871+
if anno.startswith("replicate"):
872+
replicated = int(anno[10:-1])
873+
break
869874
result = Uop(
870875
name=name,
871876
context=op.context,
@@ -875,12 +880,9 @@ def make_uop(
875880
local_stores=find_variable_stores(op),
876881
body=op.block,
877882
properties=compute_properties(op),
883+
replicated=replicated,
878884
)
879-
for anno in op.annotations:
880-
if anno.startswith("replicate"):
881-
result.replicated = int(anno[10:-1])
882-
break
883-
else:
885+
if result.replicated == 0:
884886
return result
885887
for oparg in range(result.replicated):
886888
name_x = name + "_" + str(oparg)

0 commit comments

Comments
 (0)