mirror of
https://github.com/matrix-construct/construct
synced 2024-12-27 07:54:05 +01:00
ircd::gpt::gpu: Limit dispatch to the number of control frame buffers.
This commit is contained in:
parent
a50f9fbd1b
commit
e89703aa97
2 changed files with 16 additions and 12 deletions
18
ircd/gpt.cc
18
ircd/gpt.cc
|
@ -939,14 +939,9 @@ ircd::gpt::samp::tokenize()
|
||||||
bool
|
bool
|
||||||
ircd::gpt::samp::dispatche()
|
ircd::gpt::samp::dispatche()
|
||||||
{
|
{
|
||||||
if(!dispatch)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
assert(accept < 0);
|
assert(accept < 0);
|
||||||
assert(count > 0);
|
if(queue.size() >= dispatch)
|
||||||
assert(tokens >= count);
|
return false;
|
||||||
assert(cycle < count);
|
|
||||||
assert(dispatch > 0);
|
|
||||||
|
|
||||||
if(cycle == 0)
|
if(cycle == 0)
|
||||||
{
|
{
|
||||||
|
@ -954,11 +949,20 @@ ircd::gpt::samp::dispatche()
|
||||||
ctrl.prof.released = prof::cycles();
|
ctrl.prof.released = prof::cycles();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assert(queue.size() < opts.frames);
|
||||||
queue.emplace_back(*this);
|
queue.emplace_back(*this);
|
||||||
|
|
||||||
|
assert(tokens >= count);
|
||||||
desc.cached = tokens;
|
desc.cached = tokens;
|
||||||
tokens += count >= tokens;
|
tokens += count >= tokens;
|
||||||
|
|
||||||
|
assert(count > 0);
|
||||||
count += 1;
|
count += 1;
|
||||||
|
|
||||||
|
assert(cycle < count);
|
||||||
cycle += 1;
|
cycle += 1;
|
||||||
|
|
||||||
|
assert(dispatch > 0);
|
||||||
dispatch -= 1;
|
dispatch -= 1;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1068,25 +1068,25 @@ ircd_gpt_accept(__local struct ircd_gpt_ctrl *const ctrl,
|
||||||
|
|
||||||
if(opts->limit == 0 && unprocessed)
|
if(opts->limit == 0 && unprocessed)
|
||||||
{
|
{
|
||||||
accept = -1;
|
accept = accept >= 0? accept: -1;
|
||||||
dispatch = min((uint)remain, unproc);
|
dispatch = min((uint)remain, unproc);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(opts->limit != 0 && !acceptable)
|
if(opts->limit != 0 && !acceptable)
|
||||||
{
|
{
|
||||||
accept = -1;
|
accept = accept >= 0? accept: -1;
|
||||||
dispatch = max(dispatch, 1);
|
dispatch = max(dispatch, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
ctrl->accept = accept;
|
ctrl->accept = accept;
|
||||||
ctrl->dispatch = dispatch;
|
ctrl->dispatch = min((uint)dispatch, opts->frames);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
ircd_gpt_accept_check(__local struct ircd_gpt_ctrl *const ctrl,
|
ircd_gpt_accept_check(__local struct ircd_gpt_ctrl *const ctrl,
|
||||||
__constant const struct ircd_gpt_opts *const opts)
|
__constant const struct ircd_gpt_opts *const opts)
|
||||||
{
|
{
|
||||||
int best = 8;
|
int best = opts->frames;
|
||||||
for(uint i = 0; i < 4; ++i)
|
for(uint i = 0; i < 4; ++i)
|
||||||
{
|
{
|
||||||
const int
|
const int
|
||||||
|
@ -1110,7 +1110,7 @@ ircd_gpt_accept_match(__local struct ircd_gpt_ctrl *const ctrl,
|
||||||
const uint
|
const uint
|
||||||
len = ircd_gpt_accept_len(ctrl, opts, i),
|
len = ircd_gpt_accept_len(ctrl, opts, i),
|
||||||
n = min(ctrl->count, len),
|
n = min(ctrl->count, len),
|
||||||
maxlen = 8;
|
maxlen = opts->frames;
|
||||||
|
|
||||||
uint ret = len?: maxlen;
|
uint ret = len?: maxlen;
|
||||||
for(uint j = 1; j <= n; ++j)
|
for(uint j = 1; j <= n; ++j)
|
||||||
|
|
Loading…
Reference in a new issue