Repository navigation
Closed
Labels
compiler/dialectsRelating to the IREE compiler dialects (flow, hal, vm)performance ⚡Performance/optimization related work across the compiler and runtime
Description
Now that we are performing in-place operations there are flow.tensor.clones appearing to preserve correctness. In cases of wide fan-out these cause some pathological behavior:
%22 = flow.dispatch @serving_default_dispatch_21::@serving_default_dispatch_21[%c384, %c4, %c1]() : () -> tensor<1x4x384xf32>
%23 = flow.tensor.clone %22 : tensor<1x4x384xf32>
%24 = flow.tensor.clone %23 : tensor<1x4x384xf32>
%25 = flow.tensor.clone %24 : tensor<1x4x384xf32>
%26 = flow.tensor.clone %25 : tensor<1x4x384xf32>
%27 = flow.tensor.clone %26 : tensor<1x4x384xf32>
%28 = flow.tensor.clone %27 : tensor<1x4x384xf32>
%29 = flow.tensor.clone %28 : tensor<1x4x384xf32>
%30 = flow.tensor.clone %29 : tensor<1x4x384xf32>
%31 = flow.tensor.clone %30 : tensor<1x4x384xf32>
%32 = flow.tensor.clone %31 : tensor<1x4x384xf32>
%33 = flow.tensor.clone %32 : tensor<1x4x384xf32>
%34 = flow.tensor.clone %33 : tensor<1x4x384xf32>
%35 = flow.tensor.clone %34 : tensor<1x4x384xf32>
%36 = flow.tensor.clone %35 : tensor<1x4x384xf32>
%37 = flow.tensor.clone %36 : tensor<1x4x384xf32>
%38 = flow.tensor.clone %37 : tensor<1x4x384xf32>
%39 = flow.tensor.clone %38 : tensor<1x4x384xf32>
%40 = flow.tensor.clone %39 : tensor<1x4x384xf32>
%41 = flow.tensor.clone %40 : tensor<1x4x384xf32>
%42 = flow.tensor.clone %41 : tensor<1x4x384xf32>
%43 = flow.tensor.clone %42 : tensor<1x4x384xf32>
%44 = flow.tensor.clone %43 : tensor<1x4x384xf32>
%45 = flow.tensor.clone %44 : tensor<1x4x384xf32>
%46 = flow.dispatch @serving_default_dispatch_22::@serving_default_dispatch_22[%c384, %c4, %c1](%21, %22) : (tensor<4x384x384xf32>, tensor<1x4x384xf32>) -> %22
// uses of %23-%46 throughout the modelSome simple code motion will help here: sinking the clones to immediately prior to their use will shorten the lifetime of these transient tensors.
Metadata
Metadata
Assignees
Labels
compiler/dialectsRelating to the IREE compiler dialects (flow, hal, vm)performance ⚡Performance/optimization related work across the compiler and runtime
Activity
Insert clones prior to mutation and not where it originates.
Insert clones prior to mutation and not where it originates. (#5292)