Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FastMath results in Assertion `str.find('\0') == StringRef::npos && "Cannot create an identifer with a nul character"' failed. #8

Open
chriselrod opened this issue Apr 20, 2020 · 1 comment

Comments

@chriselrod
Copy link

chriselrod commented Apr 20, 2020

julia> import Brutus

julia> emit_lowered(f, tt...) =
           Brutus.emit(typeof(f), tt,
                       emit_llvm=false, # TODO: change to true when ready
                       dump_options=[Brutus.DumpLowered])
emit_lowered (generic function with 1 method)

julia> emit_lowered(+, Float64, Float64)


module {
  llvm.func @"+"(%arg0: !llvm.double, %arg1: !llvm.double) -> !llvm.double {
    %0 = llvm.mlir.undef : !llvm.void
    llvm.br ^bb1
  ^bb1: // pred: ^bb0
    %1 = llvm.fadd %arg0, %arg1 : !llvm.double
    llvm.return %1 : !llvm.double
  }
}
julia> function AmulB!(C, A, B)
           @inbounds @fastmath for m  1:size(A,1), n  1:size(B,2)
               Cₘₙ = zero(eltype(C))
               for k  1:size(A,2)
                   Cₘₙ += A[m,k] * B[k,n]
               end
               C[m,n] = Cₘₙ
           end
       end
AmulB! (generic function with 1 method)

julia> emit_lowered(AmulB!, Matrix{Float64}, Matrix{Float64}, Matrix{Float64})
julia: /home/chriselrod/Documents/languages/juliamlir/brutus/llvm-project/mlir/lib/IR/MLIRContext.cpp:430: static mlir::Identifier mlir::Identifier::get(llvm::StringRef, mlir::MLIRContext*): Assertion `str.find('\0') == StringRef::npos && "Cannot create an identifier with a nul character"' failed.

