diff options
author | Louis Verhaard <louis.verhaard@arm.com> | 2020-11-20 13:08:55 +0100 |
---|---|---|
committer | Louis Verhaard <louis.verhaard@arm.com> | 2020-11-26 17:18:48 +0100 |
commit | d2665804871d76a16d5962952ba95500e3977c56 (patch) | |
tree | ea7fc78d7dae7f4258939cd2cfa8cffad92e566d /ethosu/vela/architecture_features.py | |
parent | 603016ccaa6cdb1a9b6d4547c561e4b45c90d3d5 (diff) | |
download | ethos-u-vela-d2665804871d76a16d5962952ba95500e3977c56.tar.gz |
MLBEDSW-3562: Improve blockdep calculation
Blockdep calculation can now handle different sized IFM/OFM.
Change-Id: I898a3c1c3a6778916802f3dbfa658328e5093096
Signed-off-by: Louis Verhaard <louis.verhaard@arm.com>
Diffstat (limited to 'ethosu/vela/architecture_features.py')
-rw-r--r-- | ethosu/vela/architecture_features.py | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/ethosu/vela/architecture_features.py b/ethosu/vela/architecture_features.py index 9f27b7ed..64005bf5 100644 --- a/ethosu/vela/architecture_features.py +++ b/ethosu/vela/architecture_features.py @@ -510,12 +510,9 @@ class ArchitectureFeatures: start_coord[1] + ifm_block.height, start_coord[2] + ifm_block.depth, ) - return (start_coord, end_coord, 1) # start, end, total jobs - def get_prev_job_output_volume( - self, ifm: Rect, ofm: Rect, ifm_block_depth, ofm_block: Block, kernel: Kernel, block_offset - ): + def get_prev_job_output_volume(self, ofm: Rect, ofm_block: Block, block_offset): assert block_offset >= 0 # Get OFM block's volume coordinates @@ -527,28 +524,20 @@ class ArchitectureFeatures: start_coord[1] + ofm_block.height, start_coord[2] + ofm_block.depth, ) - - # Calculate how many IFM blocks this OFM block requires (i.e how many jobs) - ifm_depth_blocks = round_up_divide(ifm.size().depth, ifm_block_depth) - ifm_depth_blocks = 1 # Overwrite with 1 to force OFM block dependency, not IFM - - return (start_coord, end_coord, ifm_depth_blocks) # start, end, total jobs for this OFM block + return (start_coord, end_coord, 1) # start, end, total jobs for this OFM block def calc_block_dep( self, - prev_ifm: Rect, prev_ofm: Rect, - prev_ifm_block_depth, prev_ofm_block: Block, - prev_kernel: Kernel, ifm: Rect, ofm: Rect, ifm_block_depth, ofm_block: Block, kernel: Kernel, padLT, + intersects, ): - blockdep = ArchitectureFeatures.MAX_BLOCKDEP # Iterate over the next BLOCKDEP inputs, checking to see if a sliding window @@ -566,16 +555,14 @@ class ArchitectureFeatures: outstanding_jobs = 0 for block_offset in range(ArchitectureFeatures.MAX_BLOCKDEP): # This is the OFM block being generated by the previous op - out_area = self.get_prev_job_output_volume( - prev_ifm, prev_ofm, prev_ifm_block_depth, prev_ofm_block, prev_kernel, block_offset - ) + out_area = self.get_prev_job_output_volume(prev_ofm, prev_ofm_block, block_offset) if out_area is None: break # Block dependency is the max number of allowed outstanding jobs # in the pipeline. Selected by determining how many jobs occur # in between two operators' overlapping OFM->IFM block volumes - if ArchitectureFeatures.intersects(in_area[0], in_area[1], out_area[0], out_area[1]): + if intersects(in_area[0], in_area[1], out_area[0], out_area[1]): break # Early exit if no intersections and we've seen enough jobs in the pipeline elif outstanding_jobs > ArchitectureFeatures.MAX_BLOCKDEP: |