[Mesa-dev] [PATCH 1/2] clover: support CL_PROGRAM_BINARY_TYPE (CL1.2)
Jan Vesely
jan.vesely at rutgers.edu
Thu Oct 6 17:20:36 UTC 2016
On Fri, 2014-12-19 at 16:42 +0100, EdB wrote:
> CL_PROGRAM_BINARY_TYPE have been added to clGetProgramBuildInfo in
> CL1.2
> ---
> src/gallium/state_trackers/clover/api/program.cpp | 4 +++
> src/gallium/state_trackers/clover/core/program.cpp | 31
> +++++++++++++++++-----
> src/gallium/state_trackers/clover/core/program.hpp | 1 +
> 3 files changed, 29 insertions(+), 7 deletions(-)
>
> diff --git a/src/gallium/state_trackers/clover/api/program.cpp
> b/src/gallium/state_trackers/clover/api/program.cpp
> index be97ae5..9373fac 100644
> --- a/src/gallium/state_trackers/clover/api/program.cpp
> +++ b/src/gallium/state_trackers/clover/api/program.cpp
> @@ -363,6 +363,10 @@ clGetProgramBuildInfo(cl_program d_prog,
> cl_device_id d_dev,
> buf.as_string() = prog.build_log(dev);
> break;
>
> + case CL_PROGRAM_BINARY_TYPE:
> + buf.as_scalar<cl_program_binary_type>() =
> prog.binary_type(dev);
> + break;
> +
> default:
> throw error(CL_INVALID_VALUE);
> }
> diff --git a/src/gallium/state_trackers/clover/core/program.cpp
> b/src/gallium/state_trackers/clover/core/program.cpp
> index 8bece05..5fcde2c 100644
> --- a/src/gallium/state_trackers/clover/core/program.cpp
> +++ b/src/gallium/state_trackers/clover/core/program.cpp
> @@ -147,14 +147,11 @@ program::has_executable() const {
>
> bool
> program::has_linkable(const device &dev) const {
> - const auto bin = _binaries.find(&dev);
> + cl_program_binary_type type = binary_type(dev);
>
> - if (bin != _binaries.end()) {
> - const auto &secs = bin->second.secs;
> - if (any_of(type_equals(module::section::text_compiled), secs)
> ||
> - any_of(type_equals(module::section::text_library), secs))
> - return true;
> - }
> + if (type == CL_PROGRAM_BINARY_TYPE_COMPILED_OBJECT ||
> + type == CL_PROGRAM_BINARY_TYPE_LIBRARY)
> + return true;
>
> return false;
> }
> @@ -192,6 +189,26 @@ program::build_log(const device &dev) const {
> return _logs.count(&dev) ? _logs.find(&dev)->second : "";
> }
>
> +cl_program_binary_type
> +program::binary_type(const device &dev) const {
> + const auto bin = _binaries.find(&dev);
> +
> + if (bin != _binaries.end()) {
> + const auto &secs = bin->second.secs;
> +
> + if (any_of(type_equals(module::section::text_compiled), secs))
> + return CL_PROGRAM_BINARY_TYPE_COMPILED_OBJECT;
> +
> + if (any_of(type_equals(module::section::text_library), secs))
> + return CL_PROGRAM_BINARY_TYPE_LIBRARY;
> +
> + if (any_of(type_equals(module::section::text_executable),
> secs))
> + return CL_PROGRAM_BINARY_TYPE_EXECUTABLE;
Can you add a short comment on ordering of the queries here? does it
matter? can you have sections of different types at the same time?
thanks,
Jan
> + }
> +
> + return CL_PROGRAM_BINARY_TYPE_NONE;
> +}
> +
> const compat::vector<module::symbol> &
> program::symbols() const {
> if (_binaries.empty())
> diff --git a/src/gallium/state_trackers/clover/core/program.hpp
> b/src/gallium/state_trackers/clover/core/program.hpp
> index 19c4420..13abc21 100644
> --- a/src/gallium/state_trackers/clover/core/program.hpp
> +++ b/src/gallium/state_trackers/clover/core/program.hpp
> @@ -63,6 +63,7 @@ namespace clover {
> cl_build_status build_status(const device &dev) const;
> std::string build_opts(const device &dev) const;
> std::string build_log(const device &dev) const;
> + cl_program_binary_type binary_type(const device &dev) const;
>
> const compat::vector<module::symbol> &symbols() const;
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20161006/9d6c70c2/attachment-0001.sig>
More information about the mesa-dev
mailing list