[Flint] adding compute resource layout lowering
Mirror Gitea refs to GitHub / mirror (push) Successful in 18s
Test / build_and_test (push) Successful in 2m12s
Build / build (push) Successful in 3m21s

This commit is contained in:
2026-08-14 20:41:31 +02:00
parent 8c934c7328
commit 04ff263b40
13 changed files with 484 additions and 64 deletions
@@ -12,6 +12,7 @@ pub const Error = shared.Error || compute.Error || error{
UnsupportedExecutionSize,
UnsupportedDataType,
InvalidPhysicalFlag,
InvalidBindingTableIndex,
InvalidPayloadLayout,
};
@@ -54,10 +55,12 @@ fn validateInstruction(inst: instruction.Instruction) Error!void {
switch (inst.operation) {
.load_global_invocation_id => |op| try validateDestination(op.destination),
.load_buffer => |op| {
try validateBufferReference(op.buffer);
try validateDestination(op.destination);
try validateSource(op.byte_offset);
},
.store_buffer => |op| {
try validateBufferReference(op.buffer);
try validateSource(op.byte_offset);
try validateSource(op.source);
},
@@ -88,6 +91,14 @@ fn validateInstruction(inst: instruction.Instruction) Error!void {
}
}
fn validateBufferReference(reference: instruction.BufferReference) Error!void {
switch (reference) {
.logical => {},
.binding_table => |index| if (index >= compute.resource_layout.max_storage_buffers)
return Error.InvalidBindingTableIndex,
}
}
fn validateSource(source: operand.Source) Error!void {
try validateType(source.type);
switch (source.register) {