@@ -113,36 +113,25 @@ def serializeTilingSolution(
113113 # Prepare replacement lists for the elements inside the operator representation,
114114 # for the cubes to be computed further down in this function
115115
116- # ~~~~~ SEE ISSUE #134: https://github.com/pulp-platform/Deeploy/issues/134 ~~~~~
117- # Freeze tiling input and output tiling for now
116+ # Build replacementTypes based on the actual number of dimensions
117+ data_in_shape_type = [PointerClass (uint16_t ) for _ in range (len (operatorRepresentation ['data_in_shape' ]))]
118+ data_out_shape_type = [PointerClass (uint16_t ) for _ in range (len (operatorRepresentation ['data_out_shape' ]))]
119+
118120 replacements = {
119- # "data_in_shape": [],
120- # "data_out_shape": [],
121- # "starts": [[
122- # 0,
123- # ] * len(operatorRepresentation['axes'])] * len(outputCubes),
124- # "ends": [],
121+ "data_in_shape" : [],
122+ "data_out_shape" : [],
123+ "starts" : [],
124+ "ends" : [],
125125 "data_in_size" : [],
126126 }
127127
128128 replacementTypes = {
129- # "data_in_shape": [
130- # PointerClass(uint16_t),
131- # PointerClass(uint16_t),
132- # PointerClass(uint16_t),
133- # PointerClass(uint16_t)
134- # ],
135- # "data_out_shape": [
136- # PointerClass(uint16_t),
137- # PointerClass(uint16_t),
138- # PointerClass(uint16_t),
139- # PointerClass(uint16_t)
140- # ],
141- # "starts": PointerClass(uint16_t),
142- # "ends": PointerClass(uint16_t),
129+ "data_in_shape" : data_in_shape_type ,
130+ "data_out_shape" : data_out_shape_type ,
131+ "starts" : PointerClass (uint16_t ),
132+ "ends" : PointerClass (uint16_t ),
143133 "data_in_size" : PointerClass (uint16_t ),
144134 }
145- # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
146135
147136 # Prepare loading schedule lists
148137 inputLoadSchedule = []
@@ -152,20 +141,18 @@ def serializeTilingSolution(
152141 # Compute input cube
153142 in_cube = SliceTileConstraint .computeInputCubeFromOutputCube (out_cube , parseDict = operatorRepresentation )
154143
155- # Compute new ends for replacement
144+ # Compute new starts and ends for replacement
145+ new_starts = list ()
156146 new_ends = list ()
157147 for ax in operatorRepresentation ['axes' ]:
148+ new_starts .append (in_cube .offset [ax ])
158149 new_ends .append (in_cube .offset [ax ] + in_cube .dims [ax ])
159150
160- # Append replacement elements
161-
162- # ~~~~~ SEE ISSUE #134: https://github.com/pulp-platform/Deeploy/issues/134 ~~~~~
163- # Freeze tiling input and output tiling for now
164- # replacements["data_in_shape"].append(list(in_cube.dims).copy())
165- # replacements["data_out_shape"].append(list(out_cube.dims).copy())
166- # replacements["ends"].append(new_ends)
167- # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
168-
151+ # Append replacement elements (using tuples so they can be hashed by minimizeVariableReplacement)
152+ replacements ["data_in_shape" ].append (tuple (in_cube .dims ))
153+ replacements ["data_out_shape" ].append (tuple (out_cube .dims ))
154+ replacements ["starts" ].append (tuple (new_starts ))
155+ replacements ["ends" ].append (tuple (new_ends ))
169156 replacements ["data_in_size" ].append (int (np .prod (in_cube .dims )))
170157
171158 # Append new cubes
0 commit comments