mirror of
https://github.com/matrix-construct/construct
synced 2024-12-30 17:34:04 +01:00
ircd::gpt: Remove branch by assuming loop body always taken.
This commit is contained in:
parent
f8137c50d0
commit
5518daf197
1 changed files with 24 additions and 2 deletions
26
ircd/gpt.cc
26
ircd/gpt.cc
|
@ -805,8 +805,30 @@ ircd::gpt::adamw(task &task,
|
|||
reinterpret_cast<f32x4 *>(m_[1]) + off,
|
||||
};
|
||||
|
||||
for(uint i(0); i < num / 4; ++i)
|
||||
off = adamw(p[0][i], p[1][i], p[2][i], grad, opts.alpha, opts.beta[0], opts.beta[1], ctrl.epic.step, off);
|
||||
assert(num >= 4);
|
||||
const uint n
|
||||
{
|
||||
uint(num) / 4
|
||||
};
|
||||
|
||||
// Assume loop body always taken w/o soundness; otherwise extra branch.
|
||||
assert(n > 0);
|
||||
uint i(0); do
|
||||
{
|
||||
off = adamw
|
||||
(
|
||||
p[0][i],
|
||||
p[1][i],
|
||||
p[2][i],
|
||||
grad,
|
||||
opts.alpha,
|
||||
opts.beta[0],
|
||||
opts.beta[1],
|
||||
ctrl.epic.step,
|
||||
off
|
||||
);
|
||||
}
|
||||
while(++i < n);
|
||||
|
||||
return off;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue