summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCedric Nugteren <web@cedricnugteren.nl>2016-06-17 13:57:50 +0200
committerCedric Nugteren <web@cedricnugteren.nl>2016-06-17 13:57:50 +0200
commit536b7fe4bce4b183cb060a1b9045752ae39d842f (patch)
tree1e1365317942c97f96764b774878868aae03faea /src
parent98a95c89fc0633efdc8439c942762bef9a1e5e1d (diff)
Removed the interface to the cache functions from the Routine class, calls them directly now
Diffstat (limited to 'src')
-rw-r--r--src/cache.cc4
-rw-r--r--src/clblast.cc2
-rw-r--r--src/routine.cc12
-rw-r--r--src/routines/level1/xamax.cc2
-rw-r--r--src/routines/level1/xasum.cc2
-rw-r--r--src/routines/level1/xaxpy.cc2
-rw-r--r--src/routines/level1/xcopy.cc2
-rw-r--r--src/routines/level1/xdot.cc2
-rw-r--r--src/routines/level1/xnrm2.cc2
-rw-r--r--src/routines/level1/xscal.cc2
-rw-r--r--src/routines/level1/xswap.cc2
-rw-r--r--src/routines/level2/xgemv.cc2
-rw-r--r--src/routines/level2/xger.cc2
-rw-r--r--src/routines/level2/xher.cc2
-rw-r--r--src/routines/level2/xher2.cc2
-rw-r--r--src/routines/level3/xgemm.cc2
-rw-r--r--src/routines/level3/xhemm.cc2
-rw-r--r--src/routines/level3/xher2k.cc2
-rw-r--r--src/routines/level3/xherk.cc2
-rw-r--r--src/routines/level3/xsymm.cc2
-rw-r--r--src/routines/level3/xsyr2k.cc2
-rw-r--r--src/routines/level3/xsyrk.cc2
-rw-r--r--src/routines/level3/xtrmm.cc2
-rw-r--r--src/routines/levelx/xomatcopy.cc2
24 files changed, 29 insertions, 31 deletions
diff --git a/src/cache.cc b/src/cache.cc
index 4dbdb711..a34d351f 100644
--- a/src/cache.cc
+++ b/src/cache.cc
@@ -18,7 +18,6 @@
#include "internal/cache.h"
namespace clblast {
-namespace cache {
// =================================================================================================
// Stores the compiled binary or IR in the cache
@@ -98,7 +97,7 @@ bool ProgramIsInCache(const Context &context, const Precision &precision,
// =================================================================================================
// Clears the cache of stored binaries and programs
-StatusCode ClearCache() {
+StatusCode CacheClearAll() {
binary_cache_mutex_.lock();
binary_cache_.clear();
binary_cache_mutex_.unlock();
@@ -109,5 +108,4 @@ StatusCode ClearCache() {
}
// =================================================================================================
-} // namespace cache
} // namespace clblast
diff --git a/src/clblast.cc b/src/clblast.cc
index e3df6ede..2d6776d0 100644
--- a/src/clblast.cc
+++ b/src/clblast.cc
@@ -2120,7 +2120,7 @@ template StatusCode PUBLIC_API Omatcopy<half>(const Layout, const Transpose,
// =================================================================================================
// Clears the cache of stored binaries
-StatusCode ClearCache() { return cache::ClearCache(); }
+StatusCode ClearCache() { return CacheClearAll(); }
// Fills the cache with all binaries for a specific device
StatusCode FillCache(const cl_device_id device) {
diff --git a/src/routine.cc b/src/routine.cc
index c59cbc11..1086aead 100644
--- a/src/routine.cc
+++ b/src/routine.cc
@@ -40,17 +40,17 @@ template <typename T>
StatusCode Routine<T>::SetUp() {
// Queries the cache to see whether or not the program (context-specific) is already there
- if (ProgramIsInCache()) { return StatusCode::kSuccess; }
+ if (ProgramIsInCache(context_, precision_, routine_name_)) { return StatusCode::kSuccess; }
// Queries the cache to see whether or not the binary (device-specific) is already there. If it
// is, a program is created and stored in the cache
- if (BinaryIsInCache()) {
+ if (BinaryIsInCache(device_name_, precision_, routine_name_)) {
try {
- auto& binary = cache::GetBinaryFromCache(device_name_, precision_, routine_name_);
+ auto& binary = GetBinaryFromCache(device_name_, precision_, routine_name_);
auto program = Program(device_, context_, binary);
auto options = std::vector<std::string>();
program.Build(device_, options);
- StoreProgramToCache(program);
+ StoreProgramToCache(program, context_, precision_, routine_name_);
} catch (...) { return StatusCode::kBuildProgramFailure; }
return StatusCode::kSuccess;
}
@@ -121,8 +121,8 @@ StatusCode Routine<T>::SetUp() {
// Store the compiled binary and program in the cache
const auto binary = program.GetIR();
- StoreBinaryToCache(binary);
- StoreProgramToCache(program);
+ StoreBinaryToCache(binary, device_name_, precision_, routine_name_);
+ StoreProgramToCache(program, context_, precision_, routine_name_);
} catch (...) { return StatusCode::kBuildProgramFailure; }
// No errors, normal termination of this function
diff --git a/src/routines/level1/xamax.cc b/src/routines/level1/xamax.cc
index 6028d953..9e203d03 100644
--- a/src/routines/level1/xamax.cc
+++ b/src/routines/level1/xamax.cc
@@ -56,7 +56,7 @@ StatusCode Xamax<T>::DoAmax(const size_t n,
// Retrieves the Xamax kernels from the compiled binary
try {
- const auto program = GetProgramFromCache();
+ const auto program = GetProgramFromCache(context_, precision_, routine_name_);
auto kernel1 = Kernel(program, "Xamax");
auto kernel2 = Kernel(program, "XamaxEpilogue");
diff --git a/src/routines/level1/xasum.cc b/src/routines/level1/xasum.cc
index 6046a467..f4d898be 100644
--- a/src/routines/level1/xasum.cc
+++ b/src/routines/level1/xasum.cc
@@ -56,7 +56,7 @@ StatusCode Xasum<T>::DoAsum(const size_t n,
// Retrieves the Xasum kernels from the compiled binary
try {
- const auto program = GetProgramFromCache();
+ const auto program = GetProgramFromCache(context_, precision_, routine_name_);
auto kernel1 = Kernel(program, "Xasum");
auto kernel2 = Kernel(program, "XasumEpilogue");
diff --git a/src/routines/level1/xaxpy.cc b/src/routines/level1/xaxpy.cc
index dbc05cf7..221e1195 100644
--- a/src/routines/level1/xaxpy.cc
+++ b/src/routines/level1/xaxpy.cc
@@ -65,7 +65,7 @@ StatusCode Xaxpy<T>::DoAxpy(const size_t n, const T alpha,
// Retrieves the Xaxpy kernel from the compiled binary
try {
- const auto program = GetProgramFromCache();
+ const auto program = GetProgramFromCache(context_, precision_, routine_name_);
auto kernel = Kernel(program, kernel_name);
// Upload the scalar argument as a constant buffer to the device (needed for half-precision)
diff --git a/src/routines/level1/xcopy.cc b/src/routines/level1/xcopy.cc
index 8848201c..647a681a 100644
--- a/src/routines/level1/xcopy.cc
+++ b/src/routines/level1/xcopy.cc
@@ -65,7 +65,7 @@ StatusCode Xcopy<T>::DoCopy(const size_t n,
// Retrieves the Xcopy kernel from the compiled binary
try {
- const auto program = GetProgramFromCache();
+ const auto program = GetProgramFromCache(context_, precision_, routine_name_);
auto kernel = Kernel(program, kernel_name);
// Sets the kernel arguments
diff --git a/src/routines/level1/xdot.cc b/src/routines/level1/xdot.cc
index a819564a..eac64d13 100644
--- a/src/routines/level1/xdot.cc
+++ b/src/routines/level1/xdot.cc
@@ -60,7 +60,7 @@ StatusCode Xdot<T>::DoDot(const size_t n,
// Retrieves the Xdot kernels from the compiled binary
try {
- const auto program = GetProgramFromCache();
+ const auto program = GetProgramFromCache(context_, precision_, routine_name_);
auto kernel1 = Kernel(program, "Xdot");
auto kernel2 = Kernel(program, "XdotEpilogue");
diff --git a/src/routines/level1/xnrm2.cc b/src/routines/level1/xnrm2.cc
index 8904c369..23055aac 100644
--- a/src/routines/level1/xnrm2.cc
+++ b/src/routines/level1/xnrm2.cc
@@ -56,7 +56,7 @@ StatusCode Xnrm2<T>::DoNrm2(const size_t n,
// Retrieves the Xnrm2 kernels from the compiled binary
try {
- const auto program = GetProgramFromCache();
+ const auto program = GetProgramFromCache(context_, precision_, routine_name_);
auto kernel1 = Kernel(program, "Xnrm2");
auto kernel2 = Kernel(program, "Xnrm2Epilogue");
diff --git a/src/routines/level1/xscal.cc b/src/routines/level1/xscal.cc
index 8078c076..22d2cb5b 100644
--- a/src/routines/level1/xscal.cc
+++ b/src/routines/level1/xscal.cc
@@ -61,7 +61,7 @@ StatusCode Xscal<T>::DoScal(const size_t n, const T alpha,
// Retrieves the Xscal kernel from the compiled binary
try {
- const auto program = GetProgramFromCache();
+ const auto program = GetProgramFromCache(context_, precision_, routine_name_);
auto kernel = Kernel(program, kernel_name);
// Sets the kernel arguments
diff --git a/src/routines/level1/xswap.cc b/src/routines/level1/xswap.cc
index 01184db5..b6996932 100644
--- a/src/routines/level1/xswap.cc
+++ b/src/routines/level1/xswap.cc
@@ -65,7 +65,7 @@ StatusCode Xswap<T>::DoSwap(const size_t n,
// Retrieves the Xswap kernel from the compiled binary
try {
- const auto program = GetProgramFromCache();
+ const auto program = GetProgramFromCache(context_, precision_, routine_name_);
auto kernel = Kernel(program, kernel_name);
// Sets the kernel arguments
diff --git a/src/routines/level2/xgemv.cc b/src/routines/level2/xgemv.cc
index 07c6ec9d..b997673b 100644
--- a/src/routines/level2/xgemv.cc
+++ b/src/routines/level2/xgemv.cc
@@ -143,7 +143,7 @@ StatusCode Xgemv<T>::MatVec(const Layout layout, const Transpose a_transpose,
// Retrieves the Xgemv kernel from the compiled binary
try {
- const auto program = GetProgramFromCache();
+ const auto program = GetProgramFromCache(context_, precision_, routine_name_);
auto kernel = Kernel(program, kernel_name);
// Sets the kernel arguments
diff --git a/src/routines/level2/xger.cc b/src/routines/level2/xger.cc
index c69efc23..e2f7397a 100644
--- a/src/routines/level2/xger.cc
+++ b/src/routines/level2/xger.cc
@@ -71,7 +71,7 @@ StatusCode Xger<T>::DoGer(const Layout layout,
// Retrieves the kernel from the compiled binary
try {
- const auto program = GetProgramFromCache();
+ const auto program = GetProgramFromCache(context_, precision_, routine_name_);
auto kernel = Kernel(program, "Xger");
// Sets the kernel arguments
diff --git a/src/routines/level2/xher.cc b/src/routines/level2/xher.cc
index ed8763dc..3ee3911a 100644
--- a/src/routines/level2/xher.cc
+++ b/src/routines/level2/xher.cc
@@ -85,7 +85,7 @@ StatusCode Xher<T,U>::DoHer(const Layout layout, const Triangle triangle,
// Retrieves the kernel from the compiled binary
try {
- const auto program = GetProgramFromCache();
+ const auto program = GetProgramFromCache(context_, precision_, routine_name_);
auto kernel = Kernel(program, "Xher");
// Sets the kernel arguments
diff --git a/src/routines/level2/xher2.cc b/src/routines/level2/xher2.cc
index 10b98329..9edc1dd9 100644
--- a/src/routines/level2/xher2.cc
+++ b/src/routines/level2/xher2.cc
@@ -73,7 +73,7 @@ StatusCode Xher2<T>::DoHer2(const Layout layout, const Triangle triangle,
// Retrieves the kernel from the compiled binary
try {
- const auto program = GetProgramFromCache();
+ const auto program = GetProgramFromCache(context_, precision_, routine_name_);
auto kernel = Kernel(program, "Xher2");
// Sets the kernel arguments
diff --git a/src/routines/level3/xgemm.cc b/src/routines/level3/xgemm.cc
index eced53ab..a602e550 100644
--- a/src/routines/level3/xgemm.cc
+++ b/src/routines/level3/xgemm.cc
@@ -112,7 +112,7 @@ StatusCode Xgemm<T>::DoGemm(const Layout layout,
try {
// Loads the program from the database
- const auto program = GetProgramFromCache();
+ const auto program = GetProgramFromCache(context_, precision_, routine_name_);
// Determines whether or not temporary matrices are needed
auto a_no_temp = a_one == m_ceiled && a_two == k_ceiled && a_ld == m_ceiled && a_offset == 0 &&
diff --git a/src/routines/level3/xhemm.cc b/src/routines/level3/xhemm.cc
index 9791d7b4..8b2c971d 100644
--- a/src/routines/level3/xhemm.cc
+++ b/src/routines/level3/xhemm.cc
@@ -61,7 +61,7 @@ StatusCode Xhemm<T>::DoHemm(const Layout layout, const Side side, const Triangle
// Creates a general matrix from the hermitian matrix to be able to run the regular Xgemm
// routine afterwards
try {
- const auto program = GetProgramFromCache();
+ const auto program = GetProgramFromCache(context_, precision_, routine_name_);
auto kernel = Kernel(program, kernel_name);
// Sets the arguments for the hermitian-to-squared kernel
diff --git a/src/routines/level3/xher2k.cc b/src/routines/level3/xher2k.cc
index 43f7bb76..8fc70abd 100644
--- a/src/routines/level3/xher2k.cc
+++ b/src/routines/level3/xher2k.cc
@@ -94,7 +94,7 @@ StatusCode Xher2k<T,U>::DoHer2k(const Layout layout, const Triangle triangle, co
try {
// Loads the program from the database
- const auto program = GetProgramFromCache();
+ const auto program = GetProgramFromCache(context_, precision_, routine_name_);
// Determines whether or not temporary matrices are needed
auto a1_no_temp = ab_one == n_ceiled && ab_two == k_ceiled && a_ld == n_ceiled && a_offset == 0 &&
diff --git a/src/routines/level3/xherk.cc b/src/routines/level3/xherk.cc
index 8ebcbfa8..af0e32ba 100644
--- a/src/routines/level3/xherk.cc
+++ b/src/routines/level3/xherk.cc
@@ -91,7 +91,7 @@ StatusCode Xherk<T,U>::DoHerk(const Layout layout, const Triangle triangle, cons
try {
// Loads the program from the database
- const auto program = GetProgramFromCache();
+ const auto program = GetProgramFromCache(context_, precision_, routine_name_);
// Determines whether or not temporary matrices are needed
auto a_no_temp = a_one == n_ceiled && a_two == k_ceiled && a_ld == n_ceiled && a_offset == 0 &&
diff --git a/src/routines/level3/xsymm.cc b/src/routines/level3/xsymm.cc
index 650afbfc..cbacbb71 100644
--- a/src/routines/level3/xsymm.cc
+++ b/src/routines/level3/xsymm.cc
@@ -61,7 +61,7 @@ StatusCode Xsymm<T>::DoSymm(const Layout layout, const Side side, const Triangle
// Creates a general matrix from the symmetric matrix to be able to run the regular Xgemm
// routine afterwards
try {
- const auto program = GetProgramFromCache();
+ const auto program = GetProgramFromCache(context_, precision_, routine_name_);
auto kernel = Kernel(program, kernel_name);
// Sets the arguments for the symmetric-to-squared kernel
diff --git a/src/routines/level3/xsyr2k.cc b/src/routines/level3/xsyr2k.cc
index 4b436381..88bb5387 100644
--- a/src/routines/level3/xsyr2k.cc
+++ b/src/routines/level3/xsyr2k.cc
@@ -93,7 +93,7 @@ StatusCode Xsyr2k<T>::DoSyr2k(const Layout layout, const Triangle triangle, cons
try {
// Loads the program from the database
- const auto program = GetProgramFromCache();
+ const auto program = GetProgramFromCache(context_, precision_, routine_name_);
// Determines whether or not temporary matrices are needed
auto a_no_temp = ab_one == n_ceiled && ab_two == k_ceiled && a_ld == n_ceiled && a_offset == 0 &&
diff --git a/src/routines/level3/xsyrk.cc b/src/routines/level3/xsyrk.cc
index 5c49795b..88623ad4 100644
--- a/src/routines/level3/xsyrk.cc
+++ b/src/routines/level3/xsyrk.cc
@@ -89,7 +89,7 @@ StatusCode Xsyrk<T>::DoSyrk(const Layout layout, const Triangle triangle, const
try {
// Loads the program from the database
- const auto program = GetProgramFromCache();
+ const auto program = GetProgramFromCache(context_, precision_, routine_name_);
// Determines whether or not temporary matrices are needed
auto a_no_temp = a_one == n_ceiled && a_two == k_ceiled && a_ld == n_ceiled && a_offset == 0 &&
diff --git a/src/routines/level3/xtrmm.cc b/src/routines/level3/xtrmm.cc
index 98e0622d..b756d187 100644
--- a/src/routines/level3/xtrmm.cc
+++ b/src/routines/level3/xtrmm.cc
@@ -63,7 +63,7 @@ StatusCode Xtrmm<T>::DoTrmm(const Layout layout, const Side side, const Triangle
// Creates a general matrix from the triangular matrix to be able to run the regular Xgemm
// routine afterwards
try {
- const auto program = GetProgramFromCache();
+ const auto program = GetProgramFromCache(context_, precision_, routine_name_);
auto kernel = Kernel(program, kernel_name);
// Sets the arguments for the triangular-to-squared kernel
diff --git a/src/routines/levelx/xomatcopy.cc b/src/routines/levelx/xomatcopy.cc
index 199a4903..80683b7a 100644
--- a/src/routines/levelx/xomatcopy.cc
+++ b/src/routines/levelx/xomatcopy.cc
@@ -78,7 +78,7 @@ StatusCode Xomatcopy<T>::DoOmatcopy(const Layout layout, const Transpose a_trans
if (ErrorIn(status)) { return status; }
// Loads the program from the database
- const auto program = GetProgramFromCache();
+ const auto program = GetProgramFromCache(context_, precision_, routine_name_);
auto emptyEventList = std::vector<Event>();
status = PadCopyTransposeMatrix(queue_, device_, context_, db_, event_, emptyEventList,