Files
VulkanDriver/src/intel/compiler/targets/gen9/compute/compute.zig
T
kbz_8 0788470ee5
Mirror Gitea refs to GitHub / mirror (push) Successful in 21s
Test / build_and_test (push) Successful in 2m54s
Build / build (push) Successful in 4m37s
[Flint] normalize surface addresses and pack Gen9 message payloads
2026-08-28 19:35:16 +02:00

28 lines
1.3 KiB
Zig

const std = @import("std");
pub const message_addresses = @import("message_addresses.zig");
pub const message_lowering = @import("message_lowering.zig");
pub const message_payloads = @import("message_payloads.zig");
pub const resource_layout = @import("resource_layout.zig");
pub const resource_lowering = @import("resource_lowering.zig");
pub const ResourceLayout = resource_layout.Layout;
pub const Error = error{UnsupportedWorkgroupSize};
pub fn validateWorkgroupSize(size: [3]u32) Error!void {
if (size[0] == 0 or size[1] == 0 or size[2] == 0 or size[0] > 128 or size[1] > 128 or size[2] > 64)
return Error.UnsupportedWorkgroupSize;
const xy = std.math.mul(u32, size[0], size[1]) catch return Error.UnsupportedWorkgroupSize;
const invocations = std.math.mul(u32, xy, size[2]) catch return Error.UnsupportedWorkgroupSize;
if (invocations > 128)
return Error.UnsupportedWorkgroupSize;
}
test "[gen9] compute: validate workgroup limits" {
try validateWorkgroupSize(.{ 1, 1, 1 });
try validateWorkgroupSize(.{ 128, 1, 1 });
try std.testing.expectError(Error.UnsupportedWorkgroupSize, validateWorkgroupSize(.{ 0, 1, 1 }));
try std.testing.expectError(Error.UnsupportedWorkgroupSize, validateWorkgroupSize(.{ 129, 1, 1 }));
try std.testing.expectError(Error.UnsupportedWorkgroupSize, validateWorkgroupSize(.{ 64, 3, 1 }));
}