brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · d97d6e5 Raw
39 lines · plain
1// RUN: mlir-opt %s --sparsification-and-bufferization        | FileCheck %s --check-prefix=CHECK-NOPARA2// RUN: mlir-opt %s --sparsification-and-bufferization="parallelization-strategy=any-storage-any-loop" | FileCheck %s --check-prefix=CHECK-PARA3 4// Test to ensure we can pass parallelization flags into5// the mini sparsification and bufferization pipeline.6 7#SparseMatrix = #sparse_tensor.encoding<{8  map = (d0, d1) -> (d0 : compressed, d1 : compressed)9}>10 11#trait_ss = {12  indexing_maps = [13    affine_map<(i,j) -> (i,j)>,  // A14    affine_map<(i,j) -> (i,j)>   // X (out)15  ],16  iterator_types = ["parallel", "parallel"],17  doc = "X(i,j) = A(i,j) * SCALE"18}19 20//21// CHECK-NOPARA-LABEL: func.func @scale_ss22// CHECK-NOPARA:       scf.for23//24// CHECK-PARA-LABEL: func.func @scale_ss25// CHECK-PARA:       scf.parallel26//27func.func @scale_ss(%scale: f32,28               %arga: tensor<?x?xf32, #SparseMatrix>,29	       %argx: tensor<?x?xf32>) -> tensor<?x?xf32> {30  %0 = linalg.generic #trait_ss31     ins(%arga: tensor<?x?xf32, #SparseMatrix>)32    outs(%argx: tensor<?x?xf32>) {33      ^bb(%a: f32, %x: f32):34        %0 = arith.mulf %a, %scale : f3235        linalg.yield %0 : f3236  } -> tensor<?x?xf32>37  return %0 : tensor<?x?xf32>38}39