Skip to content

Commit

Permalink
[LevelZero] remove intial data argument form buffer allocation
Browse files Browse the repository at this point in the history
Makes the driver compliant with the HAL API change.
  • Loading branch information
sogartar authored and github-actions[bot] committed Aug 22, 2023
1 parent c1bbd23 commit 727c8de
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 16 deletions.
14 changes: 1 addition & 13 deletions experimental/level_zero/level_zero_allocator.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ static void iree_hal_level_zero_buffer_free(
static iree_status_t iree_hal_level_zero_allocator_allocate_buffer(
iree_hal_allocator_t* IREE_RESTRICT base_allocator,
const iree_hal_buffer_params_t* IREE_RESTRICT params,
iree_device_size_t allocation_size, iree_const_byte_span_t initial_data,
iree_device_size_t allocation_size,
iree_hal_buffer_t** IREE_RESTRICT out_buffer) {
iree_hal_level_zero_allocator_t* allocator =
iree_hal_level_zero_allocator_cast(base_allocator);
Expand Down Expand Up @@ -267,18 +267,6 @@ static iree_status_t iree_hal_level_zero_allocator_allocate_buffer(
/*byte_length=*/allocation_size, device_ptr, host_ptr, &buffer);
}

// Copy the initial contents into the buffer. This may require staging.
if (iree_status_is_ok(status) &&
!iree_const_byte_span_is_empty(initial_data)) {
status = iree_hal_device_transfer_range(
allocator->base_device,
iree_hal_make_host_transfer_buffer_span((void*)initial_data.data,
initial_data.data_length),
0, iree_hal_make_device_transfer_buffer(buffer), 0,
initial_data.data_length, IREE_HAL_TRANSFER_BUFFER_FLAG_DEFAULT,
iree_infinite_timeout());
}

if (iree_status_is_ok(status)) {
IREE_STATISTICS(iree_hal_allocator_statistics_record_alloc(
&allocator->statistics, compat_params.type, allocation_size));
Expand Down
6 changes: 3 additions & 3 deletions experimental/level_zero/level_zero_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -340,9 +340,9 @@ static iree_status_t iree_hal_level_zero_device_queue_alloca(
// TODO(benvanik): queue-ordered allocations.
IREE_RETURN_IF_ERROR(iree_hal_semaphore_list_wait(wait_semaphore_list,
iree_infinite_timeout()));
IREE_RETURN_IF_ERROR(iree_hal_allocator_allocate_buffer(
iree_hal_device_allocator(base_device), params, allocation_size,
iree_const_byte_span_empty(), out_buffer));
IREE_RETURN_IF_ERROR(
iree_hal_allocator_allocate_buffer(iree_hal_device_allocator(base_device),
params, allocation_size, out_buffer));
IREE_RETURN_IF_ERROR(iree_hal_semaphore_list_signal(signal_semaphore_list));
return iree_ok_status();
}
Expand Down

0 comments on commit 727c8de

Please sign in to comment.