sw:vec-iree: Clean-ups

The clean-ups are mainly on removing unnecessary library and header dpendencies.

Change-Id: I4fbeea3e699d568c0a88411524c2908029bd8cce
diff --git a/device/CMakeLists.txt b/device/CMakeLists.txt
index ece3cb0..c6a72fb 100644
--- a/device/CMakeLists.txt
+++ b/device/CMakeLists.txt
@@ -6,10 +6,7 @@
   SRCS
     "device_static_loader.c"
   DEPS
-    iree::base
-    iree::hal
     iree::hal::drivers::local_sync::sync_driver
-    iree::hal::local
     iree::hal::local::loaders::static_library_loader
 )
 
@@ -21,9 +18,6 @@
   SRCS
     "device_vmvx_loader.c"
   DEPS
-    iree::base
-    iree::hal
     iree::hal::drivers::local_sync::sync_driver
-    iree::hal::local
     vmvx_ukernel::vmvx_module_loader
 )
diff --git a/device/device.h b/device/device.h
index 2158ca3..2b0922d 100644
--- a/device/device.h
+++ b/device/device.h
@@ -17,8 +17,6 @@
 #ifndef DEVICE_DEVICE_H_
 #define DEVICE_DEVICE_H_
 
-#include "iree/base/api.h"
-#include "iree/hal/api.h"
 #include "iree/hal/local/executable_loader.h"
 
 // Create the HAL device from the different backend targets.
diff --git a/device/device_static_loader.c b/device/device_static_loader.c
index 35b6f31..111ddc2 100644
--- a/device/device_static_loader.c
+++ b/device/device_static_loader.c
@@ -19,7 +19,6 @@
 #include "device/device.h"
 #include "iree/hal/drivers/local_sync/sync_device.h"
 #include "iree/hal/local/loaders/static_library_loader.h"
-#include "iree/modules/hal/module.h"
 #include "model_util/model_api.h"
 
 // A function to create the HAL device from the different backend targets.
diff --git a/device/device_vmvx_loader.c b/device/device_vmvx_loader.c
index 8945489..cfaf111 100644
--- a/device/device_vmvx_loader.c
+++ b/device/device_vmvx_loader.c
@@ -19,8 +19,6 @@
 #include "device/device.h"
 #include "iree/hal/drivers/local_sync/sync_device.h"
 #include "iree/hal/local/loaders/vmvx_module_loader.h"
-#include "iree/modules/hal/module.h"
-#include "model_util/model_api.h"
 
 // A function to create the HAL device from the different backend targets.
 // The HAL device and loader are returned based on the implementation, and they
diff --git a/model_util/CMakeLists.txt b/model_util/CMakeLists.txt
index 3bbbebc..05982b2 100644
--- a/model_util/CMakeLists.txt
+++ b/model_util/CMakeLists.txt
@@ -7,13 +7,7 @@
     "util.c"
   DEPS
     ::alloc
-    iree::base
-    iree::hal
-    iree::hal::local
-    iree::hal::drivers::local_sync::sync_driver
     iree::modules::hal
-    iree::vm
-    iree::vm::shims_emitc
 )
 
 # static library using regular HAL
@@ -45,15 +39,8 @@
   DEPS
     ::alloc
     device::device_static_loader
-    iree::base
-    iree::hal
-    iree::hal::local
-    iree::hal::drivers::local_sync::sync_driver
-    iree::modules::hal
     iree::modules::hal::inline
     iree::modules::hal::loader
-    iree::vm
-    iree::vm::shims_emitc
   COPTS
     "-DBUILD_LOADER_HAL"
 )
@@ -69,14 +56,7 @@
   DEPS
     ::alloc
     device::device_vmvx_loader
-    iree::base
-    iree::hal
-    iree::hal::local
-    iree::hal::drivers::local_sync::sync_driver
-    iree::modules::hal
     iree::modules::hal::inline
-    iree::vm
-    iree::vm::shims_emitc
   COPTS
     "-DBUILD_INLINE_HAL"
 )
diff --git a/model_util/alloc.h b/model_util/alloc.h
index a85b643..827578c 100644
--- a/model_util/alloc.h
+++ b/model_util/alloc.h
@@ -17,7 +17,6 @@
 #ifndef MODEL_UTIL_ALLOC_H_
 #define MODEL_UTIL_ALLOC_H_
 
-#include "iree/base/api.h"
 #include "model_util/model_api.h"
 
 // Allocate the input buffer w.r.t the model config.
diff --git a/model_util/model_api.h b/model_util/model_api.h
index 64540da..abddf81 100644
--- a/model_util/model_api.h
+++ b/model_util/model_api.h
@@ -19,11 +19,8 @@
 
 // Define ML model configuration and model-specific utility APIs.
 
-#include "iree/base/api.h"
-#include "iree/hal/api.h"
 #include "iree/hal/local/executable_library.h"
 #include "iree/modules/hal/module.h"
-#include "iree/vm/api.h"
 #include "iree/vm/bytecode_module.h"
 
 #define MAX_MODEL_INPUT_NUM 2
diff --git a/model_util/util.c b/model_util/util.c
index 24d7744..768fc92 100644
--- a/model_util/util.c
+++ b/model_util/util.c
@@ -19,16 +19,10 @@
 #include "model_util/util.h"
 
 #include <springbok.h>
-#include <stdio.h>
 
 #include "device/device.h"
-#include "iree/base/api.h"
-#include "iree/hal/api.h"
 #include "iree/modules/hal/inline/module.h"
 #include "iree/modules/hal/loader/module.h"
