From: Max Bruce <max.bruce12@gmail.com>
To: gsl-discuss@sourceware.org
Subject: Reduce cache misses for source_gemm_r
Date: Fri, 19 Oct 2018 03:10:00 -0000 [thread overview]
Message-ID: <CABb0SYR+gNfaui-M6aWg8Ed6cQ8=N8YyBYP+LQgS1VXWG1H-Kg@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 437 bytes --]
Hey guys,
I'm new to contributing to GNU projects, but... I'm guessing I send
commits through here? Would appreciate some sort of note on the
procedure on the website
I noticed that your matrix multiplication code had bad cache
performance due to a misordering of a loop. In a replicated version of
my change, I saw about 20% performance gains on my AMD FX CPU.
Do let me know if this is not the correct contribution procedure.
-Max
[-- Attachment #2: 0001-Reduce-cache-misses-for-source_gemm_r.patch --]
[-- Type: text/x-patch, Size: 1622 bytes --]
From 0345eaf2eb48997fa3d00fae2b37cf416d3713d4 Mon Sep 17 00:00:00 2001
From: JavaProphet <max.bruce12@gmail.com>
Date: Thu, 18 Oct 2018 20:00:47 -0700
Subject: [PATCH] Reduce cache misses for source_gemm_r
---
cblas/source_gemm_r.h | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/cblas/source_gemm_r.h b/cblas/source_gemm_r.h
index a008d22..7c9848e 100644
--- a/cblas/source_gemm_r.h
+++ b/cblas/source_gemm_r.h
@@ -71,8 +71,8 @@
/* form C := alpha*A*B + C */
- for (k = 0; k < K; k++) {
- for (i = 0; i < n1; i++) {
+ for (i = 0; i < n1; i++) {
+ for (k = 0; k < K; k++) {
const BASE temp = alpha * F[ldf * i + k];
if (temp != 0.0) {
for (j = 0; j < n2; j++) {
@@ -86,8 +86,8 @@
/* form C := alpha*A*B' + C */
+ for (j = 0; j < n2; j++) {
for (i = 0; i < n1; i++) {
- for (j = 0; j < n2; j++) {
BASE temp = 0.0;
for (k = 0; k < K; k++) {
temp += F[ldf * i + k] * G[ldg * j + k];
@@ -98,8 +98,8 @@
} else if (TransF == CblasTrans && TransG == CblasNoTrans) {
+ for (i = 0; i < n1; i++) {
for (k = 0; k < K; k++) {
- for (i = 0; i < n1; i++) {
const BASE temp = alpha * F[ldf * k + i];
if (temp != 0.0) {
for (j = 0; j < n2; j++) {
@@ -111,8 +111,8 @@
} else if (TransF == CblasTrans && TransG == CblasTrans) {
+ for (j = 0; j < n2; j++) {
for (i = 0; i < n1; i++) {
- for (j = 0; j < n2; j++) {
BASE temp = 0.0;
for (k = 0; k < K; k++) {
temp += F[ldf * k + i] * G[ldg * j + k];
--
2.7.4
next reply other threads:[~2018-10-19 3:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-19 3:10 Max Bruce [this message]
2018-10-19 8:18 ` Patrick Alken
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='CABb0SYR+gNfaui-M6aWg8Ed6cQ8=N8YyBYP+LQgS1VXWG1H-Kg@mail.gmail.com' \
--to=max.bruce12@gmail.com \
--cc=gsl-discuss@sourceware.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: link
Be 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).