6#include <sycl/sycl.hpp>
29 sycl::group_barrier(
wg);
52template <
typename T,
typename Adapter,
typename QBatch,
typename VView>
54 const Adapter& adapter,
66 const int32_t lane = adapter.lane_id();
67 const int32_t width = adapter.width();
71 const int32_t iters = (dd + stride - 1) / stride;
73 for (int32_t it = 0; it < iters; ++it) {
74 const int32_t eid = first + it * stride;
75 const bool active = (eid < dd);
76 const T Di = active ? d_prob(eid) : T(0);
79 for (int32_t j = lane; active && j < dd; j += width) {
80 const T q_elem = Q_bid(eid, j);
85 const T denom = Di - d_prob(j);
86 ratio = q_elem / denom;
91 if (mant != T(0) && sycl::isfinite(mant)) {
93 mant = sycl::frexp(mant, &e);
102 int32_t expo_all = adapter.template reduce_sum<int32_t>(expo);
103 for (int32_t r0 = 0; r0 < width; r0 += 32) {
104 const bool mine = lane >= r0 && lane < r0 + 32;
105 mant_all *= adapter.reduce_product(mine ? mant : T(1));
106 if (mant_all != T(0) && sycl::isfinite(mant_all)) {
108 mant_all = sycl::frexp(mant_all, &e);
113 if (active && lane == 0) {
116 const int32_t half = expo_all >> 1;
117 const int32_t rem = expo_all - 2 * half;
118 T mag = sycl::sqrt(sycl::fabs(mant_all) * (rem ? T(2) : T(1)));
119 mag = sycl::ldexp(mag, half);
120 const T sgn = (v(eid, bid) >= T(0)) ? T(1) : T(-1);
121 v(eid, bid) = sgn * mag;
128template <Backend B,
typename T>
138 int64_t info_nodes_per_item);
140template <Backend B,
typename T>
150 int64_t info_nodes_per_item);
159template <Backend B,
typename T>
170 int64_t info_nodes_per_item);
Non-owning view of a batch of matrices: the argument type of every entry point.
Non-owning view of a batch of strided vectors: the vector argument type of the entry points.
All positional dense entry points (blas/functions/*.hh) plus their option-struct spellings.
batchlas::portable:: group broadcast, shuffles and sums for any trivially copyable or complex T.
T reduce_over_group(Group g, T x, Op op)
sycl::reduce_over_group, also for a std::complex sum; a work-group floating result is exact (see deta...
T group_broadcast(Group g, T x, Id... id)
sycl::group_broadcast for any trivially copyable T. Collective.
The batched containers: Matrix (owning), MatrixView (non-owning), KernelMatrixView (device-side),...
void maybe_rescale_vectors(bool do_rescale, const Adapter &adapter, int32_t first, int32_t stride, int32_t dd, QBatch &Q_bid, const VectorView< T > &d_prob, const VView &v, int32_t bid)
void stedc_merge_fused(Queue &ctx, const VectorView< T > &eigenvalues, const VectorView< T > &v, const Span< T > &rho, const Span< int32_t > &n_reduced, const MatrixView< T, MatrixFormat::Dense > &Qprime, const VectorView< T > &temp_lambdas, const StedcParams< T > ¶ms, int32_t *info, int64_t info_nodes_per_item)
void stedc_merge_fused_cta(Queue &ctx, const VectorView< T > &eigenvalues, const VectorView< T > &v, const Span< T > &rho, const Span< int32_t > &n_reduced, const MatrixView< T, MatrixFormat::Dense > &Qprime, const VectorView< T > &temp_lambdas, const StedcParams< T > ¶ms, int32_t *info, int64_t info_nodes_per_item)
void stedc_merge_dispatch(Queue &ctx, const VectorView< T > &eigenvalues, const VectorView< T > &v, const Span< T > &rho, const Span< int32_t > &n_reduced, const MatrixView< T, MatrixFormat::Dense > &Qprime, const VectorView< T > &temp_lambdas, const StedcParams< T > ¶ms, int32_t *info, int64_t info_nodes_per_item)
Where BatchLAS work runs: a device, a backend, an ordered SYCL queue and a workspace arena.
Non-owning view of size() contiguous elements of type T.
T reduce_product(T value) const
T reduce_sum(T value) const
T broadcast(T value) const