Skip to content

Commit fea1d26

Browse files
committed
Apply commit review and temporary fix of Slice and ReduceMean PULP constraints, according to Issue #134
1 parent 97f7c83 commit fea1d26

File tree

5 files changed

+68
-57
lines changed

5 files changed

+68
-57
lines changed

Deeploy/Targets/PULPOpen/Bindings.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,17 @@
154154

155155
PULPSliceBindings = [
156156
NodeBinding(
157-
SliceChecker([
158-
PointerClass(type),
159-
PointerClass(uint8_t),
160-
PointerClass(uint8_t),
161-
PointerClass(uint8_t),
162-
PointerClass(uint8_t)
163-
], [PointerClass(type)]), SliceTemplate.referenceTemplate, ForkTransformer) for type in FloatDataTypes
157+
SliceChecker(
158+
[
159+
PointerClass(float_type), # data_in
160+
PointerClass(int_type), # starts
161+
PointerClass(int_type), # ends
162+
PointerClass(int_type), # axes
163+
PointerClass(int_type) # steps
164+
],
165+
[PointerClass(float_type)]),
166+
SliceTemplate.referenceTemplate,
167+
ForkTransformer) for float_type in FloatDataTypes for int_type in IntegerDataTypes
164168
]
165169

166170
PULPReshapeBindings = [

Deeploy/Targets/PULPOpen/TileConstraints/ReduceMeanConstraint.py

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -108,27 +108,31 @@ def serializeTilingSolution(
108108

109109
# Prepare replacement lists for the elements inside the operator representation,
110110
# for the cubes to be computed further down in this function
111+
112+
# ~~~~~ SEE ISSUE #134: https://github.com/pulp-platform/Deeploy/issues/134 ~~~~~
113+
# Freeze tiling input and output tiling for now
111114
replacements: Dict[str, List[int]] = {
112-
"data_in_shape": [],
113-
"data_out_shape": [],
115+
# "data_in_shape": [],
116+
# "data_out_shape": [],
114117
"size": [],
115118
}
116119

117120
replacementTypes = {
118-
"data_in_shape": [
119-
PointerClass(uint16_t),
120-
PointerClass(uint16_t),
121-
PointerClass(uint16_t),
122-
PointerClass(uint16_t)
123-
],
124-
"data_out_shape": [
125-
PointerClass(uint16_t),
126-
PointerClass(uint16_t),
127-
PointerClass(uint16_t),
128-
PointerClass(uint16_t)
129-
],
121+
# "data_in_shape": [
122+
# PointerClass(uint16_t),
123+
# PointerClass(uint16_t),
124+
# PointerClass(uint16_t),
125+
# PointerClass(uint16_t)
126+
# ],
127+
# "data_out_shape": [
128+
# PointerClass(uint16_t),
129+
# PointerClass(uint16_t),
130+
# PointerClass(uint16_t),
131+
# PointerClass(uint16_t)
132+
# ],
130133
"size": PointerClass(uint16_t),
131134
}
135+
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
132136

133137
# Prepare loading schedule lists
134138
inputLoadSchedule = []
@@ -141,8 +145,11 @@ def serializeTilingSolution(
141145
parseDict = operatorRepresentation)
142146

143147
# Append replacement elements
144-
replacements["data_in_shape"].append(list(in_cube.dims).copy())
145-
replacements["data_out_shape"].append(list(out_cube.dims).copy())
148+
# ~~~~~ SEE ISSUE #134: https://github.com/pulp-platform/Deeploy/issues/134 ~~~~~
149+
# Freeze tiling input and output tiling for now
150+
# replacements["data_in_shape"].append(list(in_cube.dims).copy())
151+
# replacements["data_out_shape"].append(list(out_cube.dims).copy())
152+
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
146153
replacements["size"].append(int(np.prod(out_cube.dims)))
147154

148155
# Append new cubes

Deeploy/Targets/PULPOpen/TileConstraints/SliceConstraint.py

Lines changed: 32 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -112,33 +112,37 @@ def serializeTilingSolution(
112112

113113
# Prepare replacement lists for the elements inside the operator representation,
114114
# for the cubes to be computed further down in this function
115+
116+
# ~~~~~ SEE ISSUE #134: https://github.com/pulp-platform/Deeploy/issues/134 ~~~~~
117+
# Freeze tiling input and output tiling for now
115118
replacements = {
116-
"data_in_shape": [],
117-
"data_out_shape": [],
118-
"starts": [[
119-
0,
120-
] * len(operatorRepresentation['axes'])] * len(outputCubes),
121-
"ends": [],
119+
# "data_in_shape": [],
120+
# "data_out_shape": [],
121+
# "starts": [[
122+
# 0,
123+
# ] * len(operatorRepresentation['axes'])] * len(outputCubes),
124+
# "ends": [],
122125
"data_in_size": [],
123126
}
124127

125128
replacementTypes = {
126-
"data_in_shape": [
127-
PointerClass(uint16_t),
128-
PointerClass(uint16_t),
129-
PointerClass(uint16_t),
130-
PointerClass(uint16_t)
131-
],
132-
"data_out_shape": [
133-
PointerClass(uint16_t),
134-
PointerClass(uint16_t),
135-
PointerClass(uint16_t),
136-
PointerClass(uint16_t)
137-
],
138-
"starts": PointerClass(uint16_t),
139-
"ends": PointerClass(uint16_t),
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),
140143
"data_in_size": PointerClass(uint16_t),
141144
}
145+
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
142146

143147
# Prepare loading schedule lists
144148
inputLoadSchedule = []
@@ -154,9 +158,14 @@ def serializeTilingSolution(
154158
new_ends.append(in_cube.offset[ax] + in_cube.dims[ax])
155159

156160
# Append replacement elements
157-
replacements["data_in_shape"].append(list(in_cube.dims).copy())
158-
replacements["data_out_shape"].append(list(out_cube.dims).copy())
159-
replacements["ends"].append(new_ends)
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+
160169
replacements["data_in_size"].append(int(np.prod(in_cube.dims)))
161170

162171
# Append new cubes

Deeploy/TilingExtension/TilingCodegen.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -165,16 +165,7 @@ def minimizeVariableReplacement(
165165
newRepTypes = {}
166166

167167
for key, value in scheme.perTileReplacements.items():
168-
more_than_one_unique_item = False
169-
items_checked = list()
170-
for item in value:
171-
if item not in items_checked:
172-
items_checked.append(item)
173-
if len(items_checked) > 1:
174-
more_than_one_unique_item = True
175-
break
176-
177-
if more_than_one_unique_item:
168+
if len(set(value)) > 1:
178169
newPerTileRep[key] = scheme.perTileReplacements[key]
179170
newRepTypes[key] = scheme.replacementTypes[key]
180171
else:

TargetLibraries/PULPOpen/src/DWConvolution_fp32.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ void PULP_DW_Conv2d_Im2Col_fp32_fp32_fp32_HWC(
1818

1919
// Compute core information
2020
int8_t core_id = pi_core_id();
21-
int8_t log2Core = (int8_t)log2(NUM_CORES);
21+
int8_t log2Core = LOG2(NUM_CORES);
2222

2323
// Compute the chunk size for each core
2424
// (Splitting work along the output channels)

0 commit comments

Comments
 (0)