summaryrefslogtreecommitdiff
path: root/src/routines/level3
diff options
context:
space:
mode:
Diffstat (limited to 'src/routines/level3')
-rw-r--r--src/routines/level3/xgemm.cc2
-rw-r--r--src/routines/level3/xgemm.hpp48
-rw-r--r--src/routines/level3/xhemm.cc2
-rw-r--r--src/routines/level3/xhemm.hpp54
-rw-r--r--src/routines/level3/xher2k.cc2
-rw-r--r--src/routines/level3/xher2k.hpp46
-rw-r--r--src/routines/level3/xherk.cc2
-rw-r--r--src/routines/level3/xherk.hpp45
-rw-r--r--src/routines/level3/xsymm.cc2
-rw-r--r--src/routines/level3/xsymm.hpp56
-rw-r--r--src/routines/level3/xsyr2k.cc2
-rw-r--r--src/routines/level3/xsyr2k.hpp46
-rw-r--r--src/routines/level3/xsyrk.cc2
-rw-r--r--src/routines/level3/xsyrk.hpp47
-rw-r--r--src/routines/level3/xtrmm.cc2
-rw-r--r--src/routines/level3/xtrmm.hpp54
16 files changed, 404 insertions, 8 deletions
diff --git a/src/routines/level3/xgemm.cc b/src/routines/level3/xgemm.cc
index 8386ad09..9ea5559c 100644
--- a/src/routines/level3/xgemm.cc
+++ b/src/routines/level3/xgemm.cc
@@ -11,7 +11,7 @@
//
// =================================================================================================
-#include "internal/routines/level3/xgemm.h"
+#include "routines/level3/xgemm.hpp"
#include <string>
#include <vector>
diff --git a/src/routines/level3/xgemm.hpp b/src/routines/level3/xgemm.hpp
new file mode 100644
index 00000000..71723d78
--- /dev/null
+++ b/src/routines/level3/xgemm.hpp
@@ -0,0 +1,48 @@
+
+// =================================================================================================
+// This file is part of the CLBlast project. The project is licensed under Apache Version 2.0. This
+// project loosely follows the Google C++ styleguide and uses a tab-size of two spaces and a max-
+// width of 100 characters per line.
+//
+// Author(s):
+// Cedric Nugteren <www.cedricnugteren.nl>
+//
+// This file implements the Xgemm routine. The precision is implemented using a template argument.
+//
+// =================================================================================================
+
+#ifndef CLBLAST_ROUTINES_XGEMM_H_
+#define CLBLAST_ROUTINES_XGEMM_H_
+
+#include "routine.hpp"
+
+namespace clblast {
+// =================================================================================================
+
+// See comment at top of file for a description of the class
+template <typename T>
+class Xgemm: public Routine {
+ public:
+
+ // Constructor
+ Xgemm(Queue &queue, EventPointer event, const std::string &name = "GEMM");
+
+ // Templated-precision implementation of the routine
+ StatusCode DoGemm(const Layout layout, const Transpose a_transpose, const Transpose b_transpose,
+ const size_t m, const size_t n, const size_t k,
+ const T alpha,
+ const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld,
+ const Buffer<T> &b_buffer, const size_t b_offset, const size_t b_ld,
+ const T beta,
+ const Buffer<T> &c_buffer, const size_t c_offset, const size_t c_ld);
+
+ protected:
+ // Static variable to get the precision
+ const static Precision precision_;
+};
+
+// =================================================================================================
+} // namespace clblast
+
+// CLBLAST_ROUTINES_XGEMM_H_
+#endif
diff --git a/src/routines/level3/xhemm.cc b/src/routines/level3/xhemm.cc
index 8120c09c..9813503e 100644
--- a/src/routines/level3/xhemm.cc
+++ b/src/routines/level3/xhemm.cc
@@ -11,7 +11,7 @@
//
// =================================================================================================
-#include "internal/routines/level3/xhemm.h"
+#include "routines/level3/xhemm.hpp"
#include <string>
#include <vector>
diff --git a/src/routines/level3/xhemm.hpp b/src/routines/level3/xhemm.hpp
new file mode 100644
index 00000000..d79b42a1
--- /dev/null
+++ b/src/routines/level3/xhemm.hpp
@@ -0,0 +1,54 @@
+
+// =================================================================================================
+// This file is part of the CLBlast project. The project is licensed under Apache Version 2.0. This
+// project loosely follows the Google C++ styleguide and uses a tab-size of two spaces and a max-
+// width of 100 characters per line.
+//
+// Author(s):
+// Cedric Nugteren <www.cedricnugteren.nl>
+//
+// This file implements the Xhemm routine. It is based on the generalized matrix multiplication
+// routine (Xgemm). The implementation is very similar to the Xsymm routine.
+//
+// =================================================================================================
+
+#ifndef CLBLAST_ROUTINES_XHEMM_H_
+#define CLBLAST_ROUTINES_XHEMM_H_
+
+#include "routines/level3/xgemm.hpp"
+
+namespace clblast {
+// =================================================================================================
+
+// See comment at top of file for a description of the class
+template <typename T>
+class Xhemm: public Xgemm<T> {
+ public:
+
+ // Uses methods and variables the regular Xgemm routine
+ using Xgemm<T>::precision_;
+ using Xgemm<T>::routine_name_;
+ using Xgemm<T>::queue_;
+ using Xgemm<T>::context_;
+ using Xgemm<T>::device_;
+ using Xgemm<T>::db_;
+ using Xgemm<T>::DoGemm;
+
+ // Constructor
+ Xhemm(Queue &queue, EventPointer event, const std::string &name = "HEMM");
+
+ // Templated-precision implementation of the routine
+ StatusCode DoHemm(const Layout layout, const Side side, const Triangle triangle,
+ const size_t m, const size_t n,
+ const T alpha,
+ const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld,
+ const Buffer<T> &b_buffer, const size_t b_offset, const size_t b_ld,
+ const T beta,
+ const Buffer<T> &c_buffer, const size_t c_offset, const size_t c_ld);
+};
+
+// =================================================================================================
+} // namespace clblast
+
+// CLBLAST_ROUTINES_XHEMM_H_
+#endif
diff --git a/src/routines/level3/xher2k.cc b/src/routines/level3/xher2k.cc
index bd0f83dd..bd7a053e 100644
--- a/src/routines/level3/xher2k.cc
+++ b/src/routines/level3/xher2k.cc
@@ -11,7 +11,7 @@
//
// =================================================================================================
-#include "internal/routines/level3/xher2k.h"
+#include "routines/level3/xher2k.hpp"
#include <string>
#include <vector>
diff --git a/src/routines/level3/xher2k.hpp b/src/routines/level3/xher2k.hpp
new file mode 100644
index 00000000..23996219
--- /dev/null
+++ b/src/routines/level3/xher2k.hpp
@@ -0,0 +1,46 @@
+
+// =================================================================================================
+// This file is part of the CLBlast project. The project is licensed under Apache Version 2.0. This
+// project loosely follows the Google C++ styleguide and uses a tab-size of two spaces and a max-
+// width of 100 characters per line.
+//
+// Author(s):
+// Cedric Nugteren <www.cedricnugteren.nl>
+//
+// This file implements the Xher2k routine. The precision is implemented using the template argument
+// 'T', whereas the alpha/beta arguments are of type 'U'. The implementation is very similar to the
+// Xsyr2k routine.
+//
+// =================================================================================================
+
+#ifndef CLBLAST_ROUTINES_XHER2K_H_
+#define CLBLAST_ROUTINES_XHER2K_H_
+
+#include "routine.hpp"
+
+namespace clblast {
+// =================================================================================================
+
+// See comment at top of file for a description of the class
+template <typename T, typename U>
+class Xher2k: public Routine {
+ public:
+
+ // Constructor
+ Xher2k(Queue &queue, EventPointer event, const std::string &name = "HER2K");
+
+ // Templated-precision implementation of the routine
+ StatusCode DoHer2k(const Layout layout, const Triangle triangle, const Transpose ab_transpose,
+ const size_t n, const size_t k,
+ const T alpha,
+ const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld,
+ const Buffer<T> &b_buffer, const size_t b_offset, const size_t b_ld,
+ const U beta,
+ const Buffer<T> &c_buffer, const size_t c_offset, const size_t c_ld);
+};
+
+// =================================================================================================
+} // namespace clblast
+
+// CLBLAST_ROUTINES_XHER2K_H_
+#endif
diff --git a/src/routines/level3/xherk.cc b/src/routines/level3/xherk.cc
index 6155734a..6ef7f21f 100644
--- a/src/routines/level3/xherk.cc
+++ b/src/routines/level3/xherk.cc
@@ -11,7 +11,7 @@
//
// =================================================================================================
-#include "internal/routines/level3/xherk.h"
+#include "routines/level3/xherk.hpp"
#include <string>
#include <vector>
diff --git a/src/routines/level3/xherk.hpp b/src/routines/level3/xherk.hpp
new file mode 100644
index 00000000..3f156a1b
--- /dev/null
+++ b/src/routines/level3/xherk.hpp
@@ -0,0 +1,45 @@
+
+// =================================================================================================
+// This file is part of the CLBlast project. The project is licensed under Apache Version 2.0. This
+// project loosely follows the Google C++ styleguide and uses a tab-size of two spaces and a max-
+// width of 100 characters per line.
+//
+// Author(s):
+// Cedric Nugteren <www.cedricnugteren.nl>
+//
+// This file implements the Xherk routine. The precision is implemented using the template argument
+// 'T', whereas the alpha/beta arguments are of type 'U'. The implementation is very similar to the
+// Xsyrk routine.
+//
+// =================================================================================================
+
+#ifndef CLBLAST_ROUTINES_XHERK_H_
+#define CLBLAST_ROUTINES_XHERK_H_
+
+#include "routine.hpp"
+
+namespace clblast {
+// =================================================================================================
+
+// See comment at top of file for a description of the class
+template <typename T, typename U>
+class Xherk: public Routine {
+ public:
+
+ // Constructor
+ Xherk(Queue &queue, EventPointer event, const std::string &name = "HERK");
+
+ // Templated-precision implementation of the routine
+ StatusCode DoHerk(const Layout layout, const Triangle triangle, const Transpose a_transpose,
+ const size_t n, const size_t k,
+ const U alpha,
+ const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld,
+ const U beta,
+ const Buffer<T> &c_buffer, const size_t c_offset, const size_t c_ld);
+};
+
+// =================================================================================================
+} // namespace clblast
+
+// CLBLAST_ROUTINES_XHERK_H_
+#endif
diff --git a/src/routines/level3/xsymm.cc b/src/routines/level3/xsymm.cc
index c5e56617..04e4b718 100644
--- a/src/routines/level3/xsymm.cc
+++ b/src/routines/level3/xsymm.cc
@@ -11,7 +11,7 @@
//
// =================================================================================================
-#include "internal/routines/level3/xsymm.h"
+#include "routines/level3/xsymm.hpp"
#include <string>
#include <vector>
diff --git a/src/routines/level3/xsymm.hpp b/src/routines/level3/xsymm.hpp
new file mode 100644
index 00000000..754dd7a0
--- /dev/null
+++ b/src/routines/level3/xsymm.hpp
@@ -0,0 +1,56 @@
+
+// =================================================================================================
+// This file is part of the CLBlast project. The project is licensed under Apache Version 2.0. This
+// project loosely follows the Google C++ styleguide and uses a tab-size of two spaces and a max-
+// width of 100 characters per line.
+//
+// Author(s):
+// Cedric Nugteren <www.cedricnugteren.nl>
+//
+// This file implements the Xsymm routine. It is based on the generalized matrix multiplication
+// routine (Xgemm). The Xsymm class inherits from the templated class Xgemm, allowing it to call the
+// "DoGemm" function directly. The "DoSymm" function first preprocesses the symmetric matrix by
+// transforming it into a general matrix, and then calls the regular GEMM code.
+//
+// =================================================================================================
+
+#ifndef CLBLAST_ROUTINES_XSYMM_H_
+#define CLBLAST_ROUTINES_XSYMM_H_
+
+#include "routines/level3/xgemm.hpp"
+
+namespace clblast {
+// =================================================================================================
+
+// See comment at top of file for a description of the class
+template <typename T>
+class Xsymm: public Xgemm<T> {
+ public:
+
+ // Uses methods and variables the regular Xgemm routine
+ using Xgemm<T>::precision_;
+ using Xgemm<T>::routine_name_;
+ using Xgemm<T>::queue_;
+ using Xgemm<T>::context_;
+ using Xgemm<T>::device_;
+ using Xgemm<T>::db_;
+ using Xgemm<T>::DoGemm;
+
+ // Constructor
+ Xsymm(Queue &queue, EventPointer event, const std::string &name = "SYMM");
+
+ // Templated-precision implementation of the routine
+ StatusCode DoSymm(const Layout layout, const Side side, const Triangle triangle,
+ const size_t m, const size_t n,
+ const T alpha,
+ const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld,
+ const Buffer<T> &b_buffer, const size_t b_offset, const size_t b_ld,
+ const T beta,
+ const Buffer<T> &c_buffer, const size_t c_offset, const size_t c_ld);
+};
+
+// =================================================================================================
+} // namespace clblast
+
+// CLBLAST_ROUTINES_XSYMM_H_
+#endif
diff --git a/src/routines/level3/xsyr2k.cc b/src/routines/level3/xsyr2k.cc
index f9655889..424d4d2d 100644
--- a/src/routines/level3/xsyr2k.cc
+++ b/src/routines/level3/xsyr2k.cc
@@ -11,7 +11,7 @@
//
// =================================================================================================
-#include "internal/routines/level3/xsyr2k.h"
+#include "routines/level3/xsyr2k.hpp"
#include <string>
#include <vector>
diff --git a/src/routines/level3/xsyr2k.hpp b/src/routines/level3/xsyr2k.hpp
new file mode 100644
index 00000000..56185653
--- /dev/null
+++ b/src/routines/level3/xsyr2k.hpp
@@ -0,0 +1,46 @@
+
+// =================================================================================================
+// This file is part of the CLBlast project. The project is licensed under Apache Version 2.0. This
+// project loosely follows the Google C++ styleguide and uses a tab-size of two spaces and a max-
+// width of 100 characters per line.
+//
+// Author(s):
+// Cedric Nugteren <www.cedricnugteren.nl>
+//
+// This file implements the Xsyr2k routine. The precision is implemented using a template argument.
+// The implementation is very similar to Xsyrk (see header for details), except for the fact that
+// the main XgemmUpper/XgemmLower kernel is called twice: C = AB^T + C and C = BA^T + C.
+//
+// =================================================================================================
+
+#ifndef CLBLAST_ROUTINES_XSYR2K_H_
+#define CLBLAST_ROUTINES_XSYR2K_H_
+
+#include "routine.hpp"
+
+namespace clblast {
+// =================================================================================================
+
+// See comment at top of file for a description of the class
+template <typename T>
+class Xsyr2k: public Routine {
+ public:
+
+ // Constructor
+ Xsyr2k(Queue &queue, EventPointer event, const std::string &name = "SYR2K");
+
+ // Templated-precision implementation of the routine
+ StatusCode DoSyr2k(const Layout layout, const Triangle triangle, const Transpose ab_transpose,
+ const size_t n, const size_t k,
+ const T alpha,
+ const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld,
+ const Buffer<T> &b_buffer, const size_t b_offset, const size_t b_ld,
+ const T beta,
+ const Buffer<T> &c_buffer, const size_t c_offset, const size_t c_ld);
+};
+
+// =================================================================================================
+} // namespace clblast
+
+// CLBLAST_ROUTINES_XSYR2K_H_
+#endif
diff --git a/src/routines/level3/xsyrk.cc b/src/routines/level3/xsyrk.cc
index bceb6afd..f56c232b 100644
--- a/src/routines/level3/xsyrk.cc
+++ b/src/routines/level3/xsyrk.cc
@@ -11,7 +11,7 @@
//
// =================================================================================================
-#include "internal/routines/level3/xsyrk.h"
+#include "routines/level3/xsyrk.hpp"
#include <string>
#include <vector>
diff --git a/src/routines/level3/xsyrk.hpp b/src/routines/level3/xsyrk.hpp
new file mode 100644
index 00000000..7c075c26
--- /dev/null
+++ b/src/routines/level3/xsyrk.hpp
@@ -0,0 +1,47 @@
+
+// =================================================================================================
+// This file is part of the CLBlast project. The project is licensed under Apache Version 2.0. This
+// project loosely follows the Google C++ styleguide and uses a tab-size of two spaces and a max-
+// width of 100 characters per line.
+//
+// Author(s):
+// Cedric Nugteren <www.cedricnugteren.nl>
+//
+// This file implements the Xsyrk routine. The precision is implemented using a template argument.
+// The implementation is based on the regular Xgemm routine and kernel, but with two main changes:
+// 1) The final unpad(transpose) kernel updates only the upper/lower triangular part.
+// 2) The main Xgemm kernel masks workgroups not contributing to usefull data. This is only for
+// performance reasons, as the actual masking is done later (see the first point).
+//
+// =================================================================================================
+
+#ifndef CLBLAST_ROUTINES_XSYRK_H_
+#define CLBLAST_ROUTINES_XSYRK_H_
+
+#include "routine.hpp"
+
+namespace clblast {
+// =================================================================================================
+
+// See comment at top of file for a description of the class
+template <typename T>
+class Xsyrk: public Routine {
+ public:
+
+ // Constructor
+ Xsyrk(Queue &queue, EventPointer event, const std::string &name = "SYRK");
+
+ // Templated-precision implementation of the routine
+ StatusCode DoSyrk(const Layout layout, const Triangle triangle, const Transpose a_transpose,
+ const size_t n, const size_t k,
+ const T alpha,
+ const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld,
+ const T beta,
+ const Buffer<T> &c_buffer, const size_t c_offset, const size_t c_ld);
+};
+
+// =================================================================================================
+} // namespace clblast
+
+// CLBLAST_ROUTINES_XSYRK_H_
+#endif
diff --git a/src/routines/level3/xtrmm.cc b/src/routines/level3/xtrmm.cc
index 92dda9fb..74a82822 100644
--- a/src/routines/level3/xtrmm.cc
+++ b/src/routines/level3/xtrmm.cc
@@ -11,7 +11,7 @@
//
// =================================================================================================
-#include "internal/routines/level3/xtrmm.h"
+#include "routines/level3/xtrmm.hpp"
#include <string>
#include <vector>
diff --git a/src/routines/level3/xtrmm.hpp b/src/routines/level3/xtrmm.hpp
new file mode 100644
index 00000000..bb435592
--- /dev/null
+++ b/src/routines/level3/xtrmm.hpp
@@ -0,0 +1,54 @@
+
+// =================================================================================================
+// This file is part of the CLBlast project. The project is licensed under Apache Version 2.0. This
+// project loosely follows the Google C++ styleguide and uses a tab-size of two spaces and a max-
+// width of 100 characters per line.
+//
+// Author(s):
+// Cedric Nugteren <www.cedricnugteren.nl>
+//
+// This file implements the Xtrmm routine. The implementation is based on first transforming the
+// upper/lower unit/non-unit triangular matrix into a regular matrix and then calling the GEMM
+// routine. Therefore, this class inherits from the Xgemm class.
+//
+// =================================================================================================
+
+#ifndef CLBLAST_ROUTINES_XTRMM_H_
+#define CLBLAST_ROUTINES_XTRMM_H_
+
+#include "routines/level3/xgemm.hpp"
+
+namespace clblast {
+// =================================================================================================
+
+// See comment at top of file for a description of the class
+template <typename T>
+class Xtrmm: public Xgemm<T> {
+ public:
+
+ // Uses methods and variables the regular Xgemm routine
+ using Xgemm<T>::precision_;
+ using Xgemm<T>::routine_name_;
+ using Xgemm<T>::queue_;
+ using Xgemm<T>::context_;
+ using Xgemm<T>::device_;
+ using Xgemm<T>::db_;
+ using Xgemm<T>::DoGemm;
+
+ // Constructor
+ Xtrmm(Queue &queue, EventPointer event, const std::string &name = "TRMM");
+
+ // Templated-precision implementation of the routine
+ StatusCode DoTrmm(const Layout layout, const Side side, const Triangle triangle,
+ const Transpose a_transpose, const Diagonal diagonal,
+ const size_t m, const size_t n,
+ const T alpha,
+ const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld,
+ const Buffer<T> &b_buffer, const size_t b_offset, const size_t b_ld);
+};
+
+// =================================================================================================
+} // namespace clblast
+
+// CLBLAST_ROUTINES_XTRMM_H_
+#endif