orgqr_native.hh
Go to the documentation of this file.
1#pragma once
2
3// Native batched ORGQR: one tier, the `blocked` choice -- ormqr applied to an identity.
4// tuned/orgqr.*.txt picks it to n = 512 on both extents, so it is the DEFAULT inside
5// that window, not a vendor-free fallback. evidence: docs/perf/qr.md#the-shipped-orgqr-ceiling
6
7#include <src/util/internal-api.hh>
12
13#include <cstddef>
14#include <cstdint>
15#include <functional>
16
18
19template <typename T>
20BATCHLAS_INTERNAL_API bool orgqr_blocked_available();
21
22// Must be the SELECTED ormqr: a native entry point called from a driver TU bypasses
23// ormqr's choose(). Positional argument order; absent injection throws.
24template <typename T>
25using OrgqrApplyQ = std::function<Event(
26 Queue&,
27 const MatrixView<T, MatrixFormat::Dense>&, // A: the geqrf output, reflectors
28 const MatrixView<T, MatrixFormat::Dense>&, // C: the identity, overwritten by Q
30 Span<T>, // tau
31 Span<std::byte>, // workspace
32 int32_t)>; // block_size_hint
33
34template <typename T>
35using OrgqrApplyQBufferSize = std::function<std::size_t(
36 Queue&,
40 Span<T>,
41 int32_t)>;
42
43// Runs under BumpAllocator::measuring(): same resolution as the call, no data dereference.
44template <typename T>
45BATCHLAS_INTERNAL_API std::size_t orgqr_blocked_buffer_size(Queue& ctx,
47 Span<T> tau,
48 OrgqrApplyQBufferSize<T> apply_q_buffer_size = {});
49
50// Callable directly (tests, benchmarks), bypassing select::choose, so it re-checks every
51// can_run gate itself and throws rather than computing a wrong Q.
52template <typename T>
53BATCHLAS_INTERNAL_API Event orgqr_blocked_dispatch(Queue& ctx,
55 Span<T> tau,
56 Span<std::byte> workspace,
57 OrgqrApplyQ<T> apply_q = {},
58 OrgqrApplyQBufferSize<T> apply_q_buffer_size = {});
59
60} // namespace batchlas::sycl_orgqr
Non-owning view of a batch of matrices: the argument type of every entry point.
Definition matrix.hh:485
Enumerations, scalar traits and scalar concepts shared by every public header.
Transpose
The operator op() applied to an operand: op(A) = A, A^T or A^H.
Definition enums.hh:171
Side
Side on which a special operand multiplies: op(A) * B or B * op(A).
Definition enums.hh:319
The batched containers: Matrix (owning), MatrixView (non-owning), KernelMatrixView (device-side),...
BATCHLAS_INTERNAL_API std::size_t orgqr_blocked_buffer_size(Queue &ctx, const MatrixView< T, MatrixFormat::Dense > &A, Span< T > tau, OrgqrApplyQBufferSize< T > apply_q_buffer_size={})
std::function< std::size_t( Queue &, const MatrixView< T, MatrixFormat::Dense > &, const MatrixView< T, MatrixFormat::Dense > &, Side, Transpose, Span< T >, int32_t)> OrgqrApplyQBufferSize
BATCHLAS_INTERNAL_API Event orgqr_blocked_dispatch(Queue &ctx, const MatrixView< T, MatrixFormat::Dense > &A, Span< T > tau, Span< std::byte > workspace, OrgqrApplyQ< T > apply_q={}, OrgqrApplyQBufferSize< T > apply_q_buffer_size={})
std::function< Event( Queue &, const MatrixView< T, MatrixFormat::Dense > &, const MatrixView< T, MatrixFormat::Dense > &, Side, Transpose, Span< T >, Span< std::byte >, int32_t)> OrgqrApplyQ
BATCHLAS_INTERNAL_API bool orgqr_blocked_available()
Completion handle of enqueued work, returned by every entry point.
Event()
An empty Event, already complete.
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.
Definition sycl-span.hh:39
batchlas::Device, batchlas::Event and batchlas::Queue: where work runs and how it is ordered.
batchlas::Span, the non-owning pointer + length every entry point takes for 1-D data.