70 const SegmentGeometry& geometry, uint32_t first_lag, uint32_t lag_count)
72 const auto length_bits = std::bit_cast<uint64_t>(
static_cast<double>(geometry.
length));
73 const std::array<uint32_t, 7> push {
75 static_cast<uint32_t
>(length_bits & 0xFFFFFFFFU),
static_cast<uint32_t
>(length_bits >> 32U)
77 const size_t result_bytes =
static_cast<size_t>(geometry.
count) * lag_count *
sizeof(uint64_t);
87 .explicit_groups = std::array<uint32_t, 3> { lag_count, geometry.
count, 1U },
115 const SegmentGeometry& geometry, uint32_t first_lag, uint32_t lag_count)
118 stage.stage_fn = [&context, values, resident = std::move(stage.stage_fn)](
GpuDispatchCore& core) {
Runs a shader on doubles carried as two 32-bit words, with no fp64 on the device.
ShaderSpec build()
Finalise and return the ShaderSpec.
Assemble & pc(std::string name, Kakshya::GpuDataFormat format)
Declare a push constant field with explicit format.
Assemble & ssbo(std::string name, BindingDirection direction, Kakshya::GpuDataFormat format, Kakshya::DataModality modality=Kakshya::DataModality::SCALAR_F32)
Declare an SSBO binding.
Assemble & pair_map(PairMap m)
Set the pairwise map of a LaggedPair.
Assemble & centred(bool c=true)
Subtract each window's mean from both operands of a LaggedPair before the map.
Assemble & workgroup(uint32_t x, uint32_t y=1, uint32_t z=1)
Override workgroup size.
Assemble & tmpl(KernelTemplate t)
Set the kernel template.
Fluent assembler producing a ShaderSpec.
std::optional< SharedBufferInfo > shared_buffer_info(uint32_t set, size_t binding_index) const
What the shared buffer at (set, binding_index) declares, or nothing when absent.
void set_output_size(size_t index, size_t byte_size)
Declare the byte capacity of an output binding independently of input data.
void set_push_constants(const void *data, size_t bytes)
Set push constant data from a raw byte pointer.
Non-template base that owns all type-independent GPU dispatch logic.
void stage_words(uint32_t binding, std::span< const double > values, size_t padded_count=0, bool complement=false)
Encode values and stage them as the data of a binding.
Shader context whose numeric input is staged as a uvec2 per double.
@ VEC2_U32
glm::uvec2: a 64-bit value as low word (x) and high word (y), not a sampled image format
@ LaggedPair
Sums a pairwise map of x[i] and x[i + lag] over a window, for every lag in a range,...
BindingDirection
Data flow direction for a shader binding slot.
PairMap
Map of two elements, x[i] and x[i + lag], summed by a LaggedPair kernel.
Portal::Graphics::ShaderSpec lagged_pair_spec(Portal::Graphics::PairMap map, bool centred, uint32_t workgroup=256)
The spec of a LaggedPair kernel.
DependencyStage lagged_pair_stage(WordPairExecutionContext &context, const GpuComputeConfig &config, const SegmentGeometry &geometry, uint32_t first_lag, uint32_t lag_count)
The stage that sums every window at every lag in a range, over values already on the device.
Plain-data description of the compute shader to dispatch.
Complete declarative description of a generated compute shader.
One stage in a record_stages call.
Where the windows of a GPU pass sit in the value array.