[clfft] 33/109: adding error return to handle mismatched device usgae between BakePlan and EnqueueTransform

Jérôme Kieffer kieffer-guest at moszumanska.debian.org
Wed May 20 07:29:23 UTC 2015


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

kieffer-guest pushed a commit to branch debian
in repository clfft.

commit 08130dc6d23d469aaf672bbe9234ba393d0b69c2
Author: bragadeesh <bragadeesh.natarajan at amd>
Date:   Mon Nov 11 14:15:27 2013 -0600

    adding error return to handle mismatched device usgae between BakePlan and EnqueueTransform
---
 src/include/clFFT.h       |  1 +
 src/library/plan.cpp      |  3 +++
 src/library/plan.h        |  4 ++++
 src/library/transform.cpp | 10 ++++++++++
 4 files changed, 18 insertions(+)

diff --git a/src/include/clFFT.h b/src/include/clFFT.h
index f75ded3..738141f 100644
--- a/src/include/clFFT.h
+++ b/src/include/clFFT.h
@@ -127,6 +127,7 @@ enum clfftStatus_
 	CLFFT_VERSION_MISMATCH,		/*!< Version conflict between client and library. */
 	CLFFT_INVALID_PLAN,			/*!< Requested plan could not be found. */
 	CLFFT_DEVICE_NO_DOUBLE,		/*!< Double precision not supported on this device. */
+	CLFFT_DEVICE_MISMATCH,		/*!< Attempt to run on a device using a plan baked for a different device. */
 	CLFFT_ENDSTATUS				/* This value will always be last, and marks the length of clfftStatus. */
 };
 typedef enum clfftStatus_ clfftStatus;
diff --git a/src/library/plan.cpp b/src/library/plan.cpp
index 61ae195..f824976 100644
--- a/src/library/plan.cpp
+++ b/src/library/plan.cpp
@@ -494,6 +494,9 @@ clfftStatus	clfftBakePlan( clfftPlanHandle plHandle, cl_uint numQueues, cl_comma
 		return CLFFT_SUCCESS;
 	}
 
+	// Store the device for which we are baking
+	clGetCommandQueueInfo(*commQueueFFT, CL_QUEUE_DEVICE, sizeof(cl_device_id), &fftPlan->bakeDevice, NULL);
+
 	//find product of lengths
 	size_t pLength = 1;
 	switch(fftPlan->dim)
diff --git a/src/library/plan.h b/src/library/plan.h
index 11319e7..acafa07 100644
--- a/src/library/plan.h
+++ b/src/library/plan.h
@@ -223,6 +223,10 @@ public:
 	size_t                  iDist, oDist;
 	size_t                  batchsize;
 
+	// Note the device passed to BakePlan, assuming we are baking for one device
+	// TODO, change this logic for handling multiple GPUs/devices
+	cl_device_id bakeDevice;
+
 	//	Devices that the user specified in the context passed to the create function
 	std::vector< cl_device_id > devices;
 
diff --git a/src/library/transform.cpp b/src/library/transform.cpp
index e53e830..067de7b 100644
--- a/src/library/transform.cpp
+++ b/src/library/transform.cpp
@@ -63,6 +63,16 @@ clfftStatus clfftEnqueueTransform(
 		OPENCL_V( clfftBakePlan( plHandle, numQueuesAndEvents, commQueues, NULL, NULL ), _T( "Failed to bake plan" ) );
 	}
 
+
+	// get the device information
+	cl_device_id q_device;
+	clGetCommandQueueInfo(*commQueues, CL_QUEUE_DEVICE, sizeof(cl_device_id), &q_device, NULL);
+
+	// verify if the current device is the same as the one used for baking the plan
+	if(q_device != fftPlan->bakeDevice)
+		return CLFFT_DEVICE_MISMATCH;
+
+
 	if		(fftPlan->inputLayout == CLFFT_REAL)	dir = CLFFT_FORWARD;
 	else if	(fftPlan->outputLayout == CLFFT_REAL)	dir = CLFFT_BACKWARD;
 

-- 
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