Closed Sacha0 closed 7 years ago
bisected to https://github.com/JuliaLang/julia/pull/19746 - @andreasnoack that assertion failure was real and should not have been merged
Interestingly this doesn't fail with LLVM 3.7.1 (on Ubuntu 14.04 anyway). Julia codegen bug or upstream llvm bug? If you build with LLVM_ASSERTIONS = 1
you get more info
.../llvm-3.9.1/lib/CodeGen/LiveVariables.cpp:114
MBB != &MF->front() && "Can't find reaching def for virtreg"
cc @vchuravy
There's also what seems to be a test-system bug here that JULIA_CPU_CORES=2 usr/bin/julia test/runtests.jl linalg/hessenberg linalg/qr
says it passes but JULIA_CPU_CORES=1 usr/bin/julia test/runtests.jl linalg/hessenberg linalg/qr
does not. Similar to #19376, and was seen with the broadcast test failure that #16961 introduced and #19745 fixed
I can reproduce this with -O1
on a build with LLVM_ASSERTIONS
, but no with -O0
. Maybe this is related to #15453?
The MachineInstuction the assertion is triggered from is:
(rr) p MI.dump()
CMP64rr %vreg230, %vreg428, %EFLAGS<imp-def>; GR64:%vreg230,%vreg428 dbg:simdloop.jl:72 @[ broadcast.jl:150 @[ broadcast.jl:145 @[ broadcast.jl:263 @[ broadcast.jl:314 @[ broadcast.jl:454 @[ arraymath.jl:34 ] ] ] ] ] ]
and if I remove @simd
from https://github.com/JuliaLang/julia/blob/26c8d856a2dd2f6a699f5bae46eee9be8c13a53d/base/broadcast.jl#L151-L159 the example works.
I further reduced this to:
Y = view(rand(10, 10), :, :);
X = rand(Float64, 10, 10);
broadcast(-, X, Y); # works
-(X, Y) # fails
Y = view(rand(10, 10), :, :);
X = rand(Float64, 10, 10);
myminus(A, B) = broadcast(-, A, B);
myminus(X, Y)
julia39-dbg: /home/wallnuss/src/julia/deps/srccache/llvm-3.9.1/lib/CodeGen/LiveVariables.cpp:114: void llvm::LiveVariables::MarkVirtRegAliveInBlock(llvm::LiveVariables::VarInfo&, llvm::MachineBasicBlock*, llvm::MachineBasicBlock*, std::vector<llvm::MachineBasicBlock*>&): Assertion `MBB != &MF->front() && "Can't find reaching def for virtreg"' failed.
I will be travelling for the first week of January, so I won't have too much time to look into this (sorry about that)
@vtjnash, @JeffBezanson If one of you has time to see if we can work around this from our codegen side, that would be great. I was more looking at this from the LLVM side, but I didn't find anything obvious.
This seems buggy enough that we should at least consider dropping back to 3.7 if it can't be solved soon.
This doesn't segfault on LLVM-svn c828f5b04a33480c4d8c86863a1439df265f2b2b.
(reverse-)bisect on llvm to figure out what patch to carry?
I'll try that
A familiar name showed up (and bad means good)
99ca52276f9ee1386866d6dff6179cfa64824621 is the first bad commit
commit 99ca52276f9ee1386866d6dff6179cfa64824621
Author: Keno Fischer <kfischer@college.harvard.edu>
Date: Mon Dec 5 21:25:03 2016 +0000
[LAA] Prevent invalid IR for loop-invariant bound in loop body
Summary:
If LAA expands a bound that is loop invariant, but not hoisted out
of the loop body, it used to use that value anyway, causing a
non-domination error, because the memcheck block is of course not
dominated by the scalar loop body. Detect this situation and expand
the SCEV expression instead.
Fixes PR31251
Reviewers: anemet
Subscribers: mzolotukhin, llvm-commits
Differential Revision: https://reviews.llvm.org/D27397
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288705 91177308-0d34-0410-b5e6-96231b3b80d8
:040000 040000 74687040ae081d9648605e476296951bbba888b5 89b8d818ed0748ef7474a01ce73d3e847df797ea M lib
:040000 040000 884e86a25a25239e045977569ecbd328f0fc6119 c64349b6f7c34fd1afae99e5981f0297cc63770e M test
it can be cherry-picked cleanly from release_39
and fixes the example in this issue.
Very nice! Let's add that to our list then.
We should also pick up 83dc06334ff95ad18a951d0bb540290510f2f81a and whatever the git sha corresponding to https://reviews.llvm.org/rL290260 is.
working on a branch (will also need to rebuild mac and windows binaries, if you've got any other changes in mind now's a good time)
I'm about to reapply a fixed version of https://reviews.llvm.org/D21731. We'll probably want to replace our existing patch by that once that's done.
Could you also take a look at https://github.com/JuliaLang/julia/issues/19803 ? That only seems to be happening on 32 bit x86 and with LLVM assertions enabled. If it helps make reproducing faster I can put up a docker image that has deps prebuilt for it.
Yes, that would be helpful.
We'll probably want to replace our existing patch by that once that's done.
https://github.com/JuliaLang/julia/pull/19810/commits/bf92182e7bdfbe94528990d0362d609313dbe9a7 if it sticks without getting reverted upstream
edit: needs some conflicts resolved to apply against 3.9.1, I'm inclined to leave the patch as it is for now if I don't hear otherwise?
I am using llvm 4.0, to build Halide project. Halide is with tag release_2017_05_03. It failed with following error information:
bin/gaussian5x5_generator -o ./bin/arm-64-android -e o,h -f gaussian5x5_hvx128 target=arm-64-android-hvx_128 gaussian5x5_generator: /llvm-4.0.0.src/lib/CodeGen/LiveVariables.cpp:114: void llvm::LiveVariables::MarkVirtRegAliveInBlock(llvm::LiveVariables::VarInfo&, llvm::MachineBasicBlock, llvm::MachineBasicBlock, std::vectorllvm::MachineBasicBlock*&): Assertion `MBB != &MF->front() && "Can't find reaching def for virtreg"' failed. Makefile:91: recipe for target 'bin/arm-64-android/gaussian5x5_hvx128.o' failed make: *** [bin/arm-64-android/gaussian5x5_hvx128.o] Aborted (core dumped)
Report that to Halide please, it's not a Julia issue.
On
The
linalg/qr
tests fail. The failure reduces toe.g.
Best!