oarust 0.9.0

GPU-first semantic computing engine written in Rust
// @generated by tool/gen/fn/generate.py; DO NOT EDIT.
// schema=cryptography_bigint.json schema_version=1 generator_version=64
// schema_sha256=636171eea6d8620d516a7d64ef1143ab03485ef3095474ad2e2c60e9fe0fe9e6
// No OA C++ BigInt donor exists. Arithmetic helpers are independently tested.
// One invocation owns every output limb/status of a complete batch row.
// This public-data baseline has no secret-placement or constant-time contract.
import attributes;
import bigint_words;
import bigint_division;
import wide_u32;

struct PushConstants {
	uint left_index;
	uint output_index;
	uint status_index;
	uint count;
	uint words;
	uint input_words;
};
[[vk::push_constant]] PushConstants push;
[[vk::binding(0, 0)]] RWByteAddressBuffer storage_buffers[];

[kernel_name("to_u32")]
[domain("cryptography")]
[variant("generic")]
[dtype("u32")]
[status("experimental")]
[shader("compute")]
[numthreads(32, 1, 1)]
void main(uint3 tid : SV_DispatchThreadID) {
	uint row = tid.x;
	if (row >= push.count || push.input_words == 0u || push.input_words > 256u || push.input_words != push.words || push.words > 128u) return;
	uint left_extent; storage_buffers[push.left_index].GetDimensions(left_extent);
	if (push.count > left_extent / (push.input_words * 4u)) return;
	uint output_extent; uint output_row_bytes = 1u * 4u;
	storage_buffers[push.output_index].GetDimensions(output_extent);
	if (push.count > output_extent / output_row_bytes) return;
	uint status_extent; uint status_row_bytes = 1u * 4u;
	storage_buffers[push.status_index].GetDimensions(status_extent);
	if (push.count > status_extent / status_row_bytes) return;
	uint overflow = 0u;
	for (uint i = 1u; i < push.words; ++i)
		overflow |= storage_buffers[push.left_index].Load(row * push.words * 4u + i * 4u);
	for (uint i = 0u; i < 1u; ++i) {
		uint value = i < push.words ? storage_buffers[push.left_index].Load(row * push.words * 4u + i * 4u) : 0u;
		storage_buffers[push.output_index].Store(row * output_row_bytes + i * 4u, overflow == 0u ? value : 0u);
	}
	storage_buffers[push.status_index].Store(row * 4u, uint(overflow == 0u));
}