From 72e2c27aecb9c90c37ec7215acd917443eddeb7e Mon Sep 17 00:00:00 2001 From: makslevental Date: Wed, 16 Oct 2024 09:26:12 -0400 Subject: [PATCH] address comments --- .../iree-amd-aie/driver/xrt-lite/allocator.cc | 38 +++++------- .../src/iree-amd-aie/driver/xrt-lite/api.h | 8 --- .../iree-amd-aie/driver/xrt-lite/buffer.cc | 47 ++++++++------- .../xrt-lite/cts/executable_cache_test.mlir | 2 +- .../iree-amd-aie/driver/xrt-lite/device.cc | 59 ++++++++++--------- .../driver/xrt-lite/direct_command_buffer.cc | 2 +- .../driver/xrt-lite/direct_command_buffer.h | 12 +--- .../iree-amd-aie/driver/xrt-lite/driver.cc | 4 +- .../driver/xrt-lite/executable.cc | 16 +---- .../iree-amd-aie/driver/xrt-lite/executable.h | 13 +--- .../driver/xrt-lite/nop_executable_cache.cc | 2 +- .../driver/xrt-lite/nop_executable_cache.h | 16 +---- .../driver/xrt-lite/nop_semaphore.h | 8 --- .../driver/xrt-lite/shim/CMakeLists.txt | 2 +- .../driver/xrt-lite/shim/linux/CMakeLists.txt | 2 +- 15 files changed, 84 insertions(+), 147 deletions(-) diff --git a/runtime/src/iree-amd-aie/driver/xrt-lite/allocator.cc b/runtime/src/iree-amd-aie/driver/xrt-lite/allocator.cc index 509556dad..ceae8130c 100644 --- a/runtime/src/iree-amd-aie/driver/xrt-lite/allocator.cc +++ b/runtime/src/iree-amd-aie/driver/xrt-lite/allocator.cc @@ -31,10 +31,10 @@ struct iree_hal_xrt_lite_allocator { } }; -iree_hal_buffer_compatibility_t query_buffer_compatibility( +iree_hal_buffer_compatibility_t +iree_hal_xrt_lite_allocator_query_buffer_compatibility( iree_hal_allocator_t* base_allocator, iree_hal_buffer_params_t* params, iree_device_size_t* allocation_size) { - // All buffers can be allocated on the heap. iree_hal_buffer_compatibility_t compatibility = IREE_HAL_BUFFER_COMPATIBILITY_ALLOCATABLE; @@ -50,7 +50,6 @@ iree_hal_buffer_compatibility_t query_buffer_compatibility( } } - // We are now optimal. params->type &= ~IREE_HAL_MEMORY_TYPE_OPTIMAL; // Guard against the corner case where the requested buffer size is 0. The @@ -65,16 +64,16 @@ iree_hal_buffer_compatibility_t query_buffer_compatibility( return compatibility; } -iree_status_t allocate_buffer(iree_hal_allocator_t* base_allocator, - const iree_hal_buffer_params_t* params, - iree_device_size_t allocation_size, - iree_hal_buffer_t** out_buffer) { +iree_status_t iree_hal_xrt_lite_allocator_allocate_buffer( + iree_hal_allocator_t* base_allocator, + const iree_hal_buffer_params_t* params, iree_device_size_t allocation_size, + iree_hal_buffer_t** out_buffer) { iree_hal_xrt_lite_allocator* allocator = reinterpret_cast(base_allocator); - // Coerce options into those required by the current device. iree_hal_buffer_params_t compat_params = *params; - iree_hal_buffer_compatibility_t compatibility = query_buffer_compatibility( - base_allocator, &compat_params, &allocation_size); + iree_hal_buffer_compatibility_t compatibility = + iree_hal_xrt_lite_allocator_query_buffer_compatibility( + base_allocator, &compat_params, &allocation_size); if (!iree_all_bits_set(compatibility, IREE_HAL_BUFFER_COMPATIBILITY_ALLOCATABLE)) { return iree_make_status( @@ -104,8 +103,8 @@ iree_status_t allocate_buffer(iree_hal_allocator_t* base_allocator, return status; } -void deallocate_buffer(iree_hal_allocator_t* base_allocator, - iree_hal_buffer_t* base_buffer) { +void iree_hal_xrt_lite_allocator_deallocate_buffer( + iree_hal_allocator_t* base_allocator, iree_hal_buffer_t* base_buffer) { iree_hal_xrt_lite_allocator* allocator = reinterpret_cast(base_allocator); bool was_imported = false; @@ -117,12 +116,6 @@ void deallocate_buffer(iree_hal_allocator_t* base_allocator, iree_hal_buffer_destroy(base_buffer); } -static iree_hal_xrt_lite_allocator* iree_hal_xrt_lite_allocator_cast( - iree_hal_allocator_t* base_value) { - IREE_HAL_ASSERT_TYPE(base_value, &iree_hal_xrt_lite_allocator_vtable); - return reinterpret_cast(base_value); -} - iree_status_t iree_hal_xrt_lite_allocator_create( iree_allocator_t host_allocator, shim_xdna::device* device, iree_hal_allocator_t** out_allocator) { @@ -151,7 +144,7 @@ static void iree_hal_xrt_lite_allocator_destroy( iree_hal_allocator_t* base_allocator) { IREE_ASSERT_ARGUMENT(base_allocator); iree_hal_xrt_lite_allocator* allocator = - iree_hal_xrt_lite_allocator_cast(base_allocator); + reinterpret_cast(base_allocator); IREE_TRACE_ZONE_BEGIN(z0); iree_hal_resource_release(&allocator->resource); @@ -173,8 +166,9 @@ const iree_hal_allocator_vtable_t iree_hal_xrt_lite_allocator_vtable = { .host_allocator = iree_hal_xrt_lite_allocator_host_allocator, .trim = unimplemented_ok_status, .query_statistics = unimplemented_ok_void, - .query_buffer_compatibility = query_buffer_compatibility, - .allocate_buffer = allocate_buffer, - .deallocate_buffer = deallocate_buffer, + .query_buffer_compatibility = + iree_hal_xrt_lite_allocator_query_buffer_compatibility, + .allocate_buffer = iree_hal_xrt_lite_allocator_allocate_buffer, + .deallocate_buffer = iree_hal_xrt_lite_allocator_deallocate_buffer, }; } diff --git a/runtime/src/iree-amd-aie/driver/xrt-lite/api.h b/runtime/src/iree-amd-aie/driver/xrt-lite/api.h index bd6049238..18d1bbff0 100644 --- a/runtime/src/iree-amd-aie/driver/xrt-lite/api.h +++ b/runtime/src/iree-amd-aie/driver/xrt-lite/api.h @@ -10,10 +10,6 @@ #include "iree/base/api.h" #include "iree/hal/api.h" -#ifdef __cplusplus -extern "C" { -#endif // __cplusplus - struct iree_hal_xrt_lite_device_options_t {}; IREE_API_EXPORT void iree_hal_xrt_lite_device_options_initialize( @@ -41,8 +37,4 @@ IREE_API_EXPORT iree_status_t iree_hal_xrt_lite_device_create( const struct iree_hal_xrt_lite_device_options_t* options, iree_allocator_t host_allocator, iree_hal_device_t** out_device); -#ifdef __cplusplus -} // extern "C" -#endif // __cplusplus - #endif // IREE_AMD_AIE_DRIVER_XRT_LITE_API_H_ diff --git a/runtime/src/iree-amd-aie/driver/xrt-lite/buffer.cc b/runtime/src/iree-amd-aie/driver/xrt-lite/buffer.cc index c9fd06bd7..01c94659d 100644 --- a/runtime/src/iree-amd-aie/driver/xrt-lite/buffer.cc +++ b/runtime/src/iree-amd-aie/driver/xrt-lite/buffer.cc @@ -19,9 +19,9 @@ struct iree_hal_xrt_lite_buffer { iree_hal_buffer_release_callback_t release_callback; }; -iree_status_t invalidate_range(iree_hal_buffer_t* base_buffer, - iree_device_size_t local_byte_offset, - iree_device_size_t local_byte_length) { +iree_status_t iree_hal_xrt_lite_buffer_invalidate_range( + iree_hal_buffer_t* base_buffer, iree_device_size_t local_byte_offset, + iree_device_size_t local_byte_length) { iree_hal_xrt_lite_buffer* buffer = reinterpret_cast(base_buffer); if (IREE_UNLIKELY(!buffer->bo)) { @@ -34,12 +34,11 @@ iree_status_t invalidate_range(iree_hal_buffer_t* base_buffer, return iree_ok_status(); } -iree_status_t map_range(iree_hal_buffer_t* base_buffer, - iree_hal_mapping_mode_t mapping_mode, - iree_hal_memory_access_t memory_access, - iree_device_size_t local_byte_offset, - iree_device_size_t local_byte_length, - iree_hal_buffer_mapping_t* mapping) { +iree_status_t iree_hal_xrt_lite_buffer_map_range( + iree_hal_buffer_t* base_buffer, iree_hal_mapping_mode_t mapping_mode, + iree_hal_memory_access_t memory_access, + iree_device_size_t local_byte_offset, iree_device_size_t local_byte_length, + iree_hal_buffer_mapping_t* mapping) { iree_hal_xrt_lite_buffer* buffer = reinterpret_cast(base_buffer); IREE_RETURN_IF_ERROR(iree_hal_buffer_validate_memory_type( @@ -57,8 +56,8 @@ iree_status_t map_range(iree_hal_buffer_t* base_buffer, // Should be guaranteed by previous checks. IREE_ASSERT(host_ptr != nullptr); uint8_t* data_ptr = reinterpret_cast(host_ptr) + local_byte_offset; - iree_status_t status = - invalidate_range(base_buffer, local_byte_offset, local_byte_length); + iree_status_t status = iree_hal_xrt_lite_buffer_invalidate_range( + base_buffer, local_byte_offset, local_byte_length); // If we mapped for discard, scribble over the bytes. This is not a mandated // behavior but it will make debugging issues easier. Alternatively for heap // buffers we could reallocate them such that ASAN yells, but that would @@ -72,9 +71,9 @@ iree_status_t map_range(iree_hal_buffer_t* base_buffer, return status; } -iree_status_t flush_range(iree_hal_buffer_t* base_buffer, - iree_device_size_t local_byte_offset, - iree_device_size_t local_byte_length) { +iree_status_t iree_hal_xrt_lite_buffer_flush_range( + iree_hal_buffer_t* base_buffer, iree_device_size_t local_byte_offset, + iree_device_size_t local_byte_length) { iree_hal_xrt_lite_buffer* buffer = reinterpret_cast(base_buffer); if (IREE_UNLIKELY(!buffer->bo)) { @@ -87,11 +86,11 @@ iree_status_t flush_range(iree_hal_buffer_t* base_buffer, return iree_ok_status(); } -iree_status_t unmap_range(iree_hal_buffer_t* base_buffer, - iree_device_size_t local_byte_offset, - iree_device_size_t local_byte_length, - iree_hal_buffer_mapping_t* mapping) { - return flush_range(base_buffer, local_byte_offset, local_byte_length); +iree_status_t iree_hal_xrt_lite_buffer_unmap_range( + iree_hal_buffer_t* base_buffer, iree_device_size_t local_byte_offset, + iree_device_size_t local_byte_length, iree_hal_buffer_mapping_t* mapping) { + return iree_hal_xrt_lite_buffer_flush_range(base_buffer, local_byte_offset, + local_byte_length); } iree_status_t iree_hal_xrt_lite_buffer_wrap( @@ -148,9 +147,9 @@ namespace { const iree_hal_buffer_vtable_t iree_hal_xrt_lite_buffer_vtable = { .recycle = iree_hal_buffer_recycle, .destroy = iree_hal_xrt_lite_buffer_destroy, - .map_range = map_range, - .unmap_range = unmap_range, - .invalidate_range = invalidate_range, - .flush_range = flush_range, + .map_range = iree_hal_xrt_lite_buffer_map_range, + .unmap_range = iree_hal_xrt_lite_buffer_unmap_range, + .invalidate_range = iree_hal_xrt_lite_buffer_invalidate_range, + .flush_range = iree_hal_xrt_lite_buffer_flush_range, }; -} \ No newline at end of file +} diff --git a/runtime/src/iree-amd-aie/driver/xrt-lite/cts/executable_cache_test.mlir b/runtime/src/iree-amd-aie/driver/xrt-lite/cts/executable_cache_test.mlir index ca306e1e5..dedbcab6b 100644 --- a/runtime/src/iree-amd-aie/driver/xrt-lite/cts/executable_cache_test.mlir +++ b/runtime/src/iree-amd-aie/driver/xrt-lite/cts/executable_cache_test.mlir @@ -30,4 +30,4 @@ hal.executable.source public @amdaie_fb { return } } -} \ No newline at end of file +} diff --git a/runtime/src/iree-amd-aie/driver/xrt-lite/device.cc b/runtime/src/iree-amd-aie/driver/xrt-lite/device.cc index 70da3dbdd..69c1181a1 100644 --- a/runtime/src/iree-amd-aie/driver/xrt-lite/device.cc +++ b/runtime/src/iree-amd-aie/driver/xrt-lite/device.cc @@ -50,7 +50,7 @@ struct iree_hal_xrt_lite_device { } }; -iree_status_t create_executable_cache( +iree_status_t iree_hal_xrt_lite_device_create_executable_cache( iree_hal_device_t* base_value, iree_string_view_t identifier, iree_loop_t loop, iree_hal_executable_cache_t** out_executable_cache) { iree_hal_xrt_lite_device* device = @@ -60,7 +60,7 @@ iree_status_t create_executable_cache( out_executable_cache); } -iree_status_t create_command_buffer( +iree_status_t iree_hal_xrt_lite_device_create_command_buffer( iree_hal_device_t* base_value, iree_hal_command_buffer_mode_t mode, iree_hal_command_category_t command_categories, iree_hal_queue_affinity_t queue_affinity, iree_host_size_t binding_capacity, @@ -76,17 +76,16 @@ iree_status_t create_command_buffer( &device->block_pool, device->host_allocator_, out_command_buffer); } -iree_status_t create_semaphore(iree_hal_device_t* base_value, - uint64_t initial_value, - iree_hal_semaphore_flags_t flags, - iree_hal_semaphore_t** out_semaphore) { +iree_status_t iree_hal_xrt_lite_device_create_semaphore( + iree_hal_device_t* base_value, uint64_t initial_value, + iree_hal_semaphore_flags_t flags, iree_hal_semaphore_t** out_semaphore) { iree_hal_xrt_lite_device* device = reinterpret_cast(base_value); return iree_hal_xrt_lite_semaphore_create(device->host_allocator_, initial_value, out_semaphore); } -iree_status_t queue_execute( +iree_status_t iree_hal_xrt_lite_device_queue_execute( iree_hal_device_t* base_value, iree_hal_queue_affinity_t queue_affinity, const iree_hal_semaphore_list_t wait_semaphore_list, const iree_hal_semaphore_list_t signal_semaphore_list, @@ -118,8 +117,8 @@ iree_status_t queue_execute( return iree_ok_status(); } -void replace_device_allocator(iree_hal_device_t* base_value, - iree_hal_allocator_t* new_allocator) { +void iree_hal_xrt_lite_device_replace_device_allocator( + iree_hal_device_t* base_value, iree_hal_allocator_t* new_allocator) { iree_hal_allocator_retain(new_allocator); iree_hal_xrt_lite_device* device = reinterpret_cast(base_value); @@ -127,9 +126,10 @@ void replace_device_allocator(iree_hal_device_t* base_value, device->device_allocator_ = new_allocator; } -iree_status_t query_i64(iree_hal_device_t* base_value, - iree_string_view_t category, iree_string_view_t key, - int64_t* out_value) { +iree_status_t iree_hal_xrt_lite_device_query_i64(iree_hal_device_t* base_value, + iree_string_view_t category, + iree_string_view_t key, + int64_t* out_value) { *out_value = 0; iree_hal_xrt_lite_device* device = reinterpret_cast(base_value); @@ -146,7 +146,7 @@ iree_status_t query_i64(iree_hal_device_t* base_value, return iree_make_status(IREE_STATUS_UNIMPLEMENTED, "unsupported query"); } -iree_status_t queue_alloca( +iree_status_t iree_hal_xrt_lite_device_queue_alloca( iree_hal_device_t* base_value, iree_hal_queue_affinity_t queue_affinity, const iree_hal_semaphore_list_t wait_semaphore_list, const iree_hal_semaphore_list_t signal_semaphore_list, @@ -163,13 +163,13 @@ iree_status_t queue_alloca( return iree_ok_status(); } -iree_string_view_t id(iree_hal_device_t* base_value) { +iree_string_view_t iree_hal_xrt_lite_device_id(iree_hal_device_t* base_value) { iree_hal_xrt_lite_device* device = reinterpret_cast(base_value); return device->identifier; } -void destroy(iree_hal_device_t* base_value) { +void iree_hal_xrt_lite_device_destroy(iree_hal_device_t* base_value) { iree_hal_xrt_lite_device* device = reinterpret_cast(base_value); IREE_TRACE_ZONE_BEGIN(z0); @@ -181,12 +181,14 @@ void destroy(iree_hal_device_t* base_value) { IREE_TRACE_ZONE_END(z0); }; -iree_allocator_t host_allocator(iree_hal_device_t* base_value) { +iree_allocator_t iree_hal_xrt_lite_device_host_allocator( + iree_hal_device_t* base_value) { iree_hal_xrt_lite_device* device = reinterpret_cast(base_value); return device->host_allocator_; } -iree_hal_allocator_t* device_allocator(iree_hal_device_t* base_value) { +iree_hal_allocator_t* iree_hal_xrt_lite_device_device_allocator( + iree_hal_device_t* base_value) { iree_hal_xrt_lite_device* device = reinterpret_cast(base_value); return device->device_allocator_; @@ -224,17 +226,18 @@ iree_status_t iree_hal_xrt_lite_device_create( namespace { const iree_hal_device_vtable_t iree_hal_xrt_lite_device_vtable = { - .destroy = destroy, - .id = id, - .host_allocator = host_allocator, - .device_allocator = device_allocator, - .replace_device_allocator = replace_device_allocator, - .query_i64 = query_i64, - .create_command_buffer = create_command_buffer, - .create_executable_cache = create_executable_cache, - .create_semaphore = create_semaphore, - .queue_alloca = queue_alloca, - .queue_execute = queue_execute, + .destroy = iree_hal_xrt_lite_device_destroy, + .id = iree_hal_xrt_lite_device_id, + .host_allocator = iree_hal_xrt_lite_device_host_allocator, + .device_allocator = iree_hal_xrt_lite_device_device_allocator, + .replace_device_allocator = + iree_hal_xrt_lite_device_replace_device_allocator, + .query_i64 = iree_hal_xrt_lite_device_query_i64, + .create_command_buffer = iree_hal_xrt_lite_device_create_command_buffer, + .create_executable_cache = iree_hal_xrt_lite_device_create_executable_cache, + .create_semaphore = iree_hal_xrt_lite_device_create_semaphore, + .queue_alloca = iree_hal_xrt_lite_device_queue_alloca, + .queue_execute = iree_hal_xrt_lite_device_queue_execute, .profiling_begin = unimplemented_ok_status, .profiling_flush = unimplemented_ok_status, .profiling_end = unimplemented_ok_status, diff --git a/runtime/src/iree-amd-aie/driver/xrt-lite/direct_command_buffer.cc b/runtime/src/iree-amd-aie/driver/xrt-lite/direct_command_buffer.cc index d3404c5f6..c63188b4e 100644 --- a/runtime/src/iree-amd-aie/driver/xrt-lite/direct_command_buffer.cc +++ b/runtime/src/iree-amd-aie/driver/xrt-lite/direct_command_buffer.cc @@ -1,4 +1,4 @@ -// Copyright 2023 The IREE Authors +// Copyright 2024 The IREE Authors // // Licensed under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/runtime/src/iree-amd-aie/driver/xrt-lite/direct_command_buffer.h b/runtime/src/iree-amd-aie/driver/xrt-lite/direct_command_buffer.h index 705cf0909..1612c9509 100644 --- a/runtime/src/iree-amd-aie/driver/xrt-lite/direct_command_buffer.h +++ b/runtime/src/iree-amd-aie/driver/xrt-lite/direct_command_buffer.h @@ -1,4 +1,4 @@ -// Copyright 2023 The IREE Authors +// Copyright 2024 The IREE Authors // // Licensed under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -11,11 +11,7 @@ #include "iree/base/internal/arena.h" #include "iree/hal/api.h" -#ifdef __cplusplus -extern "C" { -#endif // __cplusplus - -// |out_command_buffer| must be released by the caller (see +// `out_command_buffer` must be released by the caller (see // iree_hal_command_buffer_release). iree_status_t iree_hal_xrt_lite_direct_command_buffer_create( shim_xdna::device* shim_device, iree_hal_allocator_t* device_allocator, @@ -25,8 +21,4 @@ iree_status_t iree_hal_xrt_lite_direct_command_buffer_create( iree_allocator_t host_allocator, iree_hal_command_buffer_t** out_command_buffer); -#ifdef __cplusplus -} // extern "C" -#endif // __cplusplus - #endif // IREE_AMD_AIE_DRIVER_XRT_LITE_XRT_LITE_COMMAND_BUFFER_H_ diff --git a/runtime/src/iree-amd-aie/driver/xrt-lite/driver.cc b/runtime/src/iree-amd-aie/driver/xrt-lite/driver.cc index 743834034..19d4b0e8f 100644 --- a/runtime/src/iree-amd-aie/driver/xrt-lite/driver.cc +++ b/runtime/src/iree-amd-aie/driver/xrt-lite/driver.cc @@ -7,6 +7,8 @@ #include "iree-amd-aie/driver/xrt-lite/api.h" #include "util.h" +#define IREE_HAL_XRT_LITE_DEVICE_ID_DEFAULT 0 + typedef struct iree_hal_xrt_lite_driver_t { iree_hal_resource_t resource; iree_allocator_t host_allocator; @@ -69,8 +71,6 @@ static void iree_hal_xrt_lite_driver_destroy(iree_hal_driver_t* base_driver) { IREE_TRACE_ZONE_END(z0); } -#define IREE_HAL_XRT_LITE_DEVICE_ID_DEFAULT 0 - static iree_status_t iree_hal_xrt_lite_driver_query_available_devices( iree_hal_driver_t* base_driver, iree_allocator_t host_allocator, iree_host_size_t* out_device_info_count, diff --git a/runtime/src/iree-amd-aie/driver/xrt-lite/executable.cc b/runtime/src/iree-amd-aie/driver/xrt-lite/executable.cc index d55e3f007..ac16174a6 100644 --- a/runtime/src/iree-amd-aie/driver/xrt-lite/executable.cc +++ b/runtime/src/iree-amd-aie/driver/xrt-lite/executable.cc @@ -1,4 +1,4 @@ -// Copyright 2023 The IREE Authors +// Copyright 2024 The IREE Authors // // Licensed under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -25,12 +25,6 @@ iree_hal_xrt_lite_native_executable_t* iree_hal_xrt_lite_native_executable_cast( return reinterpret_cast(base_value); } -// Verifies the structure of the flatbuffer so that we can avoid doing so during -// runtime. -// -// There are still some conditions we must be aware of (such as omitted names on -// functions with internal linkage), however we shouldn't need to bounds check -// anything within the flatbuffer after this succeeds. static iree_status_t iree_amd_aie_hal_xrt_lite_native_executable_flatbuffer_verify( iree_const_byte_span_t flatbuffer_data) { @@ -41,9 +35,6 @@ iree_amd_aie_hal_xrt_lite_native_executable_flatbuffer_verify( flatbuffer_data.data_length); } - // Run flatcc generated verification. This ensures all pointers are in-bounds - // and that we can safely walk the file, but not that the actual contents of - // the flatbuffer meet our expectations. int verify_ret = iree_amd_aie_hal_xrt_lite_ExecutableDef_verify_as_root( flatbuffer_data.data, flatbuffer_data.data_length); if (verify_ret != flatcc_verify_ok) { @@ -123,10 +114,6 @@ iree_status_t iree_hal_xrt_lite_native_executable_create( iree_host_size_t entry_point_count = flatbuffers_string_vec_len(entry_points_vec); - // Calculate the total number of characters across all entry point names. This - // is only required when tracing so that we can store copies of the names as - // the flatbuffer storing the strings may be released while the executable is - // still live. iree_host_size_t total_entry_point_name_chars = 0; IREE_TRACE({ for (iree_host_size_t entry_ordinal = 0; entry_ordinal < entry_point_count; @@ -179,7 +166,6 @@ iree_status_t iree_hal_xrt_lite_native_executable_create( asm_inst, asm_inst + flatbuffers_uint32_vec_len(asm_inst)); params->asm_inst = asmVector; - // Stash the entry point name in the string table for use when tracing. IREE_TRACE({ memcpy(string_table_buffer, params->kernel_name.data(), params->kernel_name.size()); diff --git a/runtime/src/iree-amd-aie/driver/xrt-lite/executable.h b/runtime/src/iree-amd-aie/driver/xrt-lite/executable.h index 686dda7bf..c85d72d54 100644 --- a/runtime/src/iree-amd-aie/driver/xrt-lite/executable.h +++ b/runtime/src/iree-amd-aie/driver/xrt-lite/executable.h @@ -1,4 +1,4 @@ -// Copyright 2023 The IREE Authors +// Copyright 2024 The IREE Authors // // Licensed under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -17,11 +17,6 @@ #include "iree/base/tracing.h" #include "iree/hal/api.h" -#ifdef __cplusplus -extern "C" { -#endif // __cplusplus - -// Object and launch parameters for a compute kernel. struct iree_hal_xrt_lite_kernel_params_t { std::vector pdi; std::vector asm_inst; @@ -42,15 +37,11 @@ struct iree_hal_xrt_lite_native_executable_t { iree_hal_xrt_lite_native_executable_t* iree_hal_xrt_lite_native_executable_cast( iree_hal_executable_t* base_value); -// |out_executable| must be released by the caller (see +// `out_executable` must be released by the caller (see // iree_hal_executable_release). iree_status_t iree_hal_xrt_lite_native_executable_create( shim_xdna::device* shim_device, const iree_hal_executable_params_t* executable_params, iree_allocator_t host_allocator, iree_hal_executable_t** out_executable); -#ifdef __cplusplus -} // extern "C" -#endif // __cplusplus - #endif // IREE_AMD_AIE_DRIVER_XRT_LITE_NATIVE_EXECUTABLE_H_ diff --git a/runtime/src/iree-amd-aie/driver/xrt-lite/nop_executable_cache.cc b/runtime/src/iree-amd-aie/driver/xrt-lite/nop_executable_cache.cc index 8d0be5ad4..963f6ff88 100644 --- a/runtime/src/iree-amd-aie/driver/xrt-lite/nop_executable_cache.cc +++ b/runtime/src/iree-amd-aie/driver/xrt-lite/nop_executable_cache.cc @@ -1,4 +1,4 @@ -// Copyright 2023 The IREE Authors +// Copyright 2024 The IREE Authors // // Licensed under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/runtime/src/iree-amd-aie/driver/xrt-lite/nop_executable_cache.h b/runtime/src/iree-amd-aie/driver/xrt-lite/nop_executable_cache.h index 45153266b..ed4a998b1 100644 --- a/runtime/src/iree-amd-aie/driver/xrt-lite/nop_executable_cache.h +++ b/runtime/src/iree-amd-aie/driver/xrt-lite/nop_executable_cache.h @@ -1,4 +1,4 @@ -// Copyright 2023 The IREE Authors +// Copyright 2024 The IREE Authors // // Licensed under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -11,23 +11,11 @@ #include "iree/base/api.h" #include "iree/hal/api.h" -#ifdef __cplusplus -extern "C" { -#endif // __cplusplus - -// Creates a no-op executable cache that does not cache at all. -// This is useful to isolate pipeline caching behavior and verify compilation -// behavior. -// -// |out_executable_cache| must be released by the caller (see +// `out_executable_cache` must be released by the caller (see // iree_hal_executable_cache_release). iree_status_t iree_hal_xrt_lite_nop_executable_cache_create( shim_xdna::device* shim_device, iree_string_view_t identifier, iree_allocator_t host_allocator, iree_hal_executable_cache_t** out_executable_cache); -#ifdef __cplusplus -} // extern "C" -#endif // __cplusplus - #endif // IREE_AMD_AIE_DRIVER_XRT_LITE_NOP_EXECUTABLE_CACHE_H_ diff --git a/runtime/src/iree-amd-aie/driver/xrt-lite/nop_semaphore.h b/runtime/src/iree-amd-aie/driver/xrt-lite/nop_semaphore.h index 835a049db..f7c5615e9 100644 --- a/runtime/src/iree-amd-aie/driver/xrt-lite/nop_semaphore.h +++ b/runtime/src/iree-amd-aie/driver/xrt-lite/nop_semaphore.h @@ -12,16 +12,8 @@ #include "iree/base/api.h" #include "iree/hal/api.h" -#ifdef __cplusplus -extern "C" { -#endif // __cplusplus - iree_status_t iree_hal_xrt_lite_semaphore_create( iree_allocator_t host_allocator, uint64_t initial_value, iree_hal_semaphore_t** out_semaphore); -#ifdef __cplusplus -} // extern "C" -#endif // __cplusplus - #endif // IREE_AMD_AIE_DRIVER_XRT_LITE_NOP_SEMAPHORE_H_ diff --git a/runtime/src/iree-amd-aie/driver/xrt-lite/shim/CMakeLists.txt b/runtime/src/iree-amd-aie/driver/xrt-lite/shim/CMakeLists.txt index ac1522216..c30c40e27 100644 --- a/runtime/src/iree-amd-aie/driver/xrt-lite/shim/CMakeLists.txt +++ b/runtime/src/iree-amd-aie/driver/xrt-lite/shim/CMakeLists.txt @@ -7,4 +7,4 @@ if(UNIX) add_subdirectory(linux) -endif() \ No newline at end of file +endif() diff --git a/runtime/src/iree-amd-aie/driver/xrt-lite/shim/linux/CMakeLists.txt b/runtime/src/iree-amd-aie/driver/xrt-lite/shim/linux/CMakeLists.txt index afe3d583a..067d32f4a 100644 --- a/runtime/src/iree-amd-aie/driver/xrt-lite/shim/linux/CMakeLists.txt +++ b/runtime/src/iree-amd-aie/driver/xrt-lite/shim/linux/CMakeLists.txt @@ -5,4 +5,4 @@ # See https://llvm.org/LICENSE.txt for license information. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -add_subdirectory(kmq) \ No newline at end of file +add_subdirectory(kmq)