Status Update
Comments
ni...@google.com <ni...@google.com> #2
Cause: stack pointer is not in a rw map; likely due to stack overflow.
What is Android's stack size? We had a similar issue for
na...@google.com <na...@google.com> #3
What is Android's stack size?
adb shell ulimit -a
is reporting 8MB.
Adding "-DJIT_IN_SEPARATE_THREAD=1",
to the cflags
section of libswiftshader_llvm_defaults
in external/swiftshader/Android.bp did not help.
Without any LLVM background knowledge, replacing isSplatValue()
with a isSplatValueRecursive(..., int depth)
and printing out the depth shows the function hitting a depth of ~5600 before crashing. Is it possible we're hitting an infinite recursion case?
ni...@google.com <ni...@google.com> #4
Thanks, that matches typical desktop Linux stack size. Additional threads by default have a 2 MB stack on Linux, so it looks like Android is the same which explains why -DJIT_IN_SEPARATE_THREAD=1
doesn't help at all.
These tests currently
While this call stack might seem like an infinite recursion, the test actually chains together 10,000 add instructions, and LLVM needs to walk up that entire chain of dependencies to know with certainty whether the final sum is a 'splat' result or not.
However, this is just for optimization purposes. If we return false
early because the recursion goes deeper than expected, we just lose a (potential) optimization opportunity. Note that methods such as SelectionDAG::computeKnownBits
take a Depth
parameter to avoid going deeper than MaxRecursionDepth = 6
. I'll patch isSplatValue
to do the same.
ap...@google.com <ap...@google.com> #5
Branch: master
commit 24350b8dcb6db79b73f0d9fa4a9403771477d5f2
Author: Nicolas Capens <capn@google.com>
Date: Sat Nov 21 01:00:55 2020
Limit the recursion depth of llvm::SelectionDAG::isSplatValue()
This method previously always recursively checked both the left-hand
side and right-hand side of binary operations for splatted (broadcast)
values to determine if the parent DAG node is a splat. For chained
operations, such as the 10,000 adds of the dEQP-VK.spirv_assembly.
instruction.graphics.spirv_ids_abuse.lots_ids_frag/vert tests,
very deep recursion could result in stack overflow.
Like several other SelectionDAG methods, limit the recursion depth to
MaxRecursionDepth (6).
Bug:
Change-Id: I22ee0453db7cf1311267291a331ad8fa3b57b1d9
Reviewed-on:
Presubmit-Ready: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Jason Macnak <natsu@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Tested-by: Jason Macnak <natsu@google.com>
M third_party/llvm-10.0/llvm/include/llvm/CodeGen/SelectionDAG.h
M third_party/llvm-10.0/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
ni...@google.com <ni...@google.com> #6
Should be upstreamed to LLVM before we call this fixed. Also needs cherry-picking for
ap...@google.com <ap...@google.com> #7
Branch: master
commit c2754b7bfd030ec146c6712f290425d57050acee
Author: Jason Macnak <natsu@google.com>
Date: Tue Nov 24 14:59:35 2020
Merge remote-tracking branch 'aosp/upstream-swiftshader-master' into 'aosp/master'
... to update SwiftShader for Cuttlefish to pull in
to fix dEQP spirv_ids_abuse tests.
Bug:
Test: cts -m CtsDeqpTestCases w/ spirv_ids_abuse#*
Change-Id: I25cb2eb520edc6a5955f08f075fb9b0c0e080b60
Description
results in