0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-25 08:12:37 +01:00

ircd:🆑:code: Add construction for IL.

This commit is contained in:
Jason Volk 2022-03-27 02:48:25 -07:00
parent d9c087c037
commit f5fb03b1b5
2 changed files with 26 additions and 1 deletions

View file

@ -31,6 +31,7 @@ struct ircd::cl::code
void link(const string_view &opts = {});
void build(const string_view &opts = {});
explicit code(const const_buffer &bc);
explicit code(const vector_view<const const_buffer> &bins);
code(const vector_view<const string_view> &srcs);
code(const string_view &src);

View file

@ -654,7 +654,7 @@ ircd::cl::query_warp_size(cl_context context,
cl::code code
{
"__kernel void ircd_test() {}"
"__kernel void ircd_test() {}"_sv
};
code.compile();
@ -1420,6 +1420,30 @@ ircd::cl::code::code(const vector_view<const const_buffer> &bins)
throw_on_error(binerr[i]);
}
ircd::cl::code::code(const const_buffer &bc)
{
char pbuf[1][48];
log::logf
{
log, log::level::DEBUG,
"code(%p) loading %s bitcode:%p",
this,
pretty(pbuf[0], si(ircd::size(bc))),
ircd::data(bc),
};
int err {CL_SUCCESS};
handle = clCreateProgramWithIL
(
primary,
ircd::data(bc),
ircd::size(bc),
&err
);
throw_on_error(err);
}
ircd::cl::code::~code()
noexcept try
{