summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2013-09-18 16:26:08 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2013-09-19 17:03:27 +0200
commit5d0b4a5ae3806c4816e1fbe39514cbf52adfb229 (patch)
treeeb478f634dcbbe59de2fed5e0cedbd1ad48b5763 /sc
parent68035ffc3e94af0c3cef600a65fa301efd3045af (diff)
small fixes for broken code
Change-Id: I77afc818d5575523077328042ac9418f521edc9c
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/opencl/openclwrapper.cxx12
1 files changed, 6 insertions, 6 deletions
diff --git a/sc/source/core/opencl/openclwrapper.cxx b/sc/source/core/opencl/openclwrapper.cxx
index d4cf1b715b77..d273463beeb3 100644
--- a/sc/source/core/opencl/openclwrapper.cxx
+++ b/sc/source/core/opencl/openclwrapper.cxx
@@ -251,8 +251,8 @@ std::vector<boost::shared_ptr<osl::File> > OpenclDevice::binaryGenerated( const
}
}
}
- return aGeneratedFiles;
+ return aGeneratedFiles;
}
int OpenclDevice::writeBinaryToFile( const OString& rFileName, const char* binary, size_t numBytes )
@@ -270,7 +270,6 @@ int OpenclDevice::writeBinaryToFile( const OString& rFileName, const char* binar
assert(numBytes == nBytesWritten);
return 1;
-
}
int OpenclDevice::generatBinFromKernelSource( cl_program program, const char * clFileName )
@@ -414,9 +413,7 @@ int OpenclDevice::cachedOfKernerPrg( const GPUEnv *gpuEnvCached, const char * cl
int OpenclDevice::compileKernelFile( GPUEnv *gpuInfo, const char *buildOption )
{
cl_int clStatus = 0;
- size_t length;
int binary_status, idx;
- cl_uint numDevices;
const char* filename = "kernel.cl";
fprintf(stderr, "compileKernelFile ... \n");
if ( cachedOfKernerPrg(gpuInfo, filename) == 1 )
@@ -426,6 +423,7 @@ int OpenclDevice::compileKernelFile( GPUEnv *gpuInfo, const char *buildOption )
idx = gpuInfo->mnFileCount;
+ cl_uint numDevices;
clStatus = clGetContextInfo( gpuInfo->mpContext, CL_CONTEXT_NUM_DEVICES,
sizeof(numDevices), &numDevices, NULL );
CHECK_OPENCL( clStatus, "clGetContextInfo" );
@@ -437,6 +435,7 @@ int OpenclDevice::compileKernelFile( GPUEnv *gpuInfo, const char *buildOption )
if (aGeneratedFiles.size() == numDevices)
{
bBinaryExisted = true;
+ boost::scoped_array<size_t> length(new size_t[numDevices]);
boost::scoped_array<unsigned char*> pBinary(new unsigned char*[numDevices]);
for(size_t i = 0; i < numDevices; ++i)
{
@@ -448,7 +447,7 @@ int OpenclDevice::compileKernelFile( GPUEnv *gpuInfo, const char *buildOption )
if(nSize != nBytesRead)
assert(false);
- length = nBytesRead;
+ length[i] = nBytesRead;
pBinary[i] = binary;
}
@@ -469,7 +468,7 @@ int OpenclDevice::compileKernelFile( GPUEnv *gpuInfo, const char *buildOption )
fprintf(stderr, "Create kernel from binary\n");
gpuInfo->mpArryPrograms[idx] = clCreateProgramWithBinary( gpuInfo->mpContext,numDevices,
- mpArryDevsID.get(), &length, (const unsigned char**) pBinary.get(),
+ mpArryDevsID.get(), length.get(), (const unsigned char**) pBinary.get(),
&binary_status, &clStatus );
if(clStatus != CL_SUCCESS)
{
@@ -515,6 +514,7 @@ int OpenclDevice::compileKernelFile( GPUEnv *gpuInfo, const char *buildOption )
if ( clStatus != CL_SUCCESS )
{
+ size_t length;
printf ("BuildProgram error!\n");
if ( !gpuInfo->mnIsUserCreated )
{