Making VM modules take an instance arg.
This will make it possible to use instance-specific information during
module construction like registered types.
Progress on #8698.
diff --git a/tools/android/run_module_app/src/main.cc b/tools/android/run_module_app/src/main.cc
index 90626a1..f4047da 100644
--- a/tools/android/run_module_app/src/main.cc
+++ b/tools/android/run_module_app/src/main.cc
@@ -98,6 +98,7 @@
 
   iree_vm_module_t* input_module = nullptr;
   IREE_RETURN_IF_ERROR(iree_vm_bytecode_module_create(
+      instance,
       iree_make_const_byte_span((void*)invocation.module.data(),
                                 invocation.module.size()),
       iree_allocator_null(), iree_allocator_system(), &input_module));
@@ -108,8 +109,9 @@
       iree_make_string_view(invocation.device.data(), invocation.device.size()),
       iree_allocator_system(), &device));
   iree_vm_module_t* hal_module = nullptr;
-  IREE_RETURN_IF_ERROR(iree_hal_module_create(
-      device, IREE_HAL_MODULE_FLAG_NONE, iree_allocator_system(), &hal_module));
+  IREE_RETURN_IF_ERROR(
+      iree_hal_module_create(instance, device, IREE_HAL_MODULE_FLAG_NONE,
+                             iree_allocator_system(), &hal_module));
 
   iree_vm_context_t* context = nullptr;
   // Order matters. The input module will likely be dependent on the hal module.
diff --git a/tools/iree-check-module-main.cc b/tools/iree-check-module-main.cc
index 21a85f3..8c4dd88 100644
--- a/tools/iree-check-module-main.cc
+++ b/tools/iree-check-module-main.cc
@@ -83,7 +83,8 @@
                        "creating instance");
 
   iree_vm_module_t* check_module = nullptr;
-  IREE_RETURN_IF_ERROR(iree_check_module_create(host_allocator, &check_module));
+  IREE_RETURN_IF_ERROR(
+      iree_check_module_create(instance, host_allocator, &check_module));
 
   // TODO(benvanik): use --module_file= flag in order to reuse
   // iree_tooling_load_module_from_flags.
@@ -98,7 +99,7 @@
   }
   iree_vm_module_t* main_module = nullptr;
   IREE_RETURN_IF_ERROR(iree_vm_bytecode_module_create(
-      flatbuffer_contents->const_buffer,
+      instance, flatbuffer_contents->const_buffer,
       iree_file_contents_deallocator(flatbuffer_contents), host_allocator,
       &main_module));
 
diff --git a/tools/iree-run-mlir-main.cc b/tools/iree-run-mlir-main.cc
index 608faa4..62e1885 100644
--- a/tools/iree-run-mlir-main.cc
+++ b/tools/iree-run-mlir-main.cc
@@ -359,6 +359,7 @@
   // with devices.
   iree_vm_module_t* main_module = nullptr;
   IREE_RETURN_IF_ERROR(iree_vm_bytecode_module_create(
+      instance,
       iree_make_const_byte_span((void*)flatbuffer_data.data(),
                                 flatbuffer_data.size()),
       iree_allocator_null(), iree_allocator_system(), &main_module));