[LLVMbugs] [Bug 16578] New: Reduced performance with int, int vs double, int loop condition.
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Tue Jul 9 13:24:59 PDT 2013
http://llvm.org/bugs/show_bug.cgi?id=16578
Bug ID: 16578
Summary: Reduced performance with int, int vs double, int loop
condition.
Product: clang
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: dalecurtis at chromium.org
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
Created attachment 10846
--> http://llvm.org/bugs/attachment.cgi?id=10846&action=edit
Minimized test case.
I'm not sure if this qualifies as a bug or not, but its definitely an odd
performance degradation. Essentially, switching from a loop with double, int
comparison to a int, int comparison is resulting in a 20% performance
reduction. The change is going from:
int block_size_;
double virtual_source_idx_;
while (virtual_source_idx_ < block_size_) {
const int source_idx = virtual_source_idx_;
<snip>
Convolve_SSE(...)
}
to
int block_size_;
double virtual_source_idx_;
while (true) {
const int source_idx = virtual_source_idx_;
if (source_idx >= block_size_)
break;
<snip>
Convolve_SSE(...)
}
Strangely, switching from the hand rolled intrinsic Convolve_SSE() to
Convolve_C() shows an improvement with the same change -- so it's possible this
is some odd SIMD interaction. It'd be nice if both versions provided the same
performance, as older ARM chips perform poorly with the double, int version.
While I'm wishing, it'd be nice if the auto-vectorized Convolve_C() performed
as well as the hand rolled Convolve_SSE() :)
I've attached a minimized test case. Here are the raw results from my machine
(plus gcc for comparison):
$ uname -a Linux <snip> 3.2.5-gg1236 #1 SMP Tue May 21 02:35:06 PDT 2013 x86_64
x86_64 x86_64 GNU/Linux
$ clang --version
clang version 3.4 (trunk 184830)
Target: x86_64-unknown-linux-gnu
Thread model: posix
$ clang resample.cc -O2 -lstdc++ && time ./a.out
real 0m10.063s
user 0m10.030s
sys 0m0.000s
$ clang resample.cc -O2 -lstdc++ -DINTEGER_COMPARE && time ./a.out
real 0m9.151s
user 0m9.120s
sys 0m0.000s
$ clang resample.cc -O2 -lstdc++ -DUSE_SSE && time ./a.out
real 0m4.004s
user 0m3.990s
sys 0m0.000s
$ clang resample.cc -O2 -lstdc++ -DUSE_SSE -DINTEGER_COMPARE && time ./a.out
real 0m5.022s
user 0m4.990s
sys 0m0.010s
$ g++ --version
g++ (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ g++ resample.cc -O2 -lstdc++ && time ./a.out
real 0m10.056s
user 0m10.020s
sys 0m0.000s
$ g++ resample.cc -O2 -lstdc++ -DINTEGER_COMPARE && time ./a.out
real 0m10.069s
user 0m9.990s
sys 0m0.040s
$ g++ resample.cc -O2 -lstdc++ -DUSE_SSE && time ./a.out
real 0m5.319s
user 0m5.280s
sys 0m0.020s
$ g++ resample.cc -O2 -lstdc++ -DUSE_SSE -DINTEGER_COMPARE && time ./a.out
real 0m5.034s
user 0m4.990s
sys 0m0.020s
--
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/20130709/358d619d/attachment.html>
More information about the llvm-bugs
mailing list