Skip to content

Commit

Permalink
calculate transfer len with less lines of code
Browse files Browse the repository at this point in the history
  • Loading branch information
hunhoffe committed Nov 14, 2024
1 parent 259b2a6 commit 10b386b
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions python/dialects/aiex.py
Original file line number Diff line number Diff line change
Expand Up @@ -853,12 +853,8 @@ def shim_dma_bd(
strides = [0] * 3 + [1]

if transfer_len is None:
if len(sizes) >= 4:
# For shim dma bd, highest dimension is repeat count which is not included in the length
transfer_len = np.prod(sizes[1:])
else:
# If does not have highest dimension, then we can take the product of all dimensions
transfer_len = np.prod(sizes)
transfer_len = np.prod(sizes[-3:])

dimensions = list(zip(sizes, strides))
dma_bd(mem, offset=offset, len=transfer_len, dimensions=dimensions)

Expand Down

0 comments on commit 10b386b

Please sign in to comment.