Skip to content

Instantly share code, notes, and snippets.

@AmosLewis
Created October 6, 2022 18:22
Show Gist options
  • Save AmosLewis/175addabf5b6c9f0056d8a8f2ef6b3c0 to your computer and use it in GitHub Desktop.
Save AmosLewis/175addabf5b6c9f0056d8a8f2ef6b3c0 to your computer and use it in GitHub Desktop.
tosaselect
func.func @select_fp32(%arg0: tensor<1x1x5x5xi1>, %arg1: tensor<1x12x5x5xf32>, %arg2: tensor<f32>) -> tensor<1x12x5x5xf32> {
%0 = "tosa.select"(%arg0, %arg1, %arg2) : (tensor<1x1x5x5xi1>, tensor<1x12x5x5xf32>, tensor<f32>) -> tensor<1x12x5x5xf32>
return %0 : tensor<1x12x5x5xf32>
}
@AmosLewis
Copy link
Author

cmake -G Ninja ../llvm \
   -DLLVM_ENABLE_PROJECTS=mlir \
   -DCMAKE_C_COMPILER=clang \
   -DCMAKE_CXX_COMPILER=clang++ \
   -DLLVM_CCACHE_BUILD=ON \
   -DLLVM_BUILD_EXAMPLES=ON \
   -DLLVM_TARGETS_TO_BUILD="X86" \
   -DCMAKE_BUILD_TYPE=Release \
   -DLLVM_ENABLE_ASSERTIONS=ON
cmake --build . --target check-mlir

@AmosLewis
Copy link
Author

Without rank changed:

➜  build git:(tosa-to-linalg) cmake -G Ninja ../llvm \
   -DLLVM_ENABLE_PROJECTS=mlir \
   -DCMAKE_C_COMPILER=clang \
   -DCMAKE_CXX_COMPILER=clang++ \
   -DLLVM_CCACHE_BUILD=ON \
   -DLLVM_BUILD_EXAMPLES=ON \
   -DLLVM_TARGETS_TO_BUILD="X86" \
   -DCMAKE_BUILD_TYPE=Release \
   -DLLVM_ENABLE_ASSERTIONS=ON
cmake --build . --target check-mlir
-- bolt project is disabled
-- clang project is disabled
-- clang-tools-extra project is disabled
-- compiler-rt project is disabled
-- cross-project-tests project is disabled
-- libc project is disabled
-- libclc project is disabled
-- lld project is disabled
-- lldb project is disabled
-- mlir project is enabled
-- openmp project is disabled
-- polly project is disabled
-- pstl project is disabled
-- flang project is disabled
-- Could NOT find LibEdit (missing: LibEdit_INCLUDE_DIRS LibEdit_LIBRARIES) 
-- Native target architecture is X86
-- Threads enabled.
-- Doxygen disabled.
-- Go bindings disabled.
-- Ninja version: 1.10.0
-- Could NOT find OCaml (missing: OCAMLFIND OCAML_VERSION OCAML_STDLIB_PATH) 
-- Could NOT find OCaml (missing: OCAMLFIND OCAML_VERSION OCAML_STDLIB_PATH) 
-- OCaml bindings disabled.
-- LLVM host triple: x86_64-unknown-linux-gnu
-- LLVM default target triple: x86_64-unknown-linux-gnu
-- Building with -fPIC
-- Targeting X86
-- Registering Bye as a pass plugin (static build: OFF)
-- LLVM FileCheck Found: /home/chi/src/ubuntu20/shark/torch-mlir/build/bin/FileCheck
-- git version: v0.0.0-dirty normalized to 0.0.0
-- Version: 1.6.0
-- Performing Test HAVE_THREAD_SAFETY_ATTRIBUTES -- failed to compile
-- Performing Test HAVE_GNU_POSIX_REGEX -- failed to compile
-- Performing Test HAVE_POSIX_REGEX -- success
-- Performing Test HAVE_STEADY_CLOCK -- success
-- Configuring done
-- Generating done
-- Build files have been written to: /home/chi/src/ubuntu20/shark/llvm-project/build
[2963/2964] Running the MLIR regression tests
FAIL: MLIR :: Conversion/TosaToLinalg/tosa-to-linalg.mlir (140 of 1495)
******************** TEST 'MLIR :: Conversion/TosaToLinalg/tosa-to-linalg.mlir' FAILED ********************
Script:
--
: 'RUN: at line 1';   /home/chi/src/ubuntu20/shark/llvm-project/build/bin/mlir-opt --split-input-file -pass-pipeline="func.func(tosa-to-linalg)" /home/chi/src/ubuntu20/shark/llvm-project/mlir/test/Conversion/TosaToLinalg/tosa-to-linalg.mlir -verify-diagnostics -o -| /home/chi/src/ubuntu20/shark/llvm-project/build/bin/FileCheck /home/chi/src/ubuntu20/shark/llvm-project/mlir/test/Conversion/TosaToLinalg/tosa-to-linalg.mlir
--
Exit Code: 1