signal (6): Aborted
in expression starting at REPL[5]:1
gsignal at /usr/lib64/haswell/libc.so.6 (unknown line)
abort at /usr/lib64/haswell/libc.so.6 (unknown line)
unknown function (ip: 0x7fa3a2083753)
__assert_fail at /usr/lib64/haswell/libc.so.6 (unknown line)
get at /home/chriselrod/Documents/languages/juliamlir/brutus/llvm-project/mlir/lib/IR/MLIRContext.cpp:430
OperationName at /home/chriselrod/Documents/languages/juliamlir/brutus/llvm-project/mlir/lib/IR/Operation.cpp:43
OperationState at /home/chriselrod/Documents/languages/juliamlir/brutus/llvm-project/mlir/lib/IR/OperationSupport.cpp:24
rewrite at /home/chriselrod/Documents/languages/juliamlir/brutus/lib/Dialect/Julia/CallOp.cpp:46
matchAndRewrite at /home/chriselrod/Documents/languages/juliamlir/brutus/build/../llvm-project/llvm/../mlir/include/mlir/IR/PatternMatch.h:204 [inlined]
matchAndRewrite at /home/chriselrod/Documents/languages/juliamlir/brutus/build/../llvm-project/llvm/../mlir/include/mlir/IR/PatternMatch.h:190
matchAndRewrite at /home/chriselrod/Documents/languages/juliamlir/brutus/llvm-project/mlir/lib/IR/PatternMatch.cpp:189
simplify at /home/chriselrod/Documents/languages/juliamlir/brutus/llvm-project/mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp:198 [inlined]
applyPatternsGreedily at /home/chriselrod/Documents/languages/juliamlir/brutus/llvm-project/mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp:241
runOnOperation at /home/chriselrod/Documents/languages/juliamlir/brutus/llvm-project/mlir/lib/Transforms/Canonicalizer.cpp:34
run at /home/chriselrod/Documents/languages/juliamlir/brutus/llvm-project/mlir/lib/Pass/Pass.cpp:80
run at /home/chriselrod/Documents/languages/juliamlir/brutus/llvm-project/mlir/lib/Pass/Pass.cpp:233 [inlined]
runPipeline at /home/chriselrod/Documents/languages/juliamlir/brutus/llvm-project/mlir/lib/Pass/Pass.cpp:309 [inlined]
operator() at /home/chriselrod/Documents/languages/juliamlir/brutus/llvm-project/mlir/lib/Pass/Pass.cpp:466
for_each<llvm::SmallVector<mlir::OpPassManager, 1>*, mlir::detail::OpToOpPassAdaptorParallel::runOnOperation()::<lambda(llvm::MutableArrayRef<mlir::OpPassManager>)> > at /usr/include/c++/9/bits/stl_algo.h:3876 [inlined]
parallel_for_each<llvm::SmallVector<mlir::OpPassManager, 1>*, mlir::detail::OpToOpPassAdaptorParallel::runOnOperation()::<lambda(llvm::MutableArrayRef<mlir::OpPassManager>)> > at /home/chriselrod/Documents/languages/juliamlir/brutus/llvm-project/llvm/include/llvm/Support/Parallel.h:143 [inlined]
for_each<llvm::SmallVector<mlir::OpPassManager, 1>*, mlir::detail::OpToOpPassAdaptorParallel::runOnOperation()::<lambda(llvm::MutableArrayRef<mlir::OpPassManager>)> > at /home/chriselrod/Documents/languages/juliamlir/brutus/llvm-project/llvm/include/llvm/Support/Parallel.h:210 [inlined]
runOnOperation at /home/chriselrod/Documents/languages/juliamlir/brutus/llvm-project/mlir/lib/Pass/Pass.cpp:445
run at /home/chriselrod/Documents/languages/juliamlir/brutus/llvm-project/mlir/lib/Pass/Pass.cpp:80
run at /home/chriselrod/Documents/languages/juliamlir/brutus/llvm-project/mlir/lib/Pass/Pass.cpp:233 [inlined]
run at /home/chriselrod/Documents/languages/juliamlir/brutus/llvm-project/mlir/lib/Pass/Pass.cpp:588
brutus_codegen at /home/chriselrod/Documents/languages/juliamlir/brutus/lib/Codegen/Codegen.cpp:415
#emit#1 at /home/chriselrod/Documents/languages/juliamlir/brutus/Brutus/src/Brutus.jl:30
unknown function (ip: 0x7fa37a1dfe55)
emit##kw at /home/chriselrod/Documents/languages/juliamlir/brutus/Brutus/src/Brutus.jl:21 [inlined]
emit_lowered at ./REPL[2]:1
jl_apply at /home/chriselrod/Documents/languages/juliamlir/julia/src/julia.h:1691 [inlined]
do_call at /home/chriselrod/Documents/languages/juliamlir/julia/src/interpreter.c:369
eval_value at /home/chriselrod/Documents/languages/juliamlir/julia/src/interpreter.c:458
eval_stmt_value at /home/chriselrod/Documents/languages/juliamlir/julia/src/interpreter.c:409 [inlined]
eval_body at /home/chriselrod/Documents/languages/juliamlir/julia/src/interpreter.c:809
jl_interpret_toplevel_thunk at /home/chriselrod/Documents/languages/juliamlir/julia/src/interpreter.c:921
jl_toplevel_eval_flex at /home/chriselrod/Documents/languages/juliamlir/julia/src/toplevel.c:823
jl_toplevel_eval_flex at /home/chriselrod/Documents/languages/juliamlir/julia/src/toplevel.c:773
jl_toplevel_eval_flex at /home/chriselrod/Documents/languages/juliamlir/julia/src/toplevel.c:773
jl_toplevel_eval at /home/chriselrod/Documents/languages/juliamlir/julia/src/toplevel.c:832 [inlined]
jl_toplevel_eval_in at /home/chriselrod/Documents/languages/juliamlir/julia/src/toplevel.c:863
eval at ./boot.jl:331
eval_user_input at /home/chriselrod/Documents/languages/juliamlir/julia/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:132
repl_backend_loop at /home/chriselrod/Documents/languages/juliamlir/julia/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:193
start_repl_backend at /home/chriselrod/Documents/languages/juliamlir/julia/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:178
#run_repl#35 at /home/chriselrod/Documents/languages/juliamlir/julia/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:290
run_repl at /home/chriselrod/Documents/languages/juliamlir/julia/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:286
#803 at ./client.jl:384
unknown function (ip: 0x7fa37a18316f)
jl_apply at /home/chriselrod/Documents/languages/juliamlir/julia/src/julia.h:1691 [inlined]
do_apply at /home/chriselrod/Documents/languages/juliamlir/julia/src/builtins.c:650
jl_f__apply at /home/chriselrod/Documents/languages/juliamlir/julia/src/builtins.c:664 [inlined]
jl_f__apply_latest at /home/chriselrod/Documents/languages/juliamlir/julia/src/builtins.c:700
#invokelatest#1 at ./essentials.jl:710 [inlined]
invokelatest at ./essentials.jl:709 [inlined]
run_main_repl at ./client.jl:368
exec_options at ./client.jl:306
_start at ./client.jl:491
jfptr__start_52697 at /home/chriselrod/Documents/languages/juliamlir/julia/usr/lib/julia/sys.so (unknown line)
jl_apply at /home/chriselrod/Documents/languages/juliamlir/julia/ui/../src/julia.h:1691 [inlined]
true_main at /home/chriselrod/Documents/languages/juliamlir/julia/ui/repl.c:96
main at /home/chriselrod/Documents/languages/juliamlir/julia/ui/repl.c:217
__libc_start_main at /usr/lib64/haswell/libc.so.6 (unknown line)
_start at ../../../julia/julia (unknown line)
Allocations: 23267833 (Pool: 23261179; Big: 6654); GC: 23
fish: “../../../julia/julia --project=…” terminated by signal SIGABRT (Abort)

If I remove the @fastmath, I instead get error: module lowering failed:

