From 1644297d34d98b0790a077a320e4dfcc468cdc33 Mon Sep 17 00:00:00 2001 From: Boian Petkantchin Date: Wed, 16 Aug 2023 18:07:36 -0700 Subject: [PATCH] [LevelZero] remove intial data argument form buffer allocation Makes the driver compliant with the HAL API change. --- experimental/level_zero/level_zero_allocator.c | 14 +------------- experimental/level_zero/level_zero_device.c | 6 +++--- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/experimental/level_zero/level_zero_allocator.c b/experimental/level_zero/level_zero_allocator.c index 04d64119b51c..c18d7eed5c9b 100644 --- a/experimental/level_zero/level_zero_allocator.c +++ b/experimental/level_zero/level_zero_allocator.c @@ -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); @@ -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)); diff --git a/experimental/level_zero/level_zero_device.c b/experimental/level_zero/level_zero_device.c index d27abd164e69..ff7ebf1b0101 100644 --- a/experimental/level_zero/level_zero_device.c +++ b/experimental/level_zero/level_zero_device.c @@ -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(); }