[llvm-bugs] [Bug 50998] New: Forcing SVE auto-vectorisation with pragma crashes for this loop

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jul 6 13:35:06 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=50998

            Bug ID: 50998
           Summary: Forcing SVE auto-vectorisation with pragma crashes for
                    this loop
           Product: clang
           Version: 12.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: binebrank at gmail.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at metafoo.co.uk

Compiling the following loop for SVE (vector-length-agnostic) crashes:

#define LEN 1000

float a[LEN];
float b[LEN];

void func1() {
    #pragma clang loop vectorize_width(2, scalable)
    for (int i = 1; i < LEN; i += 2) {
        a[i] = a[i-1] + b[i];
    }
}

[brank1 at juawei-cn02 test]$ clang -march=armv8-a+sve -Ofast test.c -S -o test.s
clang:
/dev/shm/nassyr1/Kunpeng920/Clang/12.0.0/system-system/llvm-project-12.0.0.src/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:6796:
llvm::InstructionCost
llvm::LoopVectorizationCostModel::getInterleaveGroupCost(llvm::Instruction *,
llvm::ElementCount): Assertion `!VF.isScalable() && "scalable vectors not yet
supported."' failed.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash
backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: clang -march=armv8-a+sve -Ofast test.c -S -o test.s
1.      <eof> parser at end of file
2.      Per-module optimization passes
3.      Running pass 'Function Pass Manager' on module 'test.c'.
4.      Running pass 'Loop Vectorization' on function '@func1'
 #0 0x0000ffffa4da5970 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
(/opt/ohpc/pub/easybuild/software/juaweihi1620/Stages/2021a/software/Clang/12.0.0/lib/libLLVMSupport.so.12+0x215970)
 #1 0x0000ffffa4da37c4 llvm::sys::RunSignalHandlers()
(/opt/ohpc/pub/easybuild/software/juaweihi1620/Stages/2021a/software/Clang/12.0.0/lib/libLLVMSupport.so.12+0x2137c4)
 #2 0x0000ffffa4da4be0 llvm::sys::CleanupOnSignal(unsigned long)
(/opt/ohpc/pub/easybuild/software/juaweihi1620/Stages/2021a/software/Clang/12.0.0/lib/libLLVMSupport.so.12+0x214be0)
 #3 0x0000ffffa4cd6648 (anonymous
namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long)
(/opt/ohpc/pub/easybuild/software/juaweihi1620/Stages/2021a/software/Clang/12.0.0/lib/libLLVMSupport.so.12+0x146648)
 #4 0x0000ffffa4cd67dc CrashRecoverySignalHandler(int)
(/opt/ohpc/pub/easybuild/software/juaweihi1620/Stages/2021a/software/Clang/12.0.0/lib/libLLVMSupport.so.12+0x1467dc)
 #5 0x0000ffffa92d066c (linux-vdso.so.1+0x66c)
 #6 0x0000ffffa47c2c1c raise (/lib64/libc.so.6+0x32c1c)
 #7 0x0000ffffa47b07a8 abort (/lib64/libc.so.6+0x207a8)
 #8 0x0000ffffa47bc2e8 __assert_fail_base (/lib64/libc.so.6+0x2c2e8)
 #9 0x0000ffffa47bc350 __assert_perror_fail (/lib64/libc.so.6+0x2c350)
#10 0x0000ffffa73f0ba0
llvm::LoopVectorizationCostModel::getInterleaveGroupCost(llvm::Instruction*,
llvm::ElementCount)
(/opt/ohpc/pub/easybuild/software/juaweihi1620/Stages/2021a/software/Clang/12.0.0/lib/libLLVMVectorize.so.12+0xf0ba0)
#11 0x0000ffffa73f30c8
llvm::LoopVectorizationCostModel::setCostBasedWideningDecision(llvm::ElementCount)
(/opt/ohpc/pub/easybuild/software/juaweihi1620/Stages/2021a/software/Clang/12.0.0/lib/libLLVMVectorize.so.12+0xf30c8)
#12 0x0000ffffa73edf6c
llvm::LoopVectorizationCostModel::collectUniformsAndScalars(llvm::ElementCount)
(/opt/ohpc/pub/easybuild/software/juaweihi1620/Stages/2021a/software/Clang/12.0.0/lib/libLLVMVectorize.so.12+0xedf6c)
#13 0x0000ffffa73f5f58 llvm::LoopVectorizationPlanner::plan(llvm::ElementCount,
unsigned int)
(/opt/ohpc/pub/easybuild/software/juaweihi1620/Stages/2021a/software/Clang/12.0.0/lib/libLLVMVectorize.so.12+0xf5f58)
#14 0x0000ffffa7405010 llvm::LoopVectorizePass::processLoop(llvm::Loop*)
(/opt/ohpc/pub/easybuild/software/juaweihi1620/Stages/2021a/software/Clang/12.0.0/lib/libLLVMVectorize.so.12+0x105010)
#15 0x0000ffffa74085f4 llvm::LoopVectorizePass::runImpl(llvm::Function&,
llvm::ScalarEvolution&, llvm::LoopInfo&, llvm::TargetTransformInfo&,
llvm::DominatorTree&, llvm::BlockFrequencyInfo&, llvm::TargetLibraryInfo*,
llvm::DemandedBits&, llvm::AAResults&, llvm::AssumptionCache&,
std::__1::function<llvm::LoopAccessInfo const& (llvm::Loop&)>&,
llvm::OptimizationRemarkEmitter&, llvm::ProfileSummaryInfo*)
(/opt/ohpc/pub/easybuild/software/juaweihi1620/Stages/2021a/software/Clang/12.0.0/lib/libLLVMVectorize.so.12+0x1085f4)
#16 0x0000ffffa74114a0 (anonymous
namespace)::LoopVectorize::runOnFunction(llvm::Function&)
(/opt/ohpc/pub/easybuild/software/juaweihi1620/Stages/2021a/software/Clang/12.0.0/lib/libLLVMVectorize.so.12+0x1114a0)
#17 0x0000ffffa5309438 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/opt/ohpc/pub/easybuild/software/juaweihi1620/Stages/2021a/software/Clang/12.0.0/lib/libLLVMCore.so.12+0x3d9438)
#18 0x0000ffffa5310044 llvm::FPPassManager::runOnModule(llvm::Module&)
(/opt/ohpc/pub/easybuild/software/juaweihi1620/Stages/2021a/software/Clang/12.0.0/lib/libLLVMCore.so.12+0x3e0044)
#19 0x0000ffffa5309a8c llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/opt/ohpc/pub/easybuild/software/juaweihi1620/Stages/2021a/software/Clang/12.0.0/lib/libLLVMCore.so.12+0x3d9a8c)
#20 0x0000ffffa844ed04 clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::HeaderSearchOptions const&, clang::CodeGenOptions const&,
clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout
const&, llvm::Module*, clang::BackendAction,
std::__1::unique_ptr<llvm::raw_pwrite_stream,
std::__1::default_delete<llvm::raw_pwrite_stream> >)
(/opt/ohpc/pub/easybuild/software/juaweihi1620/Stages/2021a/software/Clang/12.0.0/lib/libclangCodeGen.so.12+0x26ed04)
#21 0x0000ffffa872a2b0
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/opt/ohpc/pub/easybuild/software/juaweihi1620/Stages/2021a/software/Clang/12.0.0/lib/libclangCodeGen.so.12+0x54a2b0)
#22 0x0000ffffa2113d4c clang::ParseAST(clang::Sema&, bool, bool)
(/opt/ohpc/pub/easybuild/software/juaweihi1620/Stages/2021a/software/Clang/12.0.0/lib/libclangParse.so.12+0x73d4c)
#23 0x0000ffffa6bcffe4 clang::FrontendAction::Execute()
(/opt/ohpc/pub/easybuild/software/juaweihi1620/Stages/2021a/software/Clang/12.0.0/lib/libclangFrontend.so.12+0x16ffe4)
#24 0x0000ffffa6b63290
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/opt/ohpc/pub/easybuild/software/juaweihi1620/Stages/2021a/software/Clang/12.0.0/lib/libclangFrontend.so.12+0x103290)
#25 0x0000ffffa8c35e78
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/opt/ohpc/pub/easybuild/software/juaweihi1620/Stages/2021a/software/Clang/12.0.0/lib/libclangFrontendTool.so.12+0x15e78)
#26 0x000000000022aad0 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*)
(/opt/ohpc/pub/easybuild/software/juaweihi1620/Stages/2021a/software/Clang/12.0.0/bin/clang-12+0x22aad0)
#27 0x0000000000226258 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
(/opt/ohpc/pub/easybuild/software/juaweihi1620/Stages/2021a/software/Clang/12.0.0/bin/clang-12+0x226258)
#28 0x0000ffffa68f9f98 void llvm::function_ref<void
()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
>, std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> >*, bool*) const::$_1>(long)
(/opt/ohpc/pub/easybuild/software/juaweihi1620/Stages/2021a/software/Clang/12.0.0/lib/libclangDriver.so.12+0x109f98)
#29 0x0000ffffa4cd6538
llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>)
(/opt/ohpc/pub/easybuild/software/juaweihi1620/Stages/2021a/software/Clang/12.0.0/lib/libLLVMSupport.so.12+0x146538)
#30 0x0000ffffa68f9568
clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
>, std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> >*, bool*) const
(/opt/ohpc/pub/easybuild/software/juaweihi1620/Stages/2021a/software/Clang/12.0.0/lib/libclangDriver.so.12+0x109568)
#31 0x0000ffffa68cad68
clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&,
clang::driver::Command const*&) const
(/opt/ohpc/pub/easybuild/software/juaweihi1620/Stages/2021a/software/Clang/12.0.0/lib/libclangDriver.so.12+0xdad68)
#32 0x0000ffffa68cb10c
clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&,
llvm::SmallVectorImpl<std::__1::pair<int, clang::driver::Command const*> >&)
const
(/opt/ohpc/pub/easybuild/software/juaweihi1620/Stages/2021a/software/Clang/12.0.0/lib/libclangDriver.so.12+0xdb10c)
#33 0x0000ffffa68e00e4
clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&,
llvm::SmallVectorImpl<std::__1::pair<int, clang::driver::Command const*> >&)
(/opt/ohpc/pub/easybuild/software/juaweihi1620/Stages/2021a/software/Clang/12.0.0/lib/libclangDriver.so.12+0xf00e4)
#34 0x0000000000225600 main
(/opt/ohpc/pub/easybuild/software/juaweihi1620/Stages/2021a/software/Clang/12.0.0/bin/clang-12+0x225600)
#35 0x0000ffffa47b0be4 __libc_start_main (/lib64/libc.so.6+0x20be4)
#36 0x0000000000222ac4 _start
(/opt/ohpc/pub/easybuild/software/juaweihi1620/Stages/2021a/software/Clang/12.0.0/bin/clang-12+0x222ac4)
clang-12: error: clang frontend command failed with exit code 134 (use -v to
see invocation)
clang version 12.0.0
Target: aarch64-unknown-linux-gnu
Thread model: posix
InstalledDir:
/opt/ohpc/pub/easybuild/software/juaweihi1620/Stages/2021a/software/Clang/12.0.0/bin
clang-12: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-12: note: diagnostic msg: /tmp/test-23d031.c
clang-12: note: diagnostic msg: /tmp/test-23d031.sh
clang-12: note: diagnostic msg: 


********************
[brank1 at juawei-cn02 test]$ cat /tmp/test-23d031.c
# 1 "<built-in>"
# 1 "test.c"
#define LEN 1000

float a[LEN];
float b[LEN];

void func1() {
    #pragma clang loop vectorize_width(2, scalable)
    for (int i = 1; i < LEN; i += 2) {
        a[i] = a[i-1] + b[i];
    }
}
[brank1 at juawei-cn02 test]$ cat /tmp/test-23d031.sh
# Crash reproducer for clang version 12.0.0
# Driver args: "-march=armv8-a+sve" "-Ofast" "test.c" "-S" "-o" "test.s"
# Original command: 
"/opt/ohpc/pub/easybuild/software/juaweihi1620/Stages/2021a/software/Clang/12.0.0/bin/clang-12"
"-cc1" "-triple" "aarch64-unknown-linux-gnu" "-S" "-disable-free"
"-main-file-name" "test.c" "-mrelocation-model" "static"
"-mframe-pointer=non-leaf" "-menable-no-infs" "-menable-no-nans"
"-menable-unsafe-fp-math" "-fno-signed-zeros" "-mreassociate"
"-freciprocal-math" "-ffp-contract=fast" "-fno-rounding-math" "-ffast-math"
"-ffinite-math-only" "-mconstructor-aliases" "-munwind-tables" "-target-cpu"
"generic" "-target-feature" "+neon" "-target-feature" "+sve" "-target-abi"
"aapcs" "-fallow-half-arguments-and-returns" "-fno-split-dwarf-inlining"
"-debugger-tuning=gdb" "-resource-dir"
"/opt/ohpc/pub/easybuild/software/juaweihi1620/Stages/2021a/software/Clang/12.0.0/lib/clang/12.0.0"
"-I/opt/ohpc/pub/easybuild/software/juaweihi1620/Stages/2021a/software/ncurses/6.2-Clang-12.0.0/include"
"-I/opt/ohpc/pub/easybuild/software/juaweihi1620/Stages/2021a/software/binutils/2.36.1-Clang-12.0.0/include"
"-I/opt/ohpc/pub/easybuild/software/juaweihi1620/Stages/2021a/software/Clang/12.0.0/include"
"-I/opt/ohpc/pub/easybuild/software/juaweihi1620/Stages/2021a/software/libedit/20210216/include"
"-I/opt/ohpc/pub/libs/arm-optimized-routines-21.02/Kunpeng920/include"
"-internal-isystem" "/usr/local/include" "-internal-isystem"
"/opt/ohpc/pub/easybuild/software/juaweihi1620/Stages/2021a/software/Clang/12.0.0/lib/clang/12.0.0/include"
"-internal-externc-isystem" "/include" "-internal-externc-isystem"
"/usr/include" "-Ofast" "-fdebug-compilation-dir"
"/home/jusers/brank1/juawei/test" "-ferror-limit" "19" "-fno-signed-char"
"-fgnuc-version=4.2.1" "-fcolor-diagnostics" "-vectorize-loops"
"-vectorize-slp" "-faddrsig" "-o" "test.s" "-x" "c" "test.c"

"/opt/ohpc/pub/easybuild/software/juaweihi1620/Stages/2021a/software/Clang/12.0.0/bin/clang-12"
"-cc1" "-triple" "aarch64-unknown-linux-gnu" "-S" "-disable-free"
"-main-file-name" "test.c" "-mrelocation-model" "static"
"-mframe-pointer=non-leaf" "-menable-no-infs" "-menable-no-nans"
"-menable-unsafe-fp-math" "-fno-signed-zeros" "-mreassociate"
"-freciprocal-math" "-ffp-contract=fast" "-fno-rounding-math" "-ffast-math"
"-ffinite-math-only" "-mconstructor-aliases" "-munwind-tables" "-target-cpu"
"generic" "-target-feature" "+neon" "-target-feature" "+sve" "-target-abi"
"aapcs" "-fallow-half-arguments-and-returns" "-fno-split-dwarf-inlining"
"-debugger-tuning=gdb" "-Ofast" "-ferror-limit" "19" "-fno-signed-char"
"-fgnuc-version=4.2.1" "-fcolor-diagnostics" "-vectorize-loops"
"-vectorize-slp" "-faddrsig" "-x" "c" "test-23d031.c"

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210706/e3863e8a/attachment-0001.html>


More information about the llvm-bugs mailing list