[Mesa-dev] [PATCH 4/7] clover: clCreateKernel now checks for executable
EdB
edb+mesa at sigluy.net
Sun Dec 14 02:31:24 PST 2014
clCreateKernel should check that there is a least one executable
available, otherwise it has to trigger CL_INVALID_PROGRAM_EXECUTABLE
---
src/gallium/state_trackers/clover/api/kernel.cpp | 3 +++
src/gallium/state_trackers/clover/core/program.cpp | 11 +++++++++++
src/gallium/state_trackers/clover/core/program.hpp | 1 +
3 files changed, 15 insertions(+)
diff --git a/src/gallium/state_trackers/clover/api/kernel.cpp b/src/gallium/state_trackers/clover/api/kernel.cpp
index 05cc392..4fe1756 100644
--- a/src/gallium/state_trackers/clover/api/kernel.cpp
+++ b/src/gallium/state_trackers/clover/api/kernel.cpp
@@ -33,6 +33,9 @@ clCreateKernel(cl_program d_prog, const char *name, cl_int *r_errcode) try {
if (!name)
throw error(CL_INVALID_VALUE);
+ if (!prog.has_executable())
+ throw error(CL_INVALID_PROGRAM_EXECUTABLE);
+
auto &sym = find(name_equals(name), prog.symbols());
ret_error(r_errcode, CL_SUCCESS);
diff --git a/src/gallium/state_trackers/clover/core/program.cpp b/src/gallium/state_trackers/clover/core/program.cpp
index 8553ca7..5e05a33 100644
--- a/src/gallium/state_trackers/clover/core/program.cpp
+++ b/src/gallium/state_trackers/clover/core/program.cpp
@@ -71,6 +71,17 @@ program::build(const ref_vector<device> &devs, const char *opts,
}
}
+bool
+program::has_executable() const {
+ for (auto &bin : _binaries) {
+ if (any_of(type_equals(module::section::text_executable),
+ bin.second.secs))
+ return true;
+ }
+
+ return false;
+}
+
const std::string &
program::source() const {
return _source;
diff --git a/src/gallium/state_trackers/clover/core/program.hpp b/src/gallium/state_trackers/clover/core/program.hpp
index 661fa03..7f61d88 100644
--- a/src/gallium/state_trackers/clover/core/program.hpp
+++ b/src/gallium/state_trackers/clover/core/program.hpp
@@ -50,6 +50,7 @@ namespace clover {
void build(const ref_vector<device> &devs, const char *opts,
const header_map &headers = {});
+ bool has_executable() const;
const bool has_source;
const std::string &source() const;
--
2.2.0
More information about the mesa-dev
mailing list