Kaydet (Commit) 6a257615 authored tarafından Tor Lillqvist's avatar Tor Lillqvist

Improve OpenCL error messages

Add the name of the function that failed to the OpenCLError class. Log OpenCL
failure in a couple of more places (where OpenCLError is not thrown). Print
OpenCL errors symbolically instead of numerically where applicable.

Change-Id: I60f910e9ea7b75af7ec506553d7a73ad99ba4366
üst 43617f14
...@@ -19,10 +19,14 @@ UnhandledToken::UnhandledToken( ...@@ -19,10 +19,14 @@ UnhandledToken::UnhandledToken(
formula::FormulaToken* t, const char* m, const std::string& fn, int ln ) : formula::FormulaToken* t, const char* m, const std::string& fn, int ln ) :
mToken(t), mMessage(m), mFile(fn), mLineNumber(ln) {} mToken(t), mMessage(m), mFile(fn), mLineNumber(ln) {}
OpenCLError::OpenCLError( cl_int err, const std::string& fn, int ln ) : OpenCLError::OpenCLError( const std::string function, cl_int error, const std::string& file, int line ) :
mError(err), mFile(fn), mLineNumber(ln) mFunction(function), mError(error), mFile(file), mLineNumber(line)
{ {
SAL_INFO("sc.opencl", "OpenCL error: " << ::opencl::errorString(mError)); // Not sure if this SAL_INFO() is useful; the place in
// CLInterpreterContext::launchKernel() where OpenCLError is
// caught already uses SAL_WARN() to display it.
// SAL_INFO("sc.opencl", "OpenCL error: " << ::opencl::errorString(mError));
} }
Unhandled::Unhandled( const std::string& fn, int ln ) : Unhandled::Unhandled( const std::string& fn, int ln ) :
......
...@@ -42,8 +42,9 @@ public: ...@@ -42,8 +42,9 @@ public:
class OpenCLError class OpenCLError
{ {
public: public:
OpenCLError( cl_int err, const std::string& fn, int ln ); OpenCLError( const std::string function, cl_int error, const std::string& file, int line );
std::string mFunction;
cl_int mError; cl_int mError;
std::string mFile; std::string mFile;
int mLineNumber; int mLineNumber;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment