public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/110456] New: vectorization with loop masking prone to STLF issues Date: Wed, 28 Jun 2023 12:53:10 +0000 [thread overview] Message-ID: <bug-110456-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110456 Bug ID: 110456 Summary: vectorization with loop masking prone to STLF issues Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: rguenth at gcc dot gnu.org Target Milestone: --- void __attribute__((noipa)) test (double * __restrict a, double *b, int n, int m) { for (int j = 0; j < m; ++j) for (int i = 0; i < n; ++i) a[i + j*n] = a[i + j*n /* + 512 */] + b[i + j*n]; } double a[1024]; double b[1024]; int main(int argc, char **argv) { int m = atoi (argv[1]); for (long i = 0; i < 1000000000; ++i) test (a + 4, b + 4, 4, m); } Shows that when we apply loop masking with --param vect-partial-vector-usage then masked stores will generally prohibit store-to-load forwarding, especially when there's only a partial overlap with a following load like when traversing a multi-dimensional array as above. The above runs noticable slower compared to when the loads are offset (uncomment the /* + 512 */). The situation is difficult to avoid in general but there might be easy heuristics that could be implemented like avoiding loop masking when there's a read-modify-write operation to the same memory location in a loop (with or without an immediately visible outer loop). For unknown dependences and thus runtime disambiguation a proper distance of any read/write operation could be ensured as well.
next reply other threads:[~2023-06-28 12:53 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-06-28 12:53 rguenth at gcc dot gnu.org [this message] 2023-06-28 13:25 ` [Bug target/110456] " rguenth at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-110456-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).