Skip to content
Snippets Groups Projects
Commit 6573d1ff authored by mmrahorovic's avatar mmrahorovic
Browse files

[custom_op]: work-around for passing remainder size to HLS op

parent c906ea0d
No related branches found
No related tags found
No related merge requests found
...@@ -202,17 +202,21 @@ class StreamingMaxPool_Batch(HLSCustomOp): ...@@ -202,17 +202,21 @@ class StreamingMaxPool_Batch(HLSCustomOp):
ifm_dim, k, ifm_ch = self.get_1d_attrs_normalized() ifm_dim, k, ifm_ch = self.get_1d_attrs_normalized()
ceil_mode = self.get_nodeattr("CeilMode") ceil_mode = self.get_nodeattr("CeilMode")
output_size = compute_pool_output_dim(ifm_dim[1], k[1], k[1], 0, ceil_mode) output_size = compute_pool_output_dim(ifm_dim[1], k[1], k[1], 0, ceil_mode)
remainder_size = ifm_dim[1] - k[1] * output_size
if remainder_size < 0:
remainder_size = 0
if self.is_1d(): if self.is_1d():
self.code_gen_dict["$DEFINES$"] = [ self.code_gen_dict["$DEFINES$"] = [
"""#define ImgDim {}\n #define PoolDim {}\n """#define ImgDim {}\n #define PoolDim {}\n
#define NumChannels {}\n #define PE {}\n #define OutputSize {} #define NumChannels {}\n #define PE {}\n #define OutputSize {}
\n #define numReps {}""".format( \n #define RemainderSize {}\n #define numReps {}""".format(
ifm_dim[1], ifm_dim[1],
k[1], k[1],
self.get_nodeattr("NumChannels"), self.get_nodeattr("NumChannels"),
self.get_nodeattr("PE"), self.get_nodeattr("PE"),
output_size, output_size,
remainder_size,
numReps, numReps,
) )
] ]
...@@ -272,7 +276,7 @@ class StreamingMaxPool_Batch(HLSCustomOp): ...@@ -272,7 +276,7 @@ class StreamingMaxPool_Batch(HLSCustomOp):
op = "StreamingMaxPool_Precision_1d" op = "StreamingMaxPool_Precision_1d"
self.code_gen_dict["$DOCOMPUTE$"] = [ self.code_gen_dict["$DOCOMPUTE$"] = [
"""%s<ImgDim, PoolDim, NumChannels, PE, """%s<ImgDim, PoolDim, NumChannels, PE,
OutputSize, %s, %s>(in0, out);""" OutputSize, RemainderSize, %s, %s>(in0, out);"""
% (op, dtype_hls, minval_str) % (op, dtype_hls, minval_str)
] ]
else: else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment