Skip to content

Conversation

@EmilySillars
Copy link
Collaborator

  %cst = arith.constant 0.000000e+00 : f64
  ... // omitted some IR here for brevity
  %8 = tensor.empty() : tensor<1x161xf64>
  %cst_1 = arith.constant 0.000000e+00 : f64
  %padded = tensor.pad %8 low[0, 0] high[0, 7] {
  ^bb0(%arg0: index, %arg1: index):
    tensor.yield %cst_1 : f64
  } : tensor<1x161xf64> to tensor<1x168xf64>
  %9 = linalg.fill ins(%cst : f64) outs(%padded : tensor<1x168xf64>) -> tensor<1x168xf64>

Instead of creating a tensor of size 1x161, padding it to 1x168 and then filling that tensor with zeroes, we should just create an empty tensor of 1x168 and fill with zeroes (no padding operation). It's important to remove the unnecessary padding operation, because later at bufferization, this results in an extra allocOp in L1 that we do not need.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant