[Flint] adding multiple registers/blocks support
Mirror Gitea refs to GitHub / mirror (push) Successful in 12s
Build / build (push) Failing after 1m4s
Test / build_and_test (push) Successful in 1m56s

This commit is contained in:
2026-09-05 14:04:05 +02:00
parent 481a35f9fd
commit b2f5fce3a0
17 changed files with 1423 additions and 138 deletions
+37 -13
View File
@@ -123,19 +123,7 @@ pub const Device = struct {
group_index = groups.items.len - 1;
}
const domain: u32 = switch (relocation.domain) {
.none => 0,
.render => _i915.gem_domain_render,
.instruction => _i915.gem_domain_instruction,
};
groups.items[group_index].entries.append(allocator, .{
.target_handle = relocation.target_handle,
.delta = relocation.delta,
.offset = relocation.offset,
.presumed_offset = 0,
.read_domains = if (relocation.read) domain else 0,
.write_domain = if (relocation.write) domain else 0,
}) catch return VkError.OutOfHostMemory;
groups.items[group_index].entries.append(allocator, relocationEntry(relocation)) catch return VkError.OutOfHostMemory;
}
var objects = std.ArrayList(_i915.ExecObject2).empty;
@@ -202,6 +190,24 @@ pub const Device = struct {
}
};
fn relocationEntry(relocation: common_kmd.Relocation) _i915.RelocationEntry {
const domain: u32 = switch (relocation.domain) {
.none => 0,
.render => _i915.gem_domain_render,
.instruction => _i915.gem_domain_instruction,
};
return .{
.target_handle = relocation.target_handle,
.delta = relocation.delta,
.offset = relocation.offset,
// GPU address zero is valid. These locations have not been patched yet,
// so never let i915 skip the initial relocation, including its delta.
.presumed_offset = std.math.maxInt(u64),
.read_domains = if (relocation.read) domain else 0,
.write_domain = if (relocation.write) domain else 0,
};
}
pub const Memory = struct {
handle: u32,
size: vk.DeviceSize,
@@ -292,3 +298,21 @@ pub const Memory = struct {
) catch return VkError.DeviceLost;
}
};
test "[i915] initial relocations force patching even at GPU address zero" {
const entry = relocationEntry(.{
.source_handle = 4,
.target_handle = 4,
.offset = 64,
.delta = 1920,
.read = true,
.write = false,
.domain = .render,
});
try std.testing.expectEqual(std.math.maxInt(u64), entry.presumed_offset);
try std.testing.expectEqual(@as(u32, 1920), entry.delta);
try std.testing.expectEqual(@as(u64, 64), entry.offset);
try std.testing.expectEqual(@as(u32, 4), entry.target_handle);
try std.testing.expectEqual(_i915.gem_domain_render, entry.read_domains);
try std.testing.expectEqual(@as(u32, 0), entry.write_domain);
}