From 19210277a25d681552b45e6a8900b9a42efdf620 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Thu, 5 May 2022 16:24:01 -0700 Subject: [PATCH] ircd::cl::data: Add master() method for associated memobject. --- include/ircd/cl/data.h | 1 + ircd/cl.cc | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/include/ircd/cl/data.h b/include/ircd/cl/data.h index 63ad9e59e..614201fe5 100644 --- a/include/ircd/cl/data.h +++ b/include/ircd/cl/data.h @@ -22,6 +22,7 @@ struct ircd::cl::data public: explicit operator bool() const; + void *master() const; uint flags() const; size_t size() const; off_t offset() const; diff --git a/ircd/cl.cc b/ircd/cl.cc index 05643e3aa..5a1266352 100644 --- a/ircd/cl.cc +++ b/ircd/cl.cc @@ -2166,6 +2166,17 @@ const return info(clGetMemObjectInfo, cl_mem(mutable_cast(handle)), CL_MEM_FLAGS, buf); } +void * +ircd::cl::data::master() +const +{ + assert(handle); + + char buf[sizeof(void *)] {0}; + constexpr auto qtype(CL_MEM_ASSOCIATED_MEMOBJECT); + return info(clGetMemObjectInfo, cl_mem(mutable_cast(handle)), qtype, buf); +} + // // cl::work (event) //