// Generated by tool/gen/fn/generate.py; do not edit.
// schema_sha256=8f189e5eb316e76fc2971de4cd6f5852eb7011a1e6fcaeebaba92903ca0214ed
// Private FIPS 204 batched HashML-DSA prehash stage; one workgroup digests
// one variable-length message row into uniform staging rows of
// mldsa_prehash_bytes(algorithm) each. Public data only.
import attributes;
import mldsa_verification_par;
import mldsa_prehash_layout;
struct PushConstants {
uint input_index;
uint offsets_index;
uint lengths_index;
uint digests_index;
uint batch_size;
uint input_bytes;
uint algorithm;
};
[[vk::push_constant]] PushConstants push;
[[vk::binding(0, 0)]] RWByteAddressBuffer storage_buffers[];
[kernel_name("ml_dsa_ph_batch")]
[domain("cryptography")]
[variant("generic")]
[dtype("u8")]
[status("experimental")]
[shader("compute")]
[numthreads(128, 1, 1)]
void main(uint3 group_thread_id : SV_GroupThreadID, uint3 group_id : SV_GroupID) {
uint lane = group_thread_id.x;
if (group_id.y != 0u || group_id.z != 0u) return;
uint idx = group_id.x;
if (idx >= push.batch_size) return;
uint need = mldsa_prehash_bytes(push.algorithm);
if (need == 0u || idx > 0xffffffffu / need) return;
uint row_base = idx * 4u;
uint offset = storage_buffers[push.offsets_index].Load(row_base);
uint length = storage_buffers[push.lengths_index].Load(row_base);
// Allocation padding is not part of the semantic input buffer.
if (offset > push.input_bytes || length > push.input_bytes - offset) return;
mldsa_ph_batch_par(push.algorithm,
storage_buffers[push.input_index], offset, length,
storage_buffers[push.digests_index], idx * need, lane);
}