Renaming legacy_library_loader -> system_library_loader. (#6778)
diff --git a/iree/hal/dylib/registration/BUILD b/iree/hal/dylib/registration/BUILD index 3c2e252..3c0dce7 100644 --- a/iree/hal/dylib/registration/BUILD +++ b/iree/hal/dylib/registration/BUILD
@@ -40,7 +40,7 @@ "//iree/hal/local", "//iree/hal/local:task_driver", "//iree/hal/local/loaders:embedded_library_loader", - "//iree/hal/local/loaders:legacy_library_loader", + "//iree/hal/local/loaders:system_library_loader", "//iree/task:api", ], ) @@ -57,6 +57,6 @@ "//iree/hal", "//iree/hal/local", "//iree/hal/local:sync_driver", - "//iree/hal/local/loaders:legacy_library_loader", + "//iree/hal/local/loaders:system_library_loader", ], )
diff --git a/iree/hal/dylib/registration/CMakeLists.txt b/iree/hal/dylib/registration/CMakeLists.txt index 83aface..03e3ea5 100644 --- a/iree/hal/dylib/registration/CMakeLists.txt +++ b/iree/hal/dylib/registration/CMakeLists.txt
@@ -32,7 +32,7 @@ iree::hal iree::hal::local iree::hal::local::loaders::embedded_library_loader - iree::hal::local::loaders::legacy_library_loader + iree::hal::local::loaders::system_library_loader iree::hal::local::task_driver iree::task::api DEFINES @@ -51,7 +51,7 @@ iree::base iree::hal iree::hal::local - iree::hal::local::loaders::legacy_library_loader + iree::hal::local::loaders::system_library_loader iree::hal::local::sync_driver DEFINES "IREE_HAL_HAVE_DYLIB_SYNC_DRIVER_MODULE=1"
diff --git a/iree/hal/dylib/registration/driver_module.c b/iree/hal/dylib/registration/driver_module.c index 3f17988..16fe55f 100644 --- a/iree/hal/dylib/registration/driver_module.c +++ b/iree/hal/dylib/registration/driver_module.c
@@ -13,7 +13,7 @@ #include "iree/base/internal/flags.h" #include "iree/hal/local/executable_loader.h" #include "iree/hal/local/loaders/embedded_library_loader.h" -#include "iree/hal/local/loaders/legacy_library_loader.h" +#include "iree/hal/local/loaders/system_library_loader.h" #include "iree/hal/local/task_device.h" #include "iree/hal/local/task_driver.h" #include "iree/task/api.h" @@ -66,7 +66,7 @@ &loaders[loader_count++]); } if (iree_status_is_ok(status)) { - status = iree_hal_legacy_library_loader_create( + status = iree_hal_system_library_loader_create( iree_hal_executable_import_provider_null(), allocator, &loaders[loader_count++]); }
diff --git a/iree/hal/dylib/registration/driver_module_sync.c b/iree/hal/dylib/registration/driver_module_sync.c index 0ac89c3..414a708 100644 --- a/iree/hal/dylib/registration/driver_module_sync.c +++ b/iree/hal/dylib/registration/driver_module_sync.c
@@ -11,7 +11,7 @@ #include "iree/base/api.h" #include "iree/hal/local/executable_loader.h" -#include "iree/hal/local/loaders/legacy_library_loader.h" +#include "iree/hal/local/loaders/system_library_loader.h" #include "iree/hal/local/sync_device.h" #include "iree/hal/local/sync_driver.h" @@ -49,7 +49,7 @@ iree_hal_sync_device_params_initialize(&default_params); iree_hal_executable_loader_t* dylib_loader = NULL; - iree_status_t status = iree_hal_legacy_library_loader_create( + iree_status_t status = iree_hal_system_library_loader_create( iree_hal_executable_import_provider_null(), allocator, &dylib_loader); iree_hal_executable_loader_t* loaders[1] = {dylib_loader};
diff --git a/iree/hal/local/loaders/BUILD b/iree/hal/local/loaders/BUILD index 28b9cb4..3d54ae9 100644 --- a/iree/hal/local/loaders/BUILD +++ b/iree/hal/local/loaders/BUILD
@@ -34,26 +34,6 @@ ) cc_library( - name = "legacy_library_loader", - srcs = ["legacy_library_loader.c"], - hdrs = ["legacy_library_loader.h"], - defines = [ - "IREE_HAL_HAVE_LEGACY_LIBRARY_LOADER=1", - ], - deps = [ - "//iree/base", - "//iree/base:core_headers", - "//iree/base:tracing", - "//iree/base/internal:dynamic_library", - "//iree/base/internal:flatcc", - "//iree/hal", - "//iree/hal/local", - "//iree/hal/local:executable_library", - "//iree/schemas:dylib_executable_def_c_fbs", - ], -) - -cc_library( name = "static_library_loader", srcs = ["static_library_loader.c"], hdrs = ["static_library_loader.h"], @@ -69,6 +49,26 @@ ], ) +cc_library( + name = "system_library_loader", + srcs = ["system_library_loader.c"], + hdrs = ["system_library_loader.h"], + defines = [ + "IREE_HAL_HAVE_SYSTEM_LIBRARY_LOADER=1", + ], + deps = [ + "//iree/base", + "//iree/base:core_headers", + "//iree/base:tracing", + "//iree/base/internal:dynamic_library", + "//iree/base/internal:flatcc", + "//iree/hal", + "//iree/hal/local", + "//iree/hal/local:executable_library", + "//iree/schemas:dylib_executable_def_c_fbs", + ], +) + iree_cmake_extra_content( content = """ if(${IREE_HAL_DRIVER_VMVX})
diff --git a/iree/hal/local/loaders/CMakeLists.txt b/iree/hal/local/loaders/CMakeLists.txt index c55fcee..fe5dd54 100644 --- a/iree/hal/local/loaders/CMakeLists.txt +++ b/iree/hal/local/loaders/CMakeLists.txt
@@ -32,28 +32,6 @@ iree_cc_library( NAME - legacy_library_loader - HDRS - "legacy_library_loader.h" - SRCS - "legacy_library_loader.c" - DEPS - iree::base - iree::base::core_headers - iree::base::internal::dynamic_library - iree::base::internal::flatcc - iree::base::tracing - iree::hal - iree::hal::local - iree::hal::local::executable_library - iree::schemas::dylib_executable_def_c_fbs - DEFINES - "IREE_HAL_HAVE_LEGACY_LIBRARY_LOADER=1" - PUBLIC -) - -iree_cc_library( - NAME static_library_loader HDRS "static_library_loader.h" @@ -70,6 +48,28 @@ PUBLIC ) +iree_cc_library( + NAME + system_library_loader + HDRS + "system_library_loader.h" + SRCS + "system_library_loader.c" + DEPS + iree::base + iree::base::core_headers + iree::base::internal::dynamic_library + iree::base::internal::flatcc + iree::base::tracing + iree::hal + iree::hal::local + iree::hal::local::executable_library + iree::schemas::dylib_executable_def_c_fbs + DEFINES + "IREE_HAL_HAVE_SYSTEM_LIBRARY_LOADER=1" + PUBLIC +) + if(${IREE_HAL_DRIVER_VMVX}) iree_cc_library(
diff --git a/iree/hal/local/loaders/legacy_library_loader.c b/iree/hal/local/loaders/system_library_loader.c similarity index 85% rename from iree/hal/local/loaders/legacy_library_loader.c rename to iree/hal/local/loaders/system_library_loader.c index fa9fa1f..49f7337 100644 --- a/iree/hal/local/loaders/legacy_library_loader.c +++ b/iree/hal/local/loaders/system_library_loader.c
@@ -4,7 +4,7 @@ // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -#include "iree/hal/local/loaders/legacy_library_loader.h" +#include "iree/hal/local/loaders/system_library_loader.h" #include <stdbool.h> #include <stddef.h> @@ -61,10 +61,10 @@ } //===----------------------------------------------------------------------===// -// iree_hal_legacy_executable_t +// iree_hal_system_executable_t //===----------------------------------------------------------------------===// -typedef struct iree_hal_legacy_executable_t { +typedef struct iree_hal_system_executable_t { iree_hal_local_executable_t base; // Flatbuffer definition referencing the executable memory. @@ -83,13 +83,13 @@ } library; iree_hal_local_executable_layout_t* layouts[]; -} iree_hal_legacy_executable_t; +} iree_hal_system_executable_t; extern const iree_hal_local_executable_vtable_t - iree_hal_legacy_executable_vtable; + iree_hal_system_executable_vtable; -static iree_status_t iree_hal_legacy_executable_extract_and_load( - iree_hal_legacy_executable_t* executable, iree_allocator_t host_allocator) { +static iree_status_t iree_hal_system_executable_extract_and_load( + iree_hal_system_executable_t* executable, iree_allocator_t host_allocator) { flatbuffers_uint8_vec_t embedded_library_vec = iree_DyLibExecutableDef_library_embedded_get(executable->def); IREE_RETURN_IF_ERROR(iree_dynamic_library_load_from_memory( @@ -114,8 +114,8 @@ return iree_ok_status(); } -static iree_status_t iree_hal_legacy_executable_query_library( - iree_hal_legacy_executable_t* executable) { +static iree_status_t iree_hal_system_executable_query_library( + iree_hal_system_executable_t* executable) { // Get the exported symbol used to get the library metadata. iree_hal_executable_library_query_fn_t query_fn = NULL; IREE_RETURN_IF_ERROR(iree_dynamic_library_lookup_symbol( @@ -170,15 +170,15 @@ return iree_ok_status(); } -static int iree_hal_legacy_executable_import_thunk_v0( +static int iree_hal_system_executable_import_thunk_v0( iree_hal_executable_import_v0_t fn_ptr, void* import_params) { return fn_ptr(import_params); } // Resolves all of the imports declared by the executable using the given // |import_provider|. -static iree_status_t iree_hal_legacy_executable_resolve_imports( - iree_hal_legacy_executable_t* executable, +static iree_status_t iree_hal_system_executable_resolve_imports( + iree_hal_system_executable_t* executable, const iree_hal_executable_import_provider_t import_provider) { const iree_hal_executable_import_table_v0_t* import_table = &executable->library.v0->imports; @@ -186,7 +186,7 @@ IREE_TRACE_ZONE_BEGIN(z0); // Pass all imports right through. - executable->base.import_thunk = iree_hal_legacy_executable_import_thunk_v0; + executable->base.import_thunk = iree_hal_system_executable_import_thunk_v0; // Allocate storage for the imports. IREE_RETURN_AND_END_ZONE_IF_ERROR( @@ -211,7 +211,7 @@ return iree_ok_status(); } -static iree_status_t iree_hal_legacy_executable_create( +static iree_status_t iree_hal_system_executable_create( iree_DyLibExecutableDef_table_t executable_def, iree_host_size_t executable_layout_count, iree_hal_executable_layout_t* const* executable_layouts, @@ -223,7 +223,7 @@ *out_executable = NULL; IREE_TRACE_ZONE_BEGIN(z0); - iree_hal_legacy_executable_t* executable = NULL; + iree_hal_system_executable_t* executable = NULL; iree_host_size_t total_size = sizeof(*executable) + executable_layout_count * sizeof(*executable->layouts); @@ -231,7 +231,7 @@ iree_allocator_malloc(host_allocator, total_size, (void**)&executable); if (iree_status_is_ok(status)) { iree_hal_local_executable_initialize( - &iree_hal_legacy_executable_vtable, executable_layout_count, + &iree_hal_system_executable_vtable, executable_layout_count, executable_layouts, &executable->layouts[0], host_allocator, &executable->base); executable->def = executable_def; @@ -242,16 +242,16 @@ // This is bad, but ehh all this is getting deleted soon and hopefully we // can avoid ever touching the disk at all. status = - iree_hal_legacy_executable_extract_and_load(executable, host_allocator); + iree_hal_system_executable_extract_and_load(executable, host_allocator); } if (iree_status_is_ok(status)) { // Query metadata and get the entry point function pointers. - status = iree_hal_legacy_executable_query_library(executable); + status = iree_hal_system_executable_query_library(executable); } if (iree_status_is_ok(status)) { // Resolve imports, if any. status = - iree_hal_legacy_executable_resolve_imports(executable, import_provider); + iree_hal_system_executable_resolve_imports(executable, import_provider); } if (iree_status_is_ok(status)) { // Check to make sure that the entry point count matches the layouts @@ -274,10 +274,10 @@ return status; } -static void iree_hal_legacy_executable_destroy( +static void iree_hal_system_executable_destroy( iree_hal_executable_t* base_executable) { - iree_hal_legacy_executable_t* executable = - (iree_hal_legacy_executable_t*)base_executable; + iree_hal_system_executable_t* executable = + (iree_hal_system_executable_t*)base_executable; iree_allocator_t host_allocator = executable->base.host_allocator; IREE_TRACE_ZONE_BEGIN(z0); @@ -290,12 +290,12 @@ IREE_TRACE_ZONE_END(z0); } -static iree_status_t iree_hal_legacy_executable_issue_call( +static iree_status_t iree_hal_system_executable_issue_call( iree_hal_local_executable_t* base_executable, iree_host_size_t ordinal, const iree_hal_executable_dispatch_state_v0_t* dispatch_state, const iree_hal_vec3_t* workgroup_id, iree_byte_span_t local_memory) { - iree_hal_legacy_executable_t* executable = - (iree_hal_legacy_executable_t*)base_executable; + iree_hal_system_executable_t* executable = + (iree_hal_system_executable_t*)base_executable; const iree_hal_executable_library_v0_t* library = executable->library.v0; if (IREE_UNLIKELY(ordinal >= library->exports.count)) { @@ -334,27 +334,27 @@ ret); } -const iree_hal_local_executable_vtable_t iree_hal_legacy_executable_vtable = { - /*.base=*/ - { - /*.destroy=*/iree_hal_legacy_executable_destroy, - }, - /*.issue_call=*/iree_hal_legacy_executable_issue_call, +const iree_hal_local_executable_vtable_t iree_hal_system_executable_vtable = { + .base = + { + .destroy = iree_hal_system_executable_destroy, + }, + .issue_call = iree_hal_system_executable_issue_call, }; //===----------------------------------------------------------------------===// -// iree_hal_legacy_library_loader_t +// iree_hal_system_library_loader_t //===----------------------------------------------------------------------===// -typedef struct iree_hal_legacy_library_loader_t { +typedef struct iree_hal_system_library_loader_t { iree_hal_executable_loader_t base; iree_allocator_t host_allocator; -} iree_hal_legacy_library_loader_t; +} iree_hal_system_library_loader_t; extern const iree_hal_executable_loader_vtable_t - iree_hal_legacy_library_loader_vtable; + iree_hal_system_library_loader_vtable; -iree_status_t iree_hal_legacy_library_loader_create( +iree_status_t iree_hal_system_library_loader_create( iree_hal_executable_import_provider_t import_provider, iree_allocator_t host_allocator, iree_hal_executable_loader_t** out_executable_loader) { @@ -362,12 +362,12 @@ *out_executable_loader = NULL; IREE_TRACE_ZONE_BEGIN(z0); - iree_hal_legacy_library_loader_t* executable_loader = NULL; + iree_hal_system_library_loader_t* executable_loader = NULL; iree_status_t status = iree_allocator_malloc( host_allocator, sizeof(*executable_loader), (void**)&executable_loader); if (iree_status_is_ok(status)) { iree_hal_executable_loader_initialize( - &iree_hal_legacy_library_loader_vtable, import_provider, + &iree_hal_system_library_loader_vtable, import_provider, &executable_loader->base); executable_loader->host_allocator = host_allocator; *out_executable_loader = (iree_hal_executable_loader_t*)executable_loader; @@ -377,10 +377,10 @@ return status; } -static void iree_hal_legacy_library_loader_destroy( +static void iree_hal_system_library_loader_destroy( iree_hal_executable_loader_t* base_executable_loader) { - iree_hal_legacy_library_loader_t* executable_loader = - (iree_hal_legacy_library_loader_t*)base_executable_loader; + iree_hal_system_library_loader_t* executable_loader = + (iree_hal_system_library_loader_t*)base_executable_loader; iree_allocator_t host_allocator = executable_loader->host_allocator; IREE_TRACE_ZONE_BEGIN(z0); @@ -397,7 +397,7 @@ #define IREE_PLATFORM_DYLIB_TYPE "elf" #endif // IREE_PLATFORM_* -static bool iree_hal_legacy_library_loader_query_support( +static bool iree_hal_system_library_loader_query_support( iree_hal_executable_loader_t* base_executable_loader, iree_hal_executable_caching_mode_t caching_mode, iree_string_view_t executable_format) { @@ -406,12 +406,12 @@ iree_make_cstring_view("system-" IREE_PLATFORM_DYLIB_TYPE "-" IREE_ARCH)); } -static iree_status_t iree_hal_legacy_library_loader_try_load( +static iree_status_t iree_hal_system_library_loader_try_load( iree_hal_executable_loader_t* base_executable_loader, const iree_hal_executable_spec_t* executable_spec, iree_hal_executable_t** out_executable) { - iree_hal_legacy_library_loader_t* executable_loader = - (iree_hal_legacy_library_loader_t*)base_executable_loader; + iree_hal_system_library_loader_t* executable_loader = + (iree_hal_system_library_loader_t*)base_executable_loader; IREE_TRACE_ZONE_BEGIN(z0); // Verify and fetch the executable flatbuffer wrapper. @@ -423,7 +423,7 @@ // Perform the load (and requisite disgusting hackery). IREE_RETURN_AND_END_ZONE_IF_ERROR( - z0, iree_hal_legacy_executable_create( + z0, iree_hal_system_executable_create( executable_def, executable_spec->executable_layout_count, executable_spec->executable_layouts, base_executable_loader->import_provider, @@ -434,8 +434,8 @@ } const iree_hal_executable_loader_vtable_t - iree_hal_legacy_library_loader_vtable = { - /*.destroy=*/iree_hal_legacy_library_loader_destroy, - /*.query_support=*/iree_hal_legacy_library_loader_query_support, - /*.try_load=*/iree_hal_legacy_library_loader_try_load, + iree_hal_system_library_loader_vtable = { + .destroy = iree_hal_system_library_loader_destroy, + .query_support = iree_hal_system_library_loader_query_support, + .try_load = iree_hal_system_library_loader_try_load, };
diff --git a/iree/hal/local/loaders/legacy_library_loader.h b/iree/hal/local/loaders/system_library_loader.h similarity index 81% rename from iree/hal/local/loaders/legacy_library_loader.h rename to iree/hal/local/loaders/system_library_loader.h index 4374d87..23ffdd0 100644 --- a/iree/hal/local/loaders/legacy_library_loader.h +++ b/iree/hal/local/loaders/system_library_loader.h
@@ -4,8 +4,8 @@ // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -#ifndef IREE_HAL_LOCAL_LOADERS_LEGACY_LIBRARY_LOADER_H_ -#define IREE_HAL_LOCAL_LOADERS_LEGACY_LIBRARY_LOADER_H_ +#ifndef IREE_HAL_LOCAL_LOADERS_SYSTEM_LIBRARY_LOADER_H_ +#define IREE_HAL_LOCAL_LOADERS_SYSTEM_LIBRARY_LOADER_H_ #include <stdbool.h> #include <stdint.h> @@ -23,7 +23,7 @@ // This uses the legacy "dylib"-style format that will be deleted soon and is // only a placeholder until the compiler can be switched to output // iree_hal_executable_library_t-compatible files. -iree_status_t iree_hal_legacy_library_loader_create( +iree_status_t iree_hal_system_library_loader_create( iree_hal_executable_import_provider_t import_provider, iree_allocator_t host_allocator, iree_hal_executable_loader_t** out_executable_loader); @@ -32,4 +32,4 @@ } // extern "C" #endif // __cplusplus -#endif // IREE_HAL_LOCAL_LOADERS_LEGACY_LIBRARY_LOADER_H_ +#endif // IREE_HAL_LOCAL_LOADERS_SYSTEM_LIBRARY_LOADER_H_