Command Output (stderr):
--
within split at /home/chi/src/ubuntu20/shark/llvm-project/mlir/test/Conversion/TosaToLinalg/tosa-to-linalg.mlir:1994 offset :16:8: error: unexpected error: 'linalg.generic' op expected indexing_map #2 to have 4 dim(s) to match the number of loops
  %0 = "tosa.select"(%arg0, %arg1, %arg2) : (tensor<1x1x5x5xi1>, tensor<1x12x5x5xf32>, tensor<f32>) -> tensor<1x12x5x5xf32>
       ^
/home/chi/src/ubuntu20/shark/llvm-project/mlir/test/Conversion/TosaToLinalg/tosa-to-linalg.mlir:1996:17: error: CHECK-LABEL: expected string not found in input
// CHECK-LABEL: func.func @select_fp32(
                ^
<stdin>:2214:23: note: scanning from here
 func.func @resize_dyn(%arg0: tensor<?x2x2x1xi8>) {
                      ^
<stdin>:2263:2: note: possible intended match here
 %33 = arith.select %32, %c0_i32, %19 : i32
 ^

Input file: <stdin>
Check file: /home/chi/src/ubuntu20/shark/llvm-project/mlir/test/Conversion/TosaToLinalg/tosa-to-linalg.mlir

-dump-input=help explains the following input dump.

Input was:
<<<<<<
              .
              .
              .
           2209:  
           2210:  
           2211: // ----- 
           2212: #map = affine_map<(d0, d1, d2, d3) -> (d0, d1, d2, d3)> 
           2213: module { 
           2214:  func.func @resize_dyn(%arg0: tensor<?x2x2x1xi8>) { 
label:1996'0                           X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
           2215:  %c0 = arith.constant 0 : index 
label:1996'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           2216:  %dim = tensor.dim %arg0, %c0 : tensor<?x2x2x1xi8> 
label:1996'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           2217:  %0 = tensor.empty(%dim) : tensor<?x4x4x1xi32> 
label:1996'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           2218:  %1 = linalg.generic {indexing_maps = [#map], iterator_types = ["parallel", "parallel", "parallel", "parallel"]} outs(%0 : tensor<?x4x4x1xi32>) { 
label:1996'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           2219:  ^bb0(%out: i32): 
label:1996'0     ~~~~~~~~~~~~~~~~~~
              .
              .
              .
           2258:  %28 = arith.cmpi slt, %13, %c0_i32 : i32 
label:1996'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           2259:  %29 = arith.select %28, %c0_i32, %13 : i32 
label:1996'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           2260:  %30 = arith.cmpi slt, %c1_i32_0, %13 : i32 
label:1996'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           2261:  %31 = arith.select %30, %c1_i32_0, %29 : i32 
label:1996'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           2262:  %32 = arith.cmpi slt, %19, %c0_i32 : i32 
label:1996'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           2263:  %33 = arith.select %32, %c0_i32, %19 : i32 
label:1996'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
label:1996'1      ?                                           possible intended match
           2264:  %34 = arith.cmpi slt, %c1_i32_0, %19 : i32 
label:1996'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           2265:  %35 = arith.select %34, %c1_i32_0, %33 : i32 
label:1996'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           2266:  %36 = arith.index_cast %23 : i32 to index 
label:1996'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           2267:  %37 = arith.index_cast %27 : i32 to index 
label:1996'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           2268:  %38 = arith.index_cast %31 : i32 to index 
label:1996'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
              .
              .
              .
>>>>>>

--

********************
********************
Failed Tests (1):
  MLIR :: Conversion/TosaToLinalg/tosa-to-linalg.mlir


Testing Time: 13.65s
  Unsupported:  270
  Passed     : 1478
  Failed     :    1
FAILED: tools/mlir/test/CMakeFiles/check-mlir 
cd /home/chi/src/ubuntu20/shark/llvm-project/build/tools/mlir/test && /usr/bin/python3.8 /home/chi/src/ubuntu20/shark/llvm-project/build/./bin/llvm-lit -sv /home/chi/src/ubuntu20/shark/llvm-project/build/tools/mlir/test
ninja: build stopped: subcommand failed.
➜  build git:(tosa-to-linalg) ✗ 


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