97 out.
vfactor = batchlas::sycl_device::dev_one<D>();
105 if (ssq == R(0) && alphi == R(0))
return out;
107 if (!(s > R(0)))
return out;
109 const R alphr = batchlas::sycl_device::dev_real(alpha);
110 const R ar = alphr / s;
111 const R ai = alphi / s;
113 const R nrm = sycl::sqrt(sycl::fma(ar, ar, sycl::fma(ai, ai, ssq)));
117 const R beta_s = (alphr >= R(0)) ? -nrm : nrm;
119 if constexpr (batchlas::sycl_device::dev_is_complex_v<D>) {
120 out.
tau = D{(beta_s - ar) / beta_s, -ai / beta_s};
121 out.
beta = D{beta_s * s, R(0)};
123 out.
tau = (beta_s - ar) / beta_s;
124 out.
beta = beta_s * s;
127 const D d = batchlas::sycl_device::dev_sub(alpha, out.
beta);
129 const D r = batchlas::sycl_device::dev_recip(d);
130 out.
use_mul = batchlas::sycl_device::dev_isfinite(r) &&
131 !batchlas::sycl_device::dev_is_zero(r);
163 const uint32_t lanes =
static_cast<uint32_t
>(sg.get_local_linear_range());
164 if constexpr (batchlas::sycl_device::dev_is_complex_v<D>) {
168 for (uint32_t off = lanes / 2; off > 0; off >>= 1) {
169 re += sycl::permute_group_by_xor(sg, re, off);
170 im += sycl::permute_group_by_xor(sg, im, off);
174 for (uint32_t off = lanes / 2; off > 0; off >>= 1) {
175 v += sycl::permute_group_by_xor(sg, v, off);
185 const uint32_t lanes =
static_cast<uint32_t
>(sg.get_local_linear_range());
186 for (uint32_t off = lanes / 2; off > 0; off >>= 1) {
187 v = sycl::fmax(v, sycl::permute_group_by_xor(sg, v, off));
201 const auto g = it.get_group();
202 const auto sg = it.get_sub_group();
203 const int lane =
static_cast<int>(sg.get_local_linear_id());
204 const int nlanes =
static_cast<int>(sg.get_local_linear_range());
209 :
static_cast<int>(it.get_local_range(0));
211 :
static_cast<int>(it.get_local_linear_id());
213 ? 0 :
static_cast<int>(sg.get_group_linear_id());
215 ? 1 :
static_cast<int>(sg.get_group_linear_range());
217 const auto phase_barrier = [&]() {
219 sycl::group_barrier(sg);
221 sycl::group_barrier(g);
225 for (
int j = 0; j < kmax; ++j) {
229 const D alpha = A.at(j, j);
232 for (
int r = j + 1 + tid; r < m; r += wg) {
233 smax = sycl::fmax(smax,
dev_absmax(A.at(r, j)));
244 for (
int r = j + 1 + tid; r < m; r += wg) {
265 for (
int r = j + 1 + tid; r < m; r += wg) {
266 A.at(r, j) = batchlas::sycl_device::dev_mul(A.at(r, j), h.
vfactor);
269 for (
int r = j + 1 + tid; r < m; r += wg) {
270 A.at(r, j) = batchlas::sycl_device::dev_div(A.at(r, j), h.
vfactor);
286 const D ctau = batchlas::sycl_device::dev_conj(h.
tau);
290 for (
int c = j + 1 + team; c < n; c += nteams) {
293 for (
int r = j + 1 + lane; r < m; r += nlanes) {
294 acc =
dev_add(acc, batchlas::sycl_device::dev_mul(
295 batchlas::sycl_device::dev_conj(A.at(r, j)),
299 const D f = batchlas::sycl_device::dev_mul(ctau, w);
302 A.at(j, c) = batchlas::sycl_device::dev_sub(A.at(j, c), f);
304 for (
int r = j + 1 + lane; r < m; r += nlanes) {
305 A.at(r, c) = batchlas::sycl_device::dev_sub(
306 A.at(r, c), batchlas::sycl_device::dev_mul(f, A.at(r, j)));