Skip to content

Instantly share code, notes, and snippets.

@Hardcode84
Created August 12, 2023 23:11
Show Gist options
  • Save Hardcode84/8e55de4009e190af59cd2e7c25ebdbfa to your computer and use it in GitHub Desktop.
Save Hardcode84/8e55de4009e190af59cd2e7c25ebdbfa to your computer and use it in GitHub Desktop.
E #map = affine_map<(d0, d1) -> (0)>
E #map1 = affine_map<(d0, d1) -> (d0, d1)>
E module attributes {numba.pipeline_jump_markers = []} {
E func.func @_ZN10numba_mlir4mlir5tests10test_numpy18_3clambda_3e_24868B38c8tJTIeFKzyJ2IIShY4CrhQElQZ6HszSBAA_3dE10FixedArrayIiLi2E1C7mutable7alignedE(%arg0: !ntensor.ntensor<?x?xsi32 : "C"> {numba.restrict, numba.shape_range = [#numba_util.index_range<[2, 9223372036854775807]>, #numba_util.index_range<[2, 9223372036854775807]>]}) -> !ntensor.ntensor<?x?xsi32 : "C"> attributes {gpu_runtime.fp64_truncate = false, gpu_runtime.use_64bit_index = true, numba.force_inline, numba.opt_level = 3 : i64, plier.contigious_arrays = [true]} {
E %c0 = arith.constant 0 : index
E %c1 = arith.constant 1 : index
E %c0_i64 = arith.constant 0 : i64
E %0 = ntensor.to_tensor %arg0 : !ntensor.ntensor<?x?xsi32 : "C"> to tensor<?x?xsi32>
E %dim = ntensor.dim %arg0, %c0 : !ntensor.ntensor<?x?xsi32 : "C">
E %dim_0 = ntensor.dim %arg0, %c1 : !ntensor.ntensor<?x?xsi32 : "C">
E %1 = tensor.empty(%dim, %dim_0) : tensor<?x?xsi32>
E %2 = numba_util.sign_cast %c0_i64 : i64 to si64
E %from_elements = tensor.from_elements %2 : tensor<1xsi64>
E %3 = linalg.generic {indexing_maps = [#map, #map1, #map1], iterator_types = ["parallel", "parallel"]} ins(%from_elements, %0 : tensor<1xsi64>, tensor<?x?xsi32>) outs(%1 : tensor<?x?xsi32>) {
E ^bb0(%in: si64, %in_1: si32, %out: si32):
E %5 = scf.execute_region -> si32 {
E %6 = "plier.global"() {name = "_linalg_index"} : () -> !plier.function
E %7 = "plier.const"() {val = 0 : si64} : () -> si64
E %8 = "plier.binop"(%7, %7) {op = "+"} : (si64, si64) -> si64
E %9 = "plier.call"(%6, %8) {func_name = "_linalg_index", kw_names = [], operandSegmentSizes = array<i32: 1, 1, 0, 0>} : (!plier.function, si64) -> si64
E %10 = "plier.const"() {val = 1 : si64} : () -> si64
E %11 = "plier.binop"(%7, %10) {op = "+"} : (si64, si64) -> si64
E %12 = "plier.call"(%6, %11) {func_name = "_linalg_index", kw_names = [], operandSegmentSizes = array<i32: 1, 1, 0, 0>} : (!plier.function, si64) -> si64
E %13 = "plier.binop"(%12, %9) {op = "-"} : (si64, si64) -> si64
E %14 = "plier.binop"(%13, %in) {op = ">="} : (si64, si64) -> i1
E %15 = "plier.global"() {name = "bool"} : () -> !plier.function
E %16 = "plier.call"(%15, %14) {func_name = "bool", kw_names = [], operandSegmentSizes = array<i32: 1, 1, 0, 0>} : (!plier.function, i1) -> i1
E cf.cond_br %16, ^bb2(%in_1 : si32), ^bb1
E ^bb1: // pred: ^bb0
E %17 = "plier.global"() {name = "np_dtype"} : () -> !numba_util.typevar<si32>
E %18 = "plier.call"(%17, %7) {func_name = "$number.int32", kw_names = [], operandSegmentSizes = array<i32: 1, 1, 0, 0>} : (!numba_util.typevar<si32>, si64) -> si32
E cf.br ^bb2(%18 : si32)
E ^bb2(%19: si32): // 2 preds: ^bb0, ^bb1
E scf.yield %19 : si32
E }
E linalg.yield %5 : si32
E } -> tensor<?x?xsi32>
E %4 = ntensor.from_tensor %3 : tensor<?x?xsi32> to !ntensor.ntensor<?x?xsi32 : "C">
E return %4 : !ntensor.ntensor<?x?xsi32 : "C">
E }
E }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment