From 56f300607b1d0b81ab3269894fda5a066c46cdeb Mon Sep 17 00:00:00 2001 From: Ivan Shapovalov Date: Tue, 18 Oct 2016 04:53:06 +0300 Subject: Routine: get rid of ::SetUp() Since we now use C++ exceptions inside the implementation (and exceptions can be thrown from constructors), there is no need for a separate Routine::SetUp() function. For this, we also change the way how the kernel source string is constructed. The kernel-specific source code is now passed to the Routine ctor via an initializer_list of C strings to avoid unnecessary data copying while also working around C1091 of MSVC 2013. --- src/routines/level1/xamax.cpp | 5 ++--- src/routines/level1/xasum.cpp | 5 ++--- src/routines/level1/xaxpy.cpp | 5 ++--- src/routines/level1/xcopy.cpp | 5 ++--- src/routines/level1/xdot.cpp | 5 ++--- src/routines/level1/xnrm2.cpp | 5 ++--- src/routines/level1/xscal.cpp | 5 ++--- src/routines/level1/xswap.cpp | 5 ++--- 8 files changed, 16 insertions(+), 24 deletions(-) (limited to 'src/routines/level1') diff --git a/src/routines/level1/xamax.cpp b/src/routines/level1/xamax.cpp index 8307188b..e9efa1a7 100644 --- a/src/routines/level1/xamax.cpp +++ b/src/routines/level1/xamax.cpp @@ -22,10 +22,9 @@ namespace clblast { // Constructor: forwards to base class constructor template Xamax::Xamax(Queue &queue, EventPointer event, const std::string &name): - Routine(queue, event, name, {"Xdot"}, PrecisionValue()) { - source_string_ = + Routine(queue, event, name, {"Xdot"}, PrecisionValue(), {}, { #include "../../kernels/level1/xamax.opencl" - ; + }) { } // ================================================================================================= diff --git a/src/routines/level1/xasum.cpp b/src/routines/level1/xasum.cpp index 9dde7a87..a242a5fa 100644 --- a/src/routines/level1/xasum.cpp +++ b/src/routines/level1/xasum.cpp @@ -22,10 +22,9 @@ namespace clblast { // Constructor: forwards to base class constructor template Xasum::Xasum(Queue &queue, EventPointer event, const std::string &name): - Routine(queue, event, name, {"Xdot"}, PrecisionValue()) { - source_string_ = + Routine(queue, event, name, {"Xdot"}, PrecisionValue(), {}, { #include "../../kernels/level1/xasum.opencl" - ; + }) { } // ================================================================================================= diff --git a/src/routines/level1/xaxpy.cpp b/src/routines/level1/xaxpy.cpp index cbcbb3cd..5436c5b7 100644 --- a/src/routines/level1/xaxpy.cpp +++ b/src/routines/level1/xaxpy.cpp @@ -22,11 +22,10 @@ namespace clblast { // Constructor: forwards to base class constructor template Xaxpy::Xaxpy(Queue &queue, EventPointer event, const std::string &name): - Routine(queue, event, name, {"Xaxpy"}, PrecisionValue()) { - source_string_ = + Routine(queue, event, name, {"Xaxpy"}, PrecisionValue(), {}, { #include "../../kernels/level1/level1.opencl" #include "../../kernels/level1/xaxpy.opencl" - ; + }) { } // ================================================================================================= diff --git a/src/routines/level1/xcopy.cpp b/src/routines/level1/xcopy.cpp index 3bfbada6..d86200c0 100644 --- a/src/routines/level1/xcopy.cpp +++ b/src/routines/level1/xcopy.cpp @@ -22,11 +22,10 @@ namespace clblast { // Constructor: forwards to base class constructor template Xcopy::Xcopy(Queue &queue, EventPointer event, const std::string &name): - Routine(queue, event, name, {"Xaxpy"}, PrecisionValue()) { - source_string_ = + Routine(queue, event, name, {"Xaxpy"}, PrecisionValue(), {}, { #include "../../kernels/level1/level1.opencl" #include "../../kernels/level1/xcopy.opencl" - ; + }) { } // ================================================================================================= diff --git a/src/routines/level1/xdot.cpp b/src/routines/level1/xdot.cpp index e0d297f8..9d718913 100644 --- a/src/routines/level1/xdot.cpp +++ b/src/routines/level1/xdot.cpp @@ -22,10 +22,9 @@ namespace clblast { // Constructor: forwards to base class constructor template Xdot::Xdot(Queue &queue, EventPointer event, const std::string &name): - Routine(queue, event, name, {"Xdot"}, PrecisionValue()) { - source_string_ = + Routine(queue, event, name, {"Xdot"}, PrecisionValue(), {}, { #include "../../kernels/level1/xdot.opencl" - ; + }) { } // ================================================================================================= diff --git a/src/routines/level1/xnrm2.cpp b/src/routines/level1/xnrm2.cpp index eb795498..373820a4 100644 --- a/src/routines/level1/xnrm2.cpp +++ b/src/routines/level1/xnrm2.cpp @@ -22,10 +22,9 @@ namespace clblast { // Constructor: forwards to base class constructor template Xnrm2::Xnrm2(Queue &queue, EventPointer event, const std::string &name): - Routine(queue, event, name, {"Xdot"}, PrecisionValue()) { - source_string_ = + Routine(queue, event, name, {"Xdot"}, PrecisionValue(), {}, { #include "../../kernels/level1/xnrm2.opencl" - ; + }) { } // ================================================================================================= diff --git a/src/routines/level1/xscal.cpp b/src/routines/level1/xscal.cpp index ed126879..17410f01 100644 --- a/src/routines/level1/xscal.cpp +++ b/src/routines/level1/xscal.cpp @@ -22,11 +22,10 @@ namespace clblast { // Constructor: forwards to base class constructor template Xscal::Xscal(Queue &queue, EventPointer event, const std::string &name): - Routine(queue, event, name, {"Xaxpy"}, PrecisionValue()) { - source_string_ = + Routine(queue, event, name, {"Xaxpy"}, PrecisionValue(), {}, { #include "../../kernels/level1/level1.opencl" #include "../../kernels/level1/xscal.opencl" - ; + }) { } // ================================================================================================= diff --git a/src/routines/level1/xswap.cpp b/src/routines/level1/xswap.cpp index 2f2c0370..c9b97dc9 100644 --- a/src/routines/level1/xswap.cpp +++ b/src/routines/level1/xswap.cpp @@ -22,11 +22,10 @@ namespace clblast { // Constructor: forwards to base class constructor template Xswap::Xswap(Queue &queue, EventPointer event, const std::string &name): - Routine(queue, event, name, {"Xaxpy"}, PrecisionValue()) { - source_string_ = + Routine(queue, event, name, {"Xaxpy"}, PrecisionValue(), {}, { #include "../../kernels/level1/level1.opencl" #include "../../kernels/level1/xswap.opencl" - ; + }) { } // ================================================================================================= -- cgit v1.2.3