Add SAL_INFOs for tracing kernel and program life cycle

Change-Id: Icb28114d3939063dedaedbd0ce370210b3721fc5
This commit is contained in:
Tor Lillqvist
2015-02-10 19:25:58 +02:00
parent e30e5ac959
commit 770c92b048
2 changed files with 16 additions and 0 deletions

View File

@@ -442,6 +442,7 @@ bool buildProgramFromBinary(const char* buildOption, GPUEnv* gpuInfo, const char
// something went wrong, fall back to compiling from source // something went wrong, fall back to compiling from source
return false; return false;
} }
SAL_INFO("opencl", "Created program " << gpuInfo->mpArryPrograms[idx] << " from binary");
for(size_t i = 0; i < numDevices; ++i) for(size_t i = 0; i < numDevices; ++i)
{ {
delete[] pBinary[i]; delete[] pBinary[i];

View File

@@ -1499,6 +1499,8 @@ public:
cl_kernel redKernel = clCreateKernel(mpProgram, kernelName.c_str(), &err); cl_kernel redKernel = clCreateKernel(mpProgram, kernelName.c_str(), &err);
if (err != CL_SUCCESS) if (err != CL_SUCCESS)
throw OpenCLError("clCreateKernel", err, __FILE__, __LINE__); throw OpenCLError("clCreateKernel", err, __FILE__, __LINE__);
SAL_INFO("sc.opencl", "Created kernel " << redKernel << " with name " << kernelName << " in program " << mpProgram);
// set kernel arg of reduction kernel // set kernel arg of reduction kernel
// TODO(Wei Wei): use unique name for kernel // TODO(Wei Wei): use unique name for kernel
cl_mem buf = Base::GetCLBuffer(); cl_mem buf = Base::GetCLBuffer();
@@ -1556,6 +1558,8 @@ public:
redKernel = clCreateKernel(mpProgram, kernelName.c_str(), &err); redKernel = clCreateKernel(mpProgram, kernelName.c_str(), &err);
if (err != CL_SUCCESS) if (err != CL_SUCCESS)
throw OpenCLError("clCreateKernel", err, __FILE__, __LINE__); throw OpenCLError("clCreateKernel", err, __FILE__, __LINE__);
SAL_INFO("sc.opencl", "Created kernel " << redKernel << " with name " << kernelName << " in program " << mpProgram);
// set kernel arg of reduction kernel // set kernel arg of reduction kernel
buf = Base::GetCLBuffer(); buf = Base::GetCLBuffer();
SAL_INFO("sc.opencl", "Kernel " << redKernel << " arg " << 0 << ": cl_mem: " << buf); SAL_INFO("sc.opencl", "Kernel " << redKernel << " arg " << 0 << ": cl_mem: " << buf);
@@ -2281,6 +2285,8 @@ public:
cl_kernel redKernel = clCreateKernel(pProgram, kernelName.c_str(), &err); cl_kernel redKernel = clCreateKernel(pProgram, kernelName.c_str(), &err);
if (err != CL_SUCCESS) if (err != CL_SUCCESS)
throw OpenCLError("clCreateKernel", err, __FILE__, __LINE__); throw OpenCLError("clCreateKernel", err, __FILE__, __LINE__);
SAL_INFO("sc.opencl", "Created kernel " << redKernel << " with name " << kernelName << " in program " << pProgram);
// set kernel arg of reduction kernel // set kernel arg of reduction kernel
for (size_t j = 0; j < vclmem.size(); j++) for (size_t j = 0; j < vclmem.size(); j++)
{ {
@@ -2352,6 +2358,7 @@ public:
cl_kernel redKernel = clCreateKernel(pProgram, kernelName.c_str(), &err); cl_kernel redKernel = clCreateKernel(pProgram, kernelName.c_str(), &err);
if (err != CL_SUCCESS) if (err != CL_SUCCESS)
throw OpenCLError("clCreateKernel", err, __FILE__, __LINE__); throw OpenCLError("clCreateKernel", err, __FILE__, __LINE__);
SAL_INFO("sc.opencl", "Created kernel " << redKernel << " with name " << kernelName << " in program " << pProgram);
// set kernel arg of reduction kernel // set kernel arg of reduction kernel
for (size_t j = 0; j < vclmem.size(); j++) for (size_t j = 0; j < vclmem.size(); j++)
@@ -2394,6 +2401,7 @@ public:
if (CL_SUCCESS != err) if (CL_SUCCESS != err)
throw OpenCLError("clFinish", err, __FILE__, __LINE__); throw OpenCLError("clFinish", err, __FILE__, __LINE__);
SAL_INFO("sc.opencl", "Relasing kernel " << redKernel);
err = clReleaseKernel(redKernel); err = clReleaseKernel(redKernel);
SAL_WARN_IF(err != CL_SUCCESS, "sc.opencl", "clReleaseKernel failed: " << ::opencl::errorString(err)); SAL_WARN_IF(err != CL_SUCCESS, "sc.opencl", "clReleaseKernel failed: " << ::opencl::errorString(err));
@@ -3719,6 +3727,7 @@ DynamicKernel::~DynamicKernel()
} }
if (mpKernel) if (mpKernel)
{ {
SAL_INFO("sc.opencl", "Releasing kernel " << mpKernel);
err = clReleaseKernel(mpKernel); err = clReleaseKernel(mpKernel);
SAL_WARN_IF(err != CL_SUCCESS, "sc.opencl", "clReleaseKernel failed: " << ::opencl::errorString(err)); SAL_WARN_IF(err != CL_SUCCESS, "sc.opencl", "clReleaseKernel failed: " << ::opencl::errorString(err));
} }
@@ -3825,6 +3834,7 @@ void DynamicKernel::CreateKernel()
if (lastSecondProgram) if (lastSecondProgram)
{ {
SAL_INFO("sc.opencl", "Releasing program " << lastSecondProgram);
err = clReleaseProgram(lastSecondProgram); err = clReleaseProgram(lastSecondProgram);
SAL_WARN_IF(err != CL_SUCCESS, "sc.opencl", "clReleaseProgram failed: " << ::opencl::errorString(err)); SAL_WARN_IF(err != CL_SUCCESS, "sc.opencl", "clReleaseProgram failed: " << ::opencl::errorString(err));
} }
@@ -3840,6 +3850,8 @@ void DynamicKernel::CreateKernel()
&src, NULL, &err); &src, NULL, &err);
if (err != CL_SUCCESS) if (err != CL_SUCCESS)
throw OpenCLError("clCreateProgramWithSource", err, __FILE__, __LINE__); throw OpenCLError("clCreateProgramWithSource", err, __FILE__, __LINE__);
SAL_INFO("sc.opencl", "Created program " << mpProgram);
err = clBuildProgram(mpProgram, 1, err = clBuildProgram(mpProgram, 1,
::opencl::gpuEnv.mpArryDevsID, "", NULL, NULL); ::opencl::gpuEnv.mpArryDevsID, "", NULL, NULL);
if (err != CL_SUCCESS) if (err != CL_SUCCESS)
@@ -3890,6 +3902,8 @@ void DynamicKernel::CreateKernel()
#endif #endif
throw OpenCLError("clBuildProgram", err, __FILE__, __LINE__); throw OpenCLError("clBuildProgram", err, __FILE__, __LINE__);
} }
SAL_INFO("sc.opencl", "Built program " << mpProgram);
// Generate binary out of compiled kernel. // Generate binary out of compiled kernel.
::opencl::generatBinFromKernelSource(mpProgram, ::opencl::generatBinFromKernelSource(mpProgram,
(mKernelSignature + GetMD5()).c_str()); (mKernelSignature + GetMD5()).c_str());
@@ -3902,6 +3916,7 @@ void DynamicKernel::CreateKernel()
mpKernel = clCreateKernel(mpProgram, kname.c_str(), &err); mpKernel = clCreateKernel(mpProgram, kname.c_str(), &err);
if (err != CL_SUCCESS) if (err != CL_SUCCESS)
throw OpenCLError("clCreateKernel", err, __FILE__, __LINE__); throw OpenCLError("clCreateKernel", err, __FILE__, __LINE__);
SAL_INFO("sc.opencl", "Created kernel " << mpKernel << " with name " << kname << " in program " << mpProgram);
} }
void DynamicKernel::Launch( size_t nr ) void DynamicKernel::Launch( size_t nr )