julia> function AmulB!(C, A, B)
           @inbounds for m in 1:size(A,1), n in 1:size(B,2)
               Cmn = zero(eltype(C))
               for k in 1:size(A,2)
                   Cmn += A[m,k] * B[k,n]
               end
               C[m,n] = Cmn
           end
       end
AmulB! (generic function with 1 method)

julia> emit_lowered(AmulB!, Matrix{Float64}, Matrix{Float64}, Matrix{Float64})
loc(callsite("size"("array.jl":154:0) at "AmulB!"("REPL[3]":2:0))): error: failed to legalize operation 'jlir.arraysize'


module {
  func @"AmulB!"(%arg0: !jlir<"typeof(Main.AmulB!)">, %arg1: !jlir<"Array{Float64, 2}">, %arg2: !jlir<"Array{Float64, 2}">, %arg3: !jlir<"Array{Float64, 2}">) -> !jlir.Nothing {
    "jlir.goto"()[^bb2] : () -> ()
  ^bb1: // 2 preds: ^bb8, ^bb17
    %0 = "jlir.constant"() {value = #jlir.nothing} : () -> !jlir.Nothing
    "jlir.return"(%0) : (!jlir.Nothing) -> ()
  ^bb2: // pred: ^bb0
    %1 = "jlir.constant"() {value = #jlir<"1">} : () -> !jlir.Int64
    %2 = "jlir.arraysize"(%arg2, %1) : (!jlir<"Array{Float64, 2}">, !jlir.Int64) -> !jlir.Int64
    %3 = "jlir.sle_int"(%1, %2) : (!jlir.Int64, !jlir.Int64) -> !jlir.Bool
    %4 = "jlir.constant"() {value = #jlir<"0">} : () -> !jlir.Int64
    %5 = "jlir.ifelse"(%3, %2, %4) : (!jlir.Bool, !jlir.Int64, !jlir.Int64) -> !jlir.Int64
    %6 = "jlir.slt_int"(%5, %1) : (!jlir.Int64, !jlir.Int64) -> !jlir.Bool
    "jlir.gotoifnot"(%6)[^bb6, ^bb4] {operand_segment_sizes = dense<[1, 0, 0]> : vector<3xi32>} : (!jlir.Bool) -> ()
  ^bb3: // pred: ^bb26
    %7 = "jlir.add_int"(%71, %1) : (!jlir.Int64, !jlir.Int64) -> !jlir.Int64
    "jlir.goto"(%7, %7, %72)[^bb9] : (!jlir.Int64, !jlir.Int64, !jlir.Bool) -> ()
  ^bb4: // pred: ^bb2
    %8 = "jlir.constant"() {value = #jlir.true} : () -> !jlir.Bool
    %9 = "jlir.undef"() : () -> !jlir.Int64
    %10 = "jlir.undef"() : () -> !jlir.Int64
    "jlir.goto"(%8, %9, %10)[^bb8] : (!jlir.Bool, !jlir.Int64, !jlir.Int64) -> ()
  ^bb5: // pred: ^bb19
    "jlir.goto"(%48, %49)[^bb18] : (!jlir.Int64, !jlir.Int64) -> ()
  ^bb6: // pred: ^bb2
    %11 = "jlir.constant"() {value = #jlir.false} : () -> !jlir.Bool
    "jlir.goto"(%11, %1, %1)[^bb8] : (!jlir.Bool, !jlir.Int64, !jlir.Int64) -> ()
  ^bb7: // pred: ^bb21
    %12 = "jlir.add_int"(%43, %1) : (!jlir.Int64, !jlir.Int64) -> !jlir.Int64
    "jlir.goto"(%12, %12, %56)[^bb19] : (!jlir.Int64, !jlir.Int64, !jlir.Bool) -> ()
  ^bb8(%13: !jlir.Bool, %14: !jlir.Int64, %15: !jlir.Int64):    // 2 preds: ^bb4, ^bb6
    %16 = "jlir.not_int"(%13) : (!jlir.Bool) -> !jlir.Bool
    "jlir.gotoifnot"(%16, %14, %15)[^bb1, ^bb10] {operand_segment_sizes = dense<[1, 0, 2]> : vector<3xi32>} : (!jlir.Bool, !jlir.Int64, !jlir.Int64) -> ()
  ^bb9(%17: !jlir.Int64, %18: !jlir.Int64, %19: !jlir.Bool):    // 2 preds: ^bb3, ^bb28
    %20 = "jlir.not_int"(%19) : (!jlir.Bool) -> !jlir.Bool
    "jlir.gotoifnot"(%20, %76)[^bb21, ^bb15] {operand_segment_sizes = dense<[1, 1, 0]> : vector<3xi32>} : (!jlir.Bool, !jlir.Float64) -> ()
  ^bb10(%21: !jlir.Int64, %22: !jlir.Int64):    // 2 preds: ^bb8, ^bb13
    %23 = "jlir.constant"() {value = #jlir<"2">} : () -> !jlir.Int64
    %24 = "jlir.arraysize"(%arg3, %23) : (!jlir<"Array{Float64, 2}">, !jlir.Int64) -> !jlir.Int64
    %25 = "jlir.sle_int"(%1, %24) : (!jlir.Int64, !jlir.Int64) -> !jlir.Bool
    %26 = "jlir.ifelse"(%25, %24, %4) : (!jlir.Bool, !jlir.Int64, !jlir.Int64) -> !jlir.Int64
    %27 = "jlir.slt_int"(%26, %1) : (!jlir.Int64, !jlir.Int64) -> !jlir.Bool
    "jlir.gotoifnot"(%27)[^bb14, ^bb12] {operand_segment_sizes = dense<[1, 0, 0]> : vector<3xi32>} : (!jlir.Bool) -> ()
  ^bb11:        // pred: ^bb25
    %28 = "jlir.add_int"(%22, %1) : (!jlir.Int64, !jlir.Int64) -> !jlir.Int64
    %29 = "jlir.constant"() {value = #jlir.false} : () -> !jlir.Bool
    "jlir.goto"(%28, %28, %29)[^bb17] : (!jlir.Int64, !jlir.Int64, !jlir.Bool) -> ()
  ^bb12:        // pred: ^bb10
    %30 = "jlir.constant"() {value = #jlir.true} : () -> !jlir.Bool
    %31 = "jlir.undef"() : () -> !jlir.Int64
    %32 = "jlir.undef"() : () -> !jlir.Int64
    "jlir.goto"(%30, %31, %32)[^bb16] : (!jlir.Bool, !jlir.Int64, !jlir.Int64) -> ()
  ^bb13:        // pred: ^bb17
    "jlir.goto"(%38, %39)[^bb10] : (!jlir.Int64, !jlir.Int64) -> ()
  ^bb14:        // pred: ^bb10
    %33 = "jlir.constant"() {value = #jlir.false} : () -> !jlir.Bool
    "jlir.goto"(%33, %1, %1)[^bb16] : (!jlir.Bool, !jlir.Int64, !jlir.Int64) -> ()
  ^bb15:        // pred: ^bb9
    "jlir.goto"(%76, %17, %18)[^bb26] : (!jlir.Float64, !jlir.Int64, !jlir.Int64) -> ()
  ^bb16(%34: !jlir.Bool, %35: !jlir.Int64, %36: !jlir.Int64):   // 2 preds: ^bb12, ^bb14
    %37 = "jlir.not_int"(%34) : (!jlir.Bool) -> !jlir.Bool
    "jlir.gotoifnot"(%37, %35, %36)[^bb25, ^bb18] {operand_segment_sizes = dense<[1, 0, 2]> : vector<3xi32>} : (!jlir.Bool, !jlir.Int64, !jlir.Int64) -> ()
  ^bb17(%38: !jlir.Int64, %39: !jlir.Int64, %40: !jlir.Bool):   // 2 preds: ^bb11, ^bb23
    %41 = "jlir.not_int"(%40) : (!jlir.Bool) -> !jlir.Bool
    "jlir.gotoifnot"(%41)[^bb1, ^bb13] {operand_segment_sizes = dense<[1, 0, 0]> : vector<3xi32>} : (!jlir.Bool) -> ()
  ^bb18(%42: !jlir.Int64, %43: !jlir.Int64):    // 2 preds: ^bb5, ^bb16
    %44 = "jlir.arraysize"(%arg2, %23) : (!jlir<"Array{Float64, 2}">, !jlir.Int64) -> !jlir.Int64
    %45 = "jlir.sle_int"(%1, %44) : (!jlir.Int64, !jlir.Int64) -> !jlir.Bool
    %46 = "jlir.ifelse"(%45, %44, %4) : (!jlir.Bool, !jlir.Int64, !jlir.Int64) -> !jlir.Int64
    %47 = "jlir.slt_int"(%46, %1) : (!jlir.Int64, !jlir.Int64) -> !jlir.Bool
    "jlir.gotoifnot"(%47)[^bb22, ^bb20] {operand_segment_sizes = dense<[1, 0, 0]> : vector<3xi32>} : (!jlir.Bool) -> ()
  ^bb19(%48: !jlir.Int64, %49: !jlir.Int64, %50: !jlir.Bool):   // 2 preds: ^bb7, ^bb27
    %51 = "jlir.not_int"(%50) : (!jlir.Bool) -> !jlir.Bool
    "jlir.gotoifnot"(%51)[^bb25, ^bb5] {operand_segment_sizes = dense<[1, 0, 0]> : vector<3xi32>} : (!jlir.Bool) -> ()
  ^bb20:        // pred: ^bb18
    %52 = "jlir.constant"() {value = #jlir.true} : () -> !jlir.Bool
    %53 = "jlir.undef"() : () -> !jlir.Int64
    %54 = "jlir.undef"() : () -> !jlir.Int64
    "jlir.goto"(%52, %53, %54)[^bb24] : (!jlir.Bool, !jlir.Int64, !jlir.Int64) -> ()
  ^bb21(%55: !jlir.Float64):    // 2 preds: ^bb9, ^bb24
    %56 = "jlir.constant"() {value = #jlir.false} : () -> !jlir.Bool
    %57 = "jlir.arrayset"(%56, %arg1, %55, %21, %42) : (!jlir.Bool, !jlir<"Array{Float64, 2}">, !jlir.Float64, !jlir.Int64, !jlir.Int64) -> !jlir<"Array{Float64, 2}">
    %58 = "jlir.==="(%43, %26) : (!jlir.Int64, !jlir.Int64) -> !jlir.Bool
    "jlir.gotoifnot"(%58)[^bb7, ^bb27] {operand_segment_sizes = dense<[1, 0, 0]> : vector<3xi32>} : (!jlir.Bool) -> ()
  ^bb22:        // pred: ^bb18
    %59 = "jlir.constant"() {value = #jlir.false} : () -> !jlir.Bool
    "jlir.goto"(%59, %1, %1)[^bb24] : (!jlir.Bool, !jlir.Int64, !jlir.Int64) -> ()
  ^bb23:        // pred: ^bb25
    %60 = "jlir.undef"() : () -> !jlir.Int64
    %61 = "jlir.undef"() : () -> !jlir.Int64
    %62 = "jlir.constant"() {value = #jlir.true} : () -> !jlir.Bool
    "jlir.goto"(%60, %61, %62)[^bb17] : (!jlir.Int64, !jlir.Int64, !jlir.Bool) -> ()
  ^bb24(%63: !jlir.Bool, %64: !jlir.Int64, %65: !jlir.Int64):   // 2 preds: ^bb20, ^bb22
    %66 = "jlir.not_int"(%63) : (!jlir.Bool) -> !jlir.Bool
    %67 = "jlir.constant"() {value = #jlir<"0">} : () -> !jlir.Float64
    "jlir.gotoifnot"(%66, %67, %67, %64, %65)[^bb21, ^bb26] {operand_segment_sizes = dense<[1, 1, 3]> : vector<3xi32>} : (!jlir.Bool, !jlir.Float64, !jlir.Float64, !jlir.Int64, !jlir.Int64) -> ()
  ^bb25:        // 2 preds: ^bb16, ^bb19
    %68 = "jlir.==="(%22, %5) : (!jlir.Int64, !jlir.Int64) -> !jlir.Bool
    "jlir.gotoifnot"(%68)[^bb11, ^bb23] {operand_segment_sizes = dense<[1, 0, 0]> : vector<3xi32>} : (!jlir.Bool) -> ()
  ^bb26(%69: !jlir.Float64, %70: !jlir.Int64, %71: !jlir.Int64):        // 2 preds: ^bb15, ^bb24
    %72 = "jlir.constant"() {value = #jlir.false} : () -> !jlir.Bool
    %73 = "jlir.arrayref"(%72, %arg2, %21, %70) : (!jlir.Bool, !jlir<"Array{Float64, 2}">, !jlir.Int64, !jlir.Int64) -> !jlir.Float64
    %74 = "jlir.arrayref"(%72, %arg3, %70, %42) : (!jlir.Bool, !jlir<"Array{Float64, 2}">, !jlir.Int64, !jlir.Int64) -> !jlir.Float64
    %75 = "jlir.mul_float"(%73, %74) : (!jlir.Float64, !jlir.Float64) -> !jlir.Float64
    %76 = "jlir.add_float"(%69, %75) : (!jlir.Float64, !jlir.Float64) -> !jlir.Float64
    %77 = "jlir.==="(%71, %46) : (!jlir.Int64, !jlir.Int64) -> !jlir.Bool
    "jlir.gotoifnot"(%77)[^bb3, ^bb28] {operand_segment_sizes = dense<[1, 0, 0]> : vector<3xi32>} : (!jlir.Bool) -> ()
  ^bb27:        // pred: ^bb21
    %78 = "jlir.undef"() : () -> !jlir.Int64
    %79 = "jlir.undef"() : () -> !jlir.Int64
    %80 = "jlir.constant"() {value = #jlir.true} : () -> !jlir.Bool
    "jlir.goto"(%78, %79, %80)[^bb19] : (!jlir.Int64, !jlir.Int64, !jlir.Bool) -> ()
  ^bb28:        // pred: ^bb26
    %81 = "jlir.undef"() : () -> !jlir.Int64
    %82 = "jlir.undef"() : () -> !jlir.Int64
    %83 = "jlir.constant"() {value = #jlir.true} : () -> !jlir.Bool
    "jlir.goto"(%81, %82, %83)[^bb9] : (!jlir.Int64, !jlir.Int64, !jlir.Bool) -> ()
  }
}error: module lowering failed

julia> function AmulB!(C, A, B)
           for m in 1:size(A,1), n in 1:size(B,2)
               Cmn = zero(eltype(C))
               for k in 1:size(A,2)
                   Cmn += A[m,k] * B[k,n]
               end
               C[m,n] = Cmn
           end
       end
AmulB! (generic function with 1 method)

julia> emit_lowered(AmulB!, Matrix{Float64}, Matrix{Float64}, Matrix{Float64})
loc(callsite("size"("array.jl":154:0) at "AmulB!"("REPL[5]":2:0))): error: failed to legalize operation 'jlir.arraysize'


module {
  func @"AmulB!"(%arg0: !jlir<"typeof(Main.AmulB!)">, %arg1: !jlir<"Array{Float64, 2}">, %arg2: !jlir<"Array{Float64, 2}">, %arg3: !jlir<"Array{Float64, 2}">) -> !jlir.Nothing {
    "jlir.goto"()[^bb2] : () -> ()
  ^bb1: // 2 preds: ^bb8, ^bb17
    %0 = "jlir.constant"() {value = #jlir.nothing} : () -> !jlir.Nothing
    "jlir.return"(%0) : (!jlir.Nothing) -> ()
  ^bb2: // pred: ^bb0
    %1 = "jlir.constant"() {value = #jlir<"1">} : () -> !jlir.Int64
    %2 = "jlir.arraysize"(%arg2, %1) : (!jlir<"Array{Float64, 2}">, !jlir.Int64) -> !jlir.Int64
    %3 = "jlir.sle_int"(%1, %2) : (!jlir.Int64, !jlir.Int64) -> !jlir.Bool
    %4 = "jlir.constant"() {value = #jlir<"0">} : () -> !jlir.Int64
    %5 = "jlir.ifelse"(%3, %2, %4) : (!jlir.Bool, !jlir.Int64, !jlir.Int64) -> !jlir.Int64
    %6 = "jlir.slt_int"(%5, %1) : (!jlir.Int64, !jlir.Int64) -> !jlir.Bool
    "jlir.gotoifnot"(%6)[^bb6, ^bb4] {operand_segment_sizes = dense<[1, 0, 0]> : vector<3xi32>} : (!jlir.Bool) -> ()
  ^bb3: // pred: ^bb26
    %7 = "jlir.add_int"(%73, %1) : (!jlir.Int64, !jlir.Int64) -> !jlir.Int64
    %8 = "jlir.constant"() {value = #jlir.false} : () -> !jlir.Bool
    "jlir.goto"(%7, %7, %8)[^bb9] : (!jlir.Int64, !jlir.Int64, !jlir.Bool) -> ()
  ^bb4: // pred: ^bb2
    %9 = "jlir.constant"() {value = #jlir.true} : () -> !jlir.Bool
    %10 = "jlir.undef"() : () -> !jlir.Int64
    %11 = "jlir.undef"() : () -> !jlir.Int64
    "jlir.goto"(%9, %10, %11)[^bb8] : (!jlir.Bool, !jlir.Int64, !jlir.Int64) -> ()
  ^bb5: // pred: ^bb19
    "jlir.goto"(%50, %51)[^bb18] : (!jlir.Int64, !jlir.Int64) -> ()
  ^bb6: // pred: ^bb2
    %12 = "jlir.constant"() {value = #jlir.false} : () -> !jlir.Bool
    "jlir.goto"(%12, %1, %1)[^bb8] : (!jlir.Bool, !jlir.Int64, !jlir.Int64) -> ()
  ^bb7: // pred: ^bb21
    %13 = "jlir.add_int"(%45, %1) : (!jlir.Int64, !jlir.Int64) -> !jlir.Int64
    %14 = "jlir.constant"() {value = #jlir.false} : () -> !jlir.Bool
    "jlir.goto"(%13, %13, %14)[^bb19] : (!jlir.Int64, !jlir.Int64, !jlir.Bool) -> ()
  ^bb8(%15: !jlir.Bool, %16: !jlir.Int64, %17: !jlir.Int64):    // 2 preds: ^bb4, ^bb6
    %18 = "jlir.not_int"(%15) : (!jlir.Bool) -> !jlir.Bool
    "jlir.gotoifnot"(%18, %16, %17)[^bb1, ^bb10] {operand_segment_sizes = dense<[1, 0, 2]> : vector<3xi32>} : (!jlir.Bool, !jlir.Int64, !jlir.Int64) -> ()
  ^bb9(%19: !jlir.Int64, %20: !jlir.Int64, %21: !jlir.Bool):    // 2 preds: ^bb3, ^bb28
    %22 = "jlir.not_int"(%21) : (!jlir.Bool) -> !jlir.Bool
    "jlir.gotoifnot"(%22, %78)[^bb21, ^bb15] {operand_segment_sizes = dense<[1, 1, 0]> : vector<3xi32>} : (!jlir.Bool, !jlir.Float64) -> ()
  ^bb10(%23: !jlir.Int64, %24: !jlir.Int64):    // 2 preds: ^bb8, ^bb13
    %25 = "jlir.constant"() {value = #jlir<"2">} : () -> !jlir.Int64
    %26 = "jlir.arraysize"(%arg3, %25) : (!jlir<"Array{Float64, 2}">, !jlir.Int64) -> !jlir.Int64
    %27 = "jlir.sle_int"(%1, %26) : (!jlir.Int64, !jlir.Int64) -> !jlir.Bool
    %28 = "jlir.ifelse"(%27, %26, %4) : (!jlir.Bool, !jlir.Int64, !jlir.Int64) -> !jlir.Int64
    %29 = "jlir.slt_int"(%28, %1) : (!jlir.Int64, !jlir.Int64) -> !jlir.Bool
    "jlir.gotoifnot"(%29)[^bb14, ^bb12] {operand_segment_sizes = dense<[1, 0, 0]> : vector<3xi32>} : (!jlir.Bool) -> ()
  ^bb11:        // pred: ^bb25
    %30 = "jlir.add_int"(%24, %1) : (!jlir.Int64, !jlir.Int64) -> !jlir.Int64
    %31 = "jlir.constant"() {value = #jlir.false} : () -> !jlir.Bool
    "jlir.goto"(%30, %30, %31)[^bb17] : (!jlir.Int64, !jlir.Int64, !jlir.Bool) -> ()
  ^bb12:        // pred: ^bb10
    %32 = "jlir.constant"() {value = #jlir.true} : () -> !jlir.Bool
    %33 = "jlir.undef"() : () -> !jlir.Int64
    %34 = "jlir.undef"() : () -> !jlir.Int64
    "jlir.goto"(%32, %33, %34)[^bb16] : (!jlir.Bool, !jlir.Int64, !jlir.Int64) -> ()
  ^bb13:        // pred: ^bb17
    "jlir.goto"(%40, %41)[^bb10] : (!jlir.Int64, !jlir.Int64) -> ()
  ^bb14:        // pred: ^bb10
    %35 = "jlir.constant"() {value = #jlir.false} : () -> !jlir.Bool
    "jlir.goto"(%35, %1, %1)[^bb16] : (!jlir.Bool, !jlir.Int64, !jlir.Int64) -> ()
  ^bb15:        // pred: ^bb9
    "jlir.goto"(%78, %19, %20)[^bb26] : (!jlir.Float64, !jlir.Int64, !jlir.Int64) -> ()
  ^bb16(%36: !jlir.Bool, %37: !jlir.Int64, %38: !jlir.Int64):   // 2 preds: ^bb12, ^bb14
    %39 = "jlir.not_int"(%36) : (!jlir.Bool) -> !jlir.Bool
    "jlir.gotoifnot"(%39, %37, %38)[^bb25, ^bb18] {operand_segment_sizes = dense<[1, 0, 2]> : vector<3xi32>} : (!jlir.Bool, !jlir.Int64, !jlir.Int64) -> ()
  ^bb17(%40: !jlir.Int64, %41: !jlir.Int64, %42: !jlir.Bool):   // 2 preds: ^bb11, ^bb23
    %43 = "jlir.not_int"(%42) : (!jlir.Bool) -> !jlir.Bool
    "jlir.gotoifnot"(%43)[^bb1, ^bb13] {operand_segment_sizes = dense<[1, 0, 0]> : vector<3xi32>} : (!jlir.Bool) -> ()
  ^bb18(%44: !jlir.Int64, %45: !jlir.Int64):    // 2 preds: ^bb5, ^bb16
    %46 = "jlir.arraysize"(%arg2, %25) : (!jlir<"Array{Float64, 2}">, !jlir.Int64) -> !jlir.Int64
    %47 = "jlir.sle_int"(%1, %46) : (!jlir.Int64, !jlir.Int64) -> !jlir.Bool
    %48 = "jlir.ifelse"(%47, %46, %4) : (!jlir.Bool, !jlir.Int64, !jlir.Int64) -> !jlir.Int64
    %49 = "jlir.slt_int"(%48, %1) : (!jlir.Int64, !jlir.Int64) -> !jlir.Bool
    "jlir.gotoifnot"(%49)[^bb22, ^bb20] {operand_segment_sizes = dense<[1, 0, 0]> : vector<3xi32>} : (!jlir.Bool) -> ()
  ^bb19(%50: !jlir.Int64, %51: !jlir.Int64, %52: !jlir.Bool):   // 2 preds: ^bb7, ^bb27
    %53 = "jlir.not_int"(%52) : (!jlir.Bool) -> !jlir.Bool
    "jlir.gotoifnot"(%53)[^bb25, ^bb5] {operand_segment_sizes = dense<[1, 0, 0]> : vector<3xi32>} : (!jlir.Bool) -> ()
  ^bb20:        // pred: ^bb18
    %54 = "jlir.constant"() {value = #jlir.true} : () -> !jlir.Bool
    %55 = "jlir.undef"() : () -> !jlir.Int64
    %56 = "jlir.undef"() : () -> !jlir.Int64
    "jlir.goto"(%54, %55, %56)[^bb24] : (!jlir.Bool, !jlir.Int64, !jlir.Int64) -> ()
  ^bb21(%57: !jlir.Float64):    // 2 preds: ^bb9, ^bb24
    %58 = "jlir.constant"() {value = #jlir.true} : () -> !jlir.Bool
    %59 = "jlir.arrayset"(%58, %arg1, %57, %23, %44) : (!jlir.Bool, !jlir<"Array{Float64, 2}">, !jlir.Float64, !jlir.Int64, !jlir.Int64) -> !jlir<"Array{Float64, 2}">
    %60 = "jlir.==="(%45, %28) : (!jlir.Int64, !jlir.Int64) -> !jlir.Bool
    "jlir.gotoifnot"(%60)[^bb7, ^bb27] {operand_segment_sizes = dense<[1, 0, 0]> : vector<3xi32>} : (!jlir.Bool) -> ()
  ^bb22:        // pred: ^bb18
    %61 = "jlir.constant"() {value = #jlir.false} : () -> !jlir.Bool
    "jlir.goto"(%61, %1, %1)[^bb24] : (!jlir.Bool, !jlir.Int64, !jlir.Int64) -> ()
  ^bb23:        // pred: ^bb25
    %62 = "jlir.undef"() : () -> !jlir.Int64
    %63 = "jlir.undef"() : () -> !jlir.Int64
    %64 = "jlir.constant"() {value = #jlir.true} : () -> !jlir.Bool
    "jlir.goto"(%62, %63, %64)[^bb17] : (!jlir.Int64, !jlir.Int64, !jlir.Bool) -> ()
  ^bb24(%65: !jlir.Bool, %66: !jlir.Int64, %67: !jlir.Int64):   // 2 preds: ^bb20, ^bb22
    %68 = "jlir.not_int"(%65) : (!jlir.Bool) -> !jlir.Bool
    %69 = "jlir.constant"() {value = #jlir<"0">} : () -> !jlir.Float64
    "jlir.gotoifnot"(%68, %69, %69, %66, %67)[^bb21, ^bb26] {operand_segment_sizes = dense<[1, 1, 3]> : vector<3xi32>} : (!jlir.Bool, !jlir.Float64, !jlir.Float64, !jlir.Int64, !jlir.Int64) -> ()
  ^bb25:        // 2 preds: ^bb16, ^bb19
    %70 = "jlir.==="(%24, %5) : (!jlir.Int64, !jlir.Int64) -> !jlir.Bool
    "jlir.gotoifnot"(%70)[^bb11, ^bb23] {operand_segment_sizes = dense<[1, 0, 0]> : vector<3xi32>} : (!jlir.Bool) -> ()
  ^bb26(%71: !jlir.Float64, %72: !jlir.Int64, %73: !jlir.Int64):        // 2 preds: ^bb15, ^bb24
    %74 = "jlir.constant"() {value = #jlir.true} : () -> !jlir.Bool
    %75 = "jlir.arrayref"(%74, %arg2, %23, %72) : (!jlir.Bool, !jlir<"Array{Float64, 2}">, !jlir.Int64, !jlir.Int64) -> !jlir.Float64
    %76 = "jlir.arrayref"(%74, %arg3, %72, %44) : (!jlir.Bool, !jlir<"Array{Float64, 2}">, !jlir.Int64, !jlir.Int64) -> !jlir.Float64
    %77 = "jlir.mul_float"(%75, %76) : (!jlir.Float64, !jlir.Float64) -> !jlir.Float64
    %78 = "jlir.add_float"(%71, %77) : (!jlir.Float64, !jlir.Float64) -> !jlir.Float64
    %79 = "jlir.==="(%73, %48) : (!jlir.Int64, !jlir.Int64) -> !jlir.Bool
    "jlir.gotoifnot"(%79)[^bb3, ^bb28] {operand_segment_sizes = dense<[1, 0, 0]> : vector<3xi32>} : (!jlir.Bool) -> ()
  ^bb27:        // pred: ^bb21
    %80 = "jlir.undef"() : () -> !jlir.Int64
    %81 = "jlir.undef"() : () -> !jlir.Int64
    "jlir.goto"(%80, %81, %58)[^bb19] : (!jlir.Int64, !jlir.Int64, !jlir.Bool) -> ()
  ^bb28:        // pred: ^bb26
    %82 = "jlir.undef"() : () -> !jlir.Int64
    %83 = "jlir.undef"() : () -> !jlir.Int64
    "jlir.goto"(%82, %83, %74)[^bb9] : (!jlir.Int64, !jlir.Int64, !jlir.Bool) -> ()
  }
}error: module lowering failed
@chriselrod chriselrod changed the title Assertion `str.find('\0') == StringRef::npos && "Cannot create an identifer with a nul character"' failed. FastMath results in Assertion `str.find('\0') == StringRef::npos && "Cannot create an identifer with a nul character"' failed. Apr 20, 2020
@yhls
Copy link
Contributor

yhls commented Apr 21, 2020

Thanks for your issue! Brutus is still very much a work in progress right now--we're just not there yet on many things, including array support. But hopefully things like this will work soon!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants