Skip to content

Commit 604cba8

Browse files
authored
Fix incorrect offset in fd_file.c (#19543)
iree_hal_buffer_mapping_{flush,invalidate}_range take values that are relative to the mappings, not the buffers themselves. Signed-off-by: Andrew Woloszyn <[email protected]>
1 parent 7ff83ea commit 604cba8

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

runtime/src/iree/hal/utils/fd_file.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,7 @@ static iree_status_t iree_hal_fd_file_read(iree_hal_file_t* base_file,
319319
if (iree_status_is_ok(status) &&
320320
!iree_all_bits_set(iree_hal_buffer_memory_type(buffer),
321321
IREE_HAL_MEMORY_TYPE_HOST_COHERENT)) {
322-
status =
323-
iree_hal_buffer_mapping_flush_range(&mapping, buffer_offset, length);
322+
status = iree_hal_buffer_mapping_flush_range(&mapping, 0, length);
324323
}
325324

326325
return iree_status_join(status, iree_hal_buffer_unmap_range(&mapping));
@@ -342,8 +341,7 @@ static iree_status_t iree_hal_fd_file_write(iree_hal_file_t* base_file,
342341
iree_status_t status = iree_ok_status();
343342
if (!iree_all_bits_set(iree_hal_buffer_memory_type(buffer),
344343
IREE_HAL_MEMORY_TYPE_HOST_COHERENT)) {
345-
status = iree_hal_buffer_mapping_invalidate_range(&mapping, buffer_offset,
346-
length);
344+
status = iree_hal_buffer_mapping_invalidate_range(&mapping, 0, length);
347345
}
348346

349347
const uint8_t* buffer_ptr = mapping.contents.data;

0 commit comments

Comments
 (0)