0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-26 00:32:35 +01:00

ircd:🆑:kern: Add argument setter template for various/integral inputs.

This commit is contained in:
Jason Volk 2021-03-22 11:05:45 -07:00
parent 6ca5f8b18f
commit dbf19fcf4b
2 changed files with 17 additions and 0 deletions

View file

@ -111,6 +111,8 @@ struct ircd::cl::kern
public: public:
void arg(const int, data &); void arg(const int, data &);
void arg(const int, const const_buffer &);
template<class T> void arg(const int, const T &);
template<class... argv> kern(code &, const string_view &name, argv&&...); template<class... argv> kern(code &, const string_view &name, argv&&...);
kern(code &, const string_view &name); kern(code &, const string_view &name);
@ -259,6 +261,14 @@ ircd::cl::kern::kern(code &c,
this->arg(i, *datas[i]); this->arg(i, *datas[i]);
} }
template<class T>
inline void
ircd::cl::kern::arg(const int pos,
const T &val)
{
arg(pos, const_buffer(&val, 1));
}
inline inline
ircd::cl::exec::exec(kern &kern, ircd::cl::exec::exec(kern &kern,
const opts &opts, const opts &opts,

View file

@ -805,6 +805,13 @@ ircd::cl::kern::arg(const int i,
call(clSetKernelArg, cl_kernel(handle), i, sizeof(cl_mem), &data_handle); call(clSetKernelArg, cl_kernel(handle), i, sizeof(cl_mem), &data_handle);
} }
void
ircd::cl::kern::arg(const int i,
const const_buffer &buf)
{
call(clSetKernelArg, cl_kernel(handle), i, ircd::size(buf), ircd::data(buf));
}
// //
// code // code
// //