-#include "iree/modules/hal/module.h"
-#include "iree/vm/api.h"
-#include "iree/vm/bytecode_module.h"
 
 typedef struct {
   uint32_t return_code;  // Populated in crt0.S
@@ -85,7 +79,6 @@
                                            /*loader_count=*/1, &loader,
                                            host_allocator, &hal_loader_module);
   }
-  iree_hal_executable_loader_release(loader);
   iree_vm_module_t *modules[] = {hal_inline_module, hal_loader_module, module};
 #else
   // Create hal_module
@@ -97,6 +90,7 @@
   }
   iree_vm_module_t *modules[] = {hal_module, module};
 #endif
+  iree_hal_executable_loader_release(loader);
 
   // Allocate a context that will hold the module state across invocations.
   if (iree_status_is_ok(result)) {
diff --git a/samples/microbenchmarks/CMakeLists.txt b/samples/microbenchmarks/CMakeLists.txt
index 68ff7d0..bf2c208 100644
--- a/samples/microbenchmarks/CMakeLists.txt
+++ b/samples/microbenchmarks/CMakeLists.txt
@@ -14,7 +14,6 @@
     "-riscv-v-vector-bits-min=512"
     "-riscv-v-fixed-length-vector-lmul-max=8"
   EMITC
-  PUBLIC
 )
 
 springbok_vmvx_module(
@@ -28,7 +27,6 @@
     "-riscv-v-fixed-length-vector-lmul-max=8"
   EMITC
   VMVX
-  PUBLIC
 )
 
 iree_cc_binary(
diff --git a/samples/microbenchmarks/conv1x1_test.c b/samples/microbenchmarks/conv1x1_test.c
index 1bd5bfa..cbe19d8 100644
--- a/samples/microbenchmarks/conv1x1_test.c
+++ b/samples/microbenchmarks/conv1x1_test.c
@@ -1,7 +1,5 @@
 // conv 1x1 tosa op test.
 
-#include "iree/base/api.h"
-#include "iree/hal/api.h"
 #include "model_util/util.h"
 #if defined(BUILD_VMVX)
 #include "samples/microbenchmarks/conv1x1_test_vmvx_emitc.h"
diff --git a/samples/simple_vec_mul/CMakeLists.txt b/samples/simple_vec_mul/CMakeLists.txt
index 6318f44..50ab1e2 100644
--- a/samples/simple_vec_mul/CMakeLists.txt
+++ b/samples/simple_vec_mul/CMakeLists.txt
@@ -17,7 +17,6 @@
     "-riscv-v-fixed-length-vector-lmul-max=8"
   VMVX
   INLINE_HAL
-  PUBLIC
 )
 
 springbok_modules(
@@ -33,7 +32,6 @@
     "-riscv-v-fixed-length-vector-lmul-max=8"
   VMVX
   INLINE_HAL
-  PUBLIC
 )
 
 #-------------------------------------------------------------------------------
@@ -60,7 +58,6 @@
     "float_vec.c"
   DEPS
     ::simple_float_mul_bytecode_module_vmvx_c
-    iree::vm::bytecode_module
     model_util::util_vmvx_inline
   LINKOPTS
     "LINKER:--defsym=__stack_size__=20k"
@@ -119,7 +116,6 @@
     "int_vec.c"
   DEPS
     ::simple_int_mul_bytecode_module_vmvx_c
-    iree::vm::bytecode_module
     model_util::util_vmvx_inline
   LINKOPTS
     "LINKER:--defsym=__stack_size__=20k"
diff --git a/samples/simple_vec_mul/float_vec.c b/samples/simple_vec_mul/float_vec.c
index 4ebacb5..913335d 100644
--- a/samples/simple_vec_mul/float_vec.c
+++ b/samples/simple_vec_mul/float_vec.c
@@ -16,8 +16,6 @@
 
 // Float simple_mul bytecode loading and input/output processes
 
-#include "iree/base/api.h"
-#include "iree/hal/api.h"
 #include "model_util/util.h"
 
 // Compiled module embedded here to avoid file IO:
diff --git a/samples/simple_vec_mul/int_vec.c b/samples/simple_vec_mul/int_vec.c
index d51ce6a..41bbf0a 100644
--- a/samples/simple_vec_mul/int_vec.c
+++ b/samples/simple_vec_mul/int_vec.c
@@ -16,8 +16,6 @@
 
 // Integer simple_mul bytecode loading and input/output processes
 
-#include "iree/base/api.h"
-#include "iree/hal/api.h"
 #include "model_util/util.h"
 
 // Compiled module embedded here to avoid file IO:
diff --git a/vmvx_ukernel/CMakeLists.txt b/vmvx_ukernel/CMakeLists.txt
index 8268a3e..a18e016 100644
--- a/vmvx_ukernel/CMakeLists.txt
+++ b/vmvx_ukernel/CMakeLists.txt
@@ -47,10 +47,6 @@
     "IREE_HAVE_VMVX_MODULE"
   DEPS
     ::ukernel
-    iree::base
-    iree::base::tracing
-    iree::base::internal::cpu
-    iree::vm
   PUBLIC
 )
 
@@ -63,12 +59,7 @@
     "${IREE_RUNTIME_SOURCE_DIR}/hal/local/loaders/vmvx_module_loader.c"
   DEPS
     ::vmvx
-    iree::base
-    iree::base::tracing
-    iree::hal
-    iree::hal::local::executable_library
     iree::hal::local::executable_loader
-    iree::vm
     iree::vm::bytecode_module
   DEFINES
     "IREE_HAVE_HAL_EXECUTABLE_LOADER_VMVX_MODULE=1"