aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGil Pitney <gil.pitney@linaro.org>2015-04-02 23:29:28 +0000
committerGil Pitney <gil.pitney@linaro.org>2015-04-02 23:29:28 +0000
commit32505b8d926929a70c1cfb3a6e6b691439fd9023 (patch)
tree21a50d04c10d095b9a0680107dc5c56b476f4247
parent441c89fbd0cfeccd8cd790a44d4c5365c563720c (diff)
Implemented CL_PROGRAM_BINARY_TYPE of the clGetProgramBuildInfo() API
OCL v1.2 allows querying of the type of binary program created. This is a partial implementation, pending a method to distinguish LLVM modules as libraries vs executables vs neither. Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
-rw-r--r--src/core/program.cpp14
-rw-r--r--src/core/program.h1
2 files changed, 14 insertions, 1 deletions
diff --git a/src/core/program.cpp b/src/core/program.cpp
index f5e9b64..efa331b 100644
--- a/src/core/program.cpp
+++ b/src/core/program.cpp
@@ -83,7 +83,8 @@ using namespace Coal;
using namespace llvm;
Program::Program(Context *ctx)
-: Object(Object::T_Program, ctx), p_type(Invalid), p_state(Empty)
+ : Object(Object::T_Program, ctx), p_type(Invalid), p_state(Empty),
+ p_binary_type(CL_PROGRAM_BINARY_TYPE_NONE)
{
p_null_device_dependent.compiler = 0;
p_null_device_dependent.device = 0;
@@ -530,6 +531,10 @@ cl_int Program::loadBinaries(const unsigned char **data, const size_t *lengths,
p_type = Binary;
p_state = Loaded;
+ // binary_type could also be CL_PROGRAM_BINARY_TYPE_LIBRARY or
+ // CL_PROGRAM_BINARY_TYPE_EXECUTABLE, but need a foolproof way to distinguish
+ // that based on the bits actually passed in.
+ p_binary_type = CL_PROGRAM_BINARY_TYPE_COMPILED_OBJECT;
return CL_SUCCESS;
}
@@ -687,6 +692,7 @@ cleanup:
removeInputHeaders(num_input_headers, header_include_names);
p_state = Compiled;
+ p_binary_type = CL_PROGRAM_BINARY_TYPE_COMPILED_OBJECT;
return retcode;
}
@@ -859,6 +865,8 @@ cl_int Program::link(const char *options,
pfn_notify((cl_program)this, user_data);
p_state = (linkAsLibrary? Compiled : Built);
+ p_binary_type = (linkAsLibrary? CL_PROGRAM_BINARY_TYPE_LIBRARY :
+ CL_PROGRAM_BINARY_TYPE_EXECUTABLE);
return CL_SUCCESS;
}
@@ -1050,6 +1058,7 @@ cl_int Program::buildInfo(DeviceInterface *device,
union {
cl_build_status cl_build_status_var;
+ cl_program_binary_type cl_program_binary_type_var;
};
switch (param_name)
@@ -1082,6 +1091,9 @@ cl_int Program::buildInfo(DeviceInterface *device,
value_length = dep.compiler->log().size() + 1;
break;
+ case CL_PROGRAM_BINARY_TYPE:
+ SIMPLE_ASSIGN(cl_program_binary_type, p_binary_type);
+ break;
default:
return CL_INVALID_VALUE;
}
diff --git a/src/core/program.h b/src/core/program.h
index b0f0b07..3e4d641 100644
--- a/src/core/program.h
+++ b/src/core/program.h
@@ -282,6 +282,7 @@ class Program : public Object
private:
Type p_type;
State p_state;
+ cl_program_binary_type p_binary_type;
std::string p_source;
struct DeviceDependent