Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Deeploy/Targets/Generic/Parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,12 @@ def parseNodeCtxt(self,
ctxt.hoistConstant(axesTensor)
node.inputs.append(axesTensor)
if len(node.inputs) <= 4:
values = np.ones((self.operatorRepresentation['dims']))
values = np.ones((self.operatorRepresentation['dims']), dtype = np.int64)
stepsTensor = gs.Constant(f'{node.name}_Steps_Tensor', values = values)

ctxt.hoistConstant(stepsTensor)
ctxt.addUser(stepsTensor.name, node)

node.inputs.append(stepsTensor)

self.operatorRepresentation['starts'] = node.inputs[1].name
Expand Down
53 changes: 20 additions & 33 deletions Deeploy/Targets/PULPOpen/TileConstraints/SliceConstraint.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,36 +113,25 @@ def serializeTilingSolution(
# Prepare replacement lists for the elements inside the operator representation,
# for the cubes to be computed further down in this function

# ~~~~~ SEE ISSUE #134: https://github.com/pulp-platform/Deeploy/issues/134 ~~~~~
# Freeze tiling input and output tiling for now
# Build replacementTypes based on the actual number of dimensions
data_in_shape_type = [PointerClass(uint16_t) for _ in range(len(operatorRepresentation['data_in_shape']))]
data_out_shape_type = [PointerClass(uint16_t) for _ in range(len(operatorRepresentation['data_out_shape']))]

replacements = {
# "data_in_shape": [],
# "data_out_shape": [],
# "starts": [[
# 0,
# ] * len(operatorRepresentation['axes'])] * len(outputCubes),
# "ends": [],
"data_in_shape": [],
"data_out_shape": [],
"starts": [],
"ends": [],
"data_in_size": [],
}

replacementTypes = {
# "data_in_shape": [
# PointerClass(uint16_t),
# PointerClass(uint16_t),
# PointerClass(uint16_t),
# PointerClass(uint16_t)
# ],
# "data_out_shape": [
# PointerClass(uint16_t),
# PointerClass(uint16_t),
# PointerClass(uint16_t),
# PointerClass(uint16_t)
# ],
# "starts": PointerClass(uint16_t),
# "ends": PointerClass(uint16_t),
"data_in_shape": data_in_shape_type,
"data_out_shape": data_out_shape_type,
"starts": PointerClass(uint16_t),
"ends": PointerClass(uint16_t),
"data_in_size": PointerClass(uint16_t),
}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

# Prepare loading schedule lists
inputLoadSchedule = []
Expand All @@ -152,20 +141,18 @@ def serializeTilingSolution(
# Compute input cube
in_cube = SliceTileConstraint.computeInputCubeFromOutputCube(out_cube, parseDict = operatorRepresentation)

# Compute new ends for replacement
# Compute new starts and ends for replacement
new_starts = list()
new_ends = list()
for ax in operatorRepresentation['axes']:
new_starts.append(in_cube.offset[ax])
new_ends.append(in_cube.offset[ax] + in_cube.dims[ax])

# Append replacement elements

# ~~~~~ SEE ISSUE #134: https://github.com/pulp-platform/Deeploy/issues/134 ~~~~~
# Freeze tiling input and output tiling for now
# replacements["data_in_shape"].append(list(in_cube.dims).copy())
# replacements["data_out_shape"].append(list(out_cube.dims).copy())
# replacements["ends"].append(new_ends)
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

# Append replacement elements (using tuples so they can be hashed by minimizeVariableReplacement)
replacements["data_in_shape"].append(tuple(in_cube.dims))
replacements["data_out_shape"].append(tuple(out_cube.dims))
replacements["starts"].append(tuple(new_starts))
replacements["ends"].append(tuple(new_ends))
replacements["data_in_size"].append(int(np.prod(in_cube.dims)))

# Append new cubes
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
 deeploy_test_gen:Ø
1starts_c"Constant*
value*: Bstarts 
-ends_c"Constant*
value*:@Bends 
-axes_c"Constant*
value*:Baxes 
/steps_c"Constant*
value*:Bsteps 
E
input
starts_c
ends_c
axes_c
steps_coutput
slice_node"Slice
SliceGraphZ
input


1

`b
output


1

 B
Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
 deeploy_test_gen:Ø
1starts_c"Constant*
value*:@Bstarts 
-ends_c"Constant*
value*:`Bends 
-axes_c"Constant*
value*:Baxes 
/steps_c"Constant*
value*:Bsteps 
E
input
starts_c
ends_c
axes_c
steps_coutput
slice_node"Slice
SliceGraphZ
input


1

`b
output


1

 B
Expand Down
Binary file not shown.
Loading