https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115362
Bug ID: 115362
Summary: fixed_size_simd dot product recognition not working
for stdx::reduce
Product: gcc
Version: 14.1.1
Status: UNCONFIRMED
Severity: normal
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115362
--- Comment #1 from Jon Daniel ---
the generated code should be similar to the following using __m128 as
FIRST/OTHER type for floating point.
inline constexpr uint8_t mask4dp(size_t n)
{
switch(n)
{
case 1: retur
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115362
--- Comment #3 from Jon Daniel ---
Created attachment 58358
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58358&action=edit
compilable testcase
Compile:
g++ -march=native -mfpmath=sse -mveclibabi=svml -O3 -std=gnu++26 dotsimd.cpp -o
dot
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115362
--- Comment #4 from Jon Daniel ---
Created attachment 58359
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58359&action=edit
dotsimd assembly output with dot_sse only
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115362
--- Comment #5 from Jon Daniel ---
Created attachment 58360
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58360&action=edit
dotsimd assembly output with dot only
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115362
Jon Daniel changed:
What|Removed |Added
Attachment #58358|0 |1
is obsolete|
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115362
--- Comment #7 from Jon Daniel ---
sign of determinant result using the dot product differs from clang++ generated
binary
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115362
Jon Daniel changed:
What|Removed |Added
Attachment #58362|0 |1
is obsolete|
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115362
Jon Daniel changed:
What|Removed |Added
Attachment #58363|0 |1
is obsolete|
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115362
Jon Daniel changed:
What|Removed |Added
Attachment #58364|0 |1
is obsolete|
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115362
--- Comment #11 from Jon Daniel ---
g++ output:
dot_product stdx::reduce: -16.00
dot_product_mm_dp_ps: -16.00
determinant: dot_product: 717.00
determinant: submatrices: -717.00
clang++ output:
dot_product stdx::reduce: -16
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115362
--- Comment #13 from Jon Daniel ---
This bug is triggered by -O0 optimization level flag.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115362
--- Comment #14 from Jon Daniel ---
clang++ compiles with -O0 but generated executable segfaults
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115362
Jon Daniel changed:
What|Removed |Added
Attachment #58365|0 |1
is obsolete|
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115362
--- Comment #16 from Jon Daniel ---
See https://github.com/Const-me/SimdIntroArticle/ for different AVX2 DotProduct
examples and check if they have different signs with g++/clang++.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115362
Jon Daniel changed:
What|Removed |Added
Attachment #58367|0 |1
is obsolete|
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115362
Jon Daniel changed:
What|Removed |Added
Attachment #58359|0 |1
is obsolete|
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115362
--- Comment #19 from Jon Daniel ---
Created attachment 58401
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58401&action=edit
dotsimd clang asssemly output
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115362
--- Comment #20 from Jon Daniel ---
float s = storage::dot(a.pinr(i), b.pinr(i), c.pinr(i));
float t = storage::dot(a.pinr(j), b.pinr(j), c.pinr(j));
return s-t;
g++ interchanges the operands s-t with t-s: -575-142=-717 != 142-(-575)=717
causi
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115362
--- Comment #21 from Jon Daniel ---
The generated assembler output of
g++:
vmaskmovps 40(%rsp), %xmm1, %xmm0
vmaskmovps 56(%rsp), %xmm1, %xmm2
vmulps %xmm2, %xmm0, %xmm0
Notice the lower memory address regist
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115362
--- Comment #22 from Jon Daniel ---
The generated assembler output snippet:
g++:
vdpps $113, 72(%rsp), 24(%rsp), %xmm3
vdpps $113, 72(%rsp), 24(%rsp), %xmm2
vsubss %xmm2, %xmm3, %xmm0
Notice the second dot product
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115362
--- Comment #23 from Jon Daniel ---
(In reply to Jon Daniel from comment #21)
> The generated assembler output of
>
> g++:
> vmaskmovps 40(%rsp), %xmm1, %xmm0
> vmaskmovps 56(%rsp), %xmm1, %xmm2
> vmulps %xmm2
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115362
--- Comment #24 from Jon Daniel ---
The C++ analog is the difference between std::reduce and std::accumulate but
for sub operands.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115362
Jon Daniel changed:
What|Removed |Added
Status|WAITING |RESOLVED
Resolution|---
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119479
Bug ID: 119479
Summary: wrong sign caused by substraction operand swap of two
dot product operands
Product: gcc
Version: 14.2.1
Status: UNCONFIRMED
Severity: n
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119479
--- Comment #1 from Jon Daniel ---
*** Bug 115362 has been marked as a duplicate of this bug. ***
26 matches
Mail list logo