0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2025-01-13 16:33:53 +01:00

ircd:🆑:exec: Add more specific size/offset argument for map closure related.

This commit is contained in:
Jason Volk 2021-03-29 10:26:57 -07:00
parent 762e3f097a
commit 2a730b2799
2 changed files with 38 additions and 14 deletions

View file

@ -151,10 +151,10 @@ struct ircd::cl::exec
static const opts opts_default;
// View data written by the device to the GTT (synchronous closure).
exec(data &, const read_closure &, const opts & = opts_default);
exec(data &, const pair<size_t, off_t> &, const read_closure &, const opts & = opts_default);
// View buffer in the GTT which the device will read (synchronous closure).
exec(data &, const write_closure &, const opts & = opts_default);
exec(data &, const pair<size_t, off_t> &, const write_closure &, const opts & = opts_default);
// Copy data from the buffer to the GTT for use by the device.
exec(data &, const const_buffer &, const opts & = opts_default);

View file

@ -582,6 +582,7 @@ catch(const std::exception &e)
}
ircd::cl::exec::exec(data &data,
const pair<size_t, off_t> &slice,
const read_closure &closure,
const opts &opts)
try
@ -591,16 +592,27 @@ try
queue[0][0]
};
const auto size
{
slice.first?:
opts.size?:
data.size()
};
const auto offset
{
slice.second?:
opts.offset[0]
};
assert(size_t(size) <= data.size());
assert(size_t(offset) <= data.size());
const auto deps
{
make_deps(this, opts)
};
const auto size
{
opts.size?: data.size()
};
cl_map_flags flags {0};
flags |= CL_MAP_READ;
@ -614,7 +626,7 @@ try
cl_mem(data.handle),
opts.blocking,
flags,
opts.offset[0],
offset,
size,
deps.size(),
deps.size()? deps.data(): nullptr,
@ -678,6 +690,7 @@ catch(const std::exception &e)
}
ircd::cl::exec::exec(data &data,
const pair<size_t, off_t> &slice,
const write_closure &closure,
const opts &opts)
try
@ -687,16 +700,27 @@ try
queue[0][0]
};
const auto size
{
slice.first?:
opts.size?:
data.size()
};
const auto offset
{
slice.second?:
opts.offset[0]
};
assert(size_t(size) <= data.size());
assert(size_t(offset) <= data.size());
const auto deps
{
make_deps(this, opts)
};
const auto size
{
opts.size?: data.size()
};
cl_map_flags flags {0};
flags |= CL_MAP_WRITE;
flags |= opts.duplex? CL_MAP_READ: 0;
@ -711,7 +735,7 @@ try
cl_mem(data.handle),
opts.blocking,
flags,
opts.offset[0],
offset,
size,
deps.size(),
deps.size()? deps.data(): nullptr,