[clfft] 22/32: fixing bug in rad13 inverse, slight refactoring of directed tests

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Tue Apr 26 08:34:10 UTC 2016


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch master
in repository clfft.

commit 0b16ac948e6d63cb3b592ce5929f0b1c8bfa259d
Author: bragadeesh <bragadeesh.natarajan at amd>
Date:   Fri Apr 8 14:34:26 2016 -0700

    fixing bug in rad13 inverse, slight refactoring of directed tests
---
 src/library/generator.stockham.h     | 32 ++++++++---------
 src/tests/accuracy_test_directed.cpp | 66 ++++++++++++++++++++++++++++++------
 2 files changed, 72 insertions(+), 26 deletions(-)

diff --git a/src/library/generator.stockham.h b/src/library/generator.stockham.h
index 18adf48..3695721 100644
--- a/src/library/generator.stockham.h
+++ b/src/library/generator.stockham.h
@@ -1982,26 +1982,26 @@ namespace StockhamGenerator
 						f1  = e10 + c17 * b13_1;\n\
 						f2  = e9  + c14 * b13_1;\n\
 						f3  = c14 -  e9 * b13_12;\n\
-						f4  = e11 -  d7 * b13_0;\n\
-						f5  = e11 +  d7 * b13_0;\n\
-						f6  = e5  -  f3 * b13_11;\n\
-						f7  = e5  +  f3 * b13_11;\n\
-						f8  = e4  -  e8 * b13_13;\n\
-						f9  = e4  +  e8 * b13_13;\n\
-						f10 = f0  +  d6 * b13_2;\n\
-						f11 = f0  -  d6 * b13_2;\n\
+						f4  = e11 + dir * d7 * b13_0;\n\
+						f5  = e11 - dir * d7 * b13_0;\n\
+						f6  = e5  + dir * f3 * b13_11;\n\
+						f7  = e5  - dir * f3 * b13_11;\n\
+						f8  = e4  + dir * e8 * b13_13;\n\
+						f9  = e4  - dir * e8 * b13_13;\n\
+						f10 = f0  - dir * d6 * b13_2;\n\
+						f11 = f0  + dir * d6 * b13_2;\n\
 						f12 = e1  +  c4 * b13_1;\n\
 						f13 = c4  -  e1 * b13_12;\n\
 						f14 = c5  -  e2 * b13_12;\n\
 						f15 = e2  +  c5 * b13_1;\n\
-						f16 = f14 - d19 * b13_2;\n\
-						f17 = f14 + d19 * b13_2;\n\
-						f18 = e15 +  e0 * b13_13;\n\
-						f19 = e15 -  e0 * b13_13;\n\
-						f20 = e14 + f13 * b13_11;\n\
-						f21 = e14 - f13 * b13_11;\n\
-						f22 = e3  + d18 * b13_0;\n\
-						f23 = e3  - d18 * b13_0;\n\
+						f16 = f14 + dir * d19 * b13_2;\n\
+						f17 = f14 - dir * d19 * b13_2;\n\
+						f18 = e15 - dir *  e0 * b13_13;\n\
+						f19 = e15 + dir *  e0 * b13_13;\n\
+						f20 = e14 - dir * f13 * b13_11;\n\
+						f21 = e14 + dir * f13 * b13_11;\n\
+						f22 = e3  - dir * d18 * b13_0;\n\
+						f23 = e3  + dir * d18 * b13_0;\n\
 						\n\
 						(*R0).x  = (*R0).x + s8;\n\
 						(*R0).y  = (*R0).y + m13;\n\
diff --git a/src/tests/accuracy_test_directed.cpp b/src/tests/accuracy_test_directed.cpp
index fc0be7e..fbd1cea 100644
--- a/src/tests/accuracy_test_directed.cpp
+++ b/src/tests/accuracy_test_directed.cpp
@@ -47,9 +47,8 @@ namespace DirectedTest {
 			throw std::runtime_error("invalid cl_layout");
 	}
 
-
-	struct ParametersPackedRealInplaceInterleaved {
-		
+	struct ParametersPacked
+	{
 		// directed inputs
 		size_t batch_size;
 		clfftPrecision precision;
@@ -66,6 +65,23 @@ namespace DirectedTest {
 		clfftLayout input_layout;
 		clfftLayout output_layout;
 
+		ParametersPacked(clfftPrecision precision_in,
+			clfftDirection direction_in,
+			clfftDim dimensions_in,
+			const std::vector<size_t> &lengths_in,
+			size_t batch_size_in)
+			: precision(precision_in)
+			, direction(direction_in)
+			, dimensions(dimensions_in)
+			, batch_size(batch_size_in)
+		{
+			for (size_t i = 0; i < lengths_in.size(); i++)
+				lengths.push_back(lengths_in[i]);
+		}
+	};
+
+	struct ParametersPackedRealInplaceInterleaved : public ParametersPacked
+	{
 		bool is_r2c()
 		{
 			if (input_layout == CLFFT_REAL) return true;
@@ -83,16 +99,10 @@ namespace DirectedTest {
 												clfftDim dimensions_in,
 												const std::vector<size_t> &lengths_in,
 												size_t batch_size_in)
-			: precision(precision_in)
-			, direction(direction_in)
-			, dimensions(dimensions_in)
-			, batch_size(batch_size_in)
+			: ParametersPacked(precision_in, direction_in, dimensions_in, lengths_in, batch_size_in)
 		{
 			try
 			{
-				for (size_t i = 0; i < lengths_in.size(); i++)
-					lengths.push_back(lengths_in[i]);
-
 				input_strides.push_back(1);
 				output_strides.push_back(1);
 
@@ -161,6 +171,42 @@ namespace DirectedTest {
 	}; //struct ParametersPackedRealInplaceInterleaved
 
 
+	struct ParametersPackedComplexInterleaved : public ParametersPacked
+	{
+		ParametersPackedComplexInterleaved(clfftPrecision precision_in,
+			clfftDirection direction_in,
+			clfftDim dimensions_in,
+			const std::vector<size_t> &lengths_in,
+			size_t batch_size_in)
+			: ParametersPacked(precision_in, direction_in, dimensions_in, lengths_in, batch_size_in)
+		{
+			try
+			{
+				input_strides.push_back(1);
+				output_strides.push_back(1);
+
+				input_layout = CLFFT_COMPLEX_INTERLEAVED;
+				output_layout = CLFFT_COMPLEX_INTERLEAVED;
+
+				input_distance = lengths[0];
+				output_distance = lengths[0];
+
+				for (size_t i = 1; i < lengths.size(); i++)
+				{
+					input_strides.push_back(input_distance);
+					output_strides.push_back(output_distance);
+
+					input_distance *= lengths[i];
+					output_distance *= lengths[i];
+				}
+			}
+			catch (const std::exception& err)
+			{
+				handle_exception(err);
+			}
+		}
+	}; //struct ParametersPackedComplexInterleaved
+
 	class TestListGenerator
 	{
 	protected:

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/clfft.git



More information about the debian-science-commits mailing list