Files
concrete/compilers/concrete-compiler/compiler/lib/Transforms/Batching.cpp
Andi Drebes 38e14446d6 feat(compiler): Batching: Add pattern folding operations on tensors of constants
This adds a new pattern to the batching pass that folds operations on
tensors of constants into new tensors of constants. E.g.,

  %cst = arith.constant dense<...> : tensor<Nxi9>
  %res = scf.for %i = %c0 to %cN {
    %cst_i9 = tensor.extract %cst[%i]
    %cst_i64 = arith.extui %cst_i9 : i64
    ...
  }

becomes:

  %cst = arith.constant dense<...> : tensor<Nxi64>
  %res = scf.for %i = %c0 to %cN {
    %cst_i64 = tensor.extract %cst[%i]
    ...
  }

The pattern only works for static loops, indexes that are quasi-affine
expressions on single loop induction variables with a constant step
size across iterations and foldable operations that have a single
result.
2023-06-12 22:51:30 +01:00

85 KiB