Changes to accommodate IREE upstream API change

This is the necessary change to accommodate the recent upstream IREE API
change.

Change-Id: I5b9ed47ffff88e10c57ba8a4b3342d49df332f8d
diff --git a/samples/device/device_static_loader.c b/samples/device/device_static_loader.c
index 225712c..caa2483 100644
--- a/samples/device/device_static_loader.c
+++ b/samples/device/device_static_loader.c
@@ -18,9 +18,7 @@
   iree_hal_sync_device_params_initialize(&params);
 
   // Load the statically embedded library
-  const iree_hal_executable_library_header_t** static_library = library_query(
-      IREE_HAL_EXECUTABLE_LIBRARY_LATEST_VERSION, /*reserved=*/NULL);
-  const iree_hal_executable_library_header_t** libraries[1] = {static_library};
+  const iree_hal_executable_library_query_fn_t libraries[] = {library_query()};
 
   iree_hal_executable_loader_t* library_loader = NULL;
   if (iree_status_is_ok(status)) {
diff --git a/samples/float_model/CMakeLists.txt b/samples/float_model/CMakeLists.txt
index f921a2e..b673962 100644
--- a/samples/float_model/CMakeLists.txt
+++ b/samples/float_model/CMakeLists.txt
@@ -83,6 +83,7 @@
     iree::vm::bytecode_module
     samples::util::util
   LINKOPTS
+    "LINKER:--defsym=__itcm_length__=1M"
     "LINKER:--defsym=__stack_size__=200k"
 )
 
@@ -98,6 +99,7 @@
     samples::util::util
     "m"
   LINKOPTS
+    "LINKER:--defsym=__itcm_length__=1M"
     "LINKER:--defsym=__stack_size__=200k"
   COPTS
     "-DBUILD_EMITC"
diff --git a/samples/float_model/mnist.c b/samples/float_model/mnist.c
index 7cccb9f..55dd642 100644
--- a/samples/float_model/mnist.c
+++ b/samples/float_model/mnist.c
@@ -47,16 +47,14 @@
 #endif
 }
 
-const iree_hal_executable_library_header_t **library_query(
-    iree_hal_executable_library_version_t max_version, void *reserved) {
-  return mnist_linked_llvm_library_query(max_version,
-                                         /*reserved=*/reserved);
+iree_hal_executable_library_query_fn_t library_query(void) {
+  return &mnist_linked_llvm_library_query;
 }
 
 iree_status_t load_input_data(const MlModel *model, void **buffer,
-                              iree_byte_span_t **byte_span) {
-  byte_span[0] = malloc(sizeof(iree_byte_span_t));
-  *byte_span[0] = iree_make_byte_span(
+                              iree_const_byte_span_t **byte_span) {
+  byte_span[0] = malloc(sizeof(iree_const_byte_span_t));
+  *byte_span[0] = iree_make_const_byte_span(
       mnist_input, model->input_size_bytes[0] * model->input_length[0]);
   return iree_ok_status();
 }
diff --git a/samples/float_model/mobilenet_v1.c b/samples/float_model/mobilenet_v1.c
index c9a72d0..17e08de 100644
--- a/samples/float_model/mobilenet_v1.c
+++ b/samples/float_model/mobilenet_v1.c
@@ -47,23 +47,18 @@
 #endif
 }
 
-const iree_hal_executable_library_header_t **library_query(
-    iree_hal_executable_library_version_t max_version, void *reserved) {
+iree_hal_executable_library_query_fn_t library_query(void) {
 #if !defined(BUILD_EMITC)
-  return mobilenet_v1_bytecode_module_static_linked_llvm_library_query(
-      max_version,
-      /*reserved=*/reserved);
+  return &mobilenet_v1_bytecode_module_static_linked_llvm_library_query;
 #else
-  return mobilenet_v1_c_module_static_linked_llvm_library_query(
-      max_version,
-      /*reserved=*/reserved);
+  return &mobilenet_v1_c_module_static_linked_llvm_library_query;
 #endif
 }
 
 iree_status_t load_input_data(const MlModel *model, void **buffer,
-                              iree_byte_span_t **byte_span) {
-  byte_span[0] = malloc(sizeof(iree_byte_span_t));
-  *byte_span[0] = iree_make_byte_span(
+                              iree_const_byte_span_t **byte_span) {
+  byte_span[0] = malloc(sizeof(iree_const_byte_span_t));
+  *byte_span[0] = iree_make_const_byte_span(
       mobilenet_input, model->input_size_bytes[0] * model->input_length[0]);
   return iree_ok_status();
 }
diff --git a/samples/quant_model/CMakeLists.txt b/samples/quant_model/CMakeLists.txt
index ed825dd..217ecd2 100644
--- a/samples/quant_model/CMakeLists.txt
+++ b/samples/quant_model/CMakeLists.txt
@@ -197,6 +197,7 @@
     iree::vm::bytecode_module
     samples::util::util
   LINKOPTS
+    "LINKER:--defsym=__itcm_length__=1M"
     "LINKER:--defsym=__stack_size__=100k"
 )
 
@@ -211,6 +212,7 @@
     ::mobilenet_v1_c_module_static_emitc
     samples::util::util
   LINKOPTS
+    "LINKER:--defsym=__itcm_length__=1M"
     "LINKER:--defsym=__stack_size__=100k"
   COPTS
     "-DBUILD_EMITC"
@@ -228,7 +230,8 @@
     iree::vm::bytecode_module
     samples::util::util
   LINKOPTS
-  "LINKER:--defsym=__stack_size__=150k"
+    "LINKER:--defsym=__itcm_length__=1500K"
+    "LINKER:--defsym=__stack_size__=150k"
 )
 
 iree_cc_binary(
@@ -242,6 +245,7 @@
     ::mobilenet_v2_c_module_static_emitc
     samples::util::util
   LINKOPTS
+    "LINKER:--defsym=__itcm_length__=1500K"
     "LINKER:--defsym=__stack_size__=150k"
   COPTS
     "-DBUILD_EMITC"
@@ -259,6 +263,7 @@
     iree::vm::bytecode_module
     samples::util::util
   LINKOPTS
+    "LINKER:--defsym=__itcm_length__=1600K"
     "LINKER:--defsym=__stack_size__=128k"
 )
 
@@ -273,6 +278,7 @@
     ::person_detection_quant_input_c
     samples::util::util
   LINKOPTS
+    "LINKER:--defsym=__itcm_length__=1600K"
     "LINKER:--defsym=__stack_size__=128k"
   COPTS
     "-DBUILD_EMITC"
@@ -293,7 +299,7 @@
     iree::vm::bytecode_module
     samples::util::util
   LINKOPTS
-    "LINKER:--defsym=__itcm_length__=700k"
+    "LINKER:--defsym=__itcm_length__=1500K"
     "LINKER:--defsym=__stack_size__=100k"
 )
 
@@ -307,7 +313,7 @@
     ::barcode_c_module_static_emitc
     samples::util::util
   LINKOPTS
-    "LINKER:--defsym=__itcm_length__=700k"
+    "LINKER:--defsym=__itcm_length__=1500K"
     "LINKER:--defsym=__stack_size__=100k"
   COPTS
     "-DBUILD_EMITC"
@@ -324,6 +330,7 @@
     iree::vm::bytecode_module
     samples::util::util
   LINKOPTS
+    "LINKER:--defsym=__itcm_length__=1M"
     "LINKER:--defsym=__stack_size__=100k"
 )
 
@@ -337,6 +344,7 @@
     ::daredevil_c_module_static_emitc
     samples::util::util
   LINKOPTS
+    "LINKER:--defsym=__itcm_length__=1M"
     "LINKER:--defsym=__stack_size__=100k"
   COPTS
     "-DBUILD_EMITC"
@@ -355,6 +363,7 @@
     samples::risp4ml::pipeline::pipeline
     samples::util::util
   LINKOPTS
+    "LINKER:--defsym=__itcm_length__=1200K"
     "LINKER:--defsym=__stack_size__=100k"
 )
 
@@ -370,6 +379,7 @@
     samples::risp4ml::pipeline::pipeline
     samples::util::util
   LINKOPTS
+    "LINKER:--defsym=__itcm_length__=1200K"
     "LINKER:--defsym=__stack_size__=100k"
   COPTS
     "-DBUILD_EMITC"
@@ -386,6 +396,7 @@
     iree::vm::bytecode_module
     samples::util::util
   LINKOPTS
+    "LINKER:--defsym=__itcm_length__=1500K"
     "LINKER:--defsym=__stack_size__=150k"
 )
 
@@ -399,6 +410,7 @@
     ::scenenet_v2_c_module_static_emitc
     samples::util::util
   LINKOPTS
+    "LINKER:--defsym=__itcm_length__=1500K"
     "LINKER:--defsym=__stack_size__=150k"
   COPTS
     "-DBUILD_EMITC"
@@ -415,6 +427,7 @@
     iree::vm::bytecode_module
     samples::util::util
   LINKOPTS
+    "LINKER:--defsym=__itcm_length__=1M"
     "LINKER:--defsym=__stack_size__=100k"
 )
 
@@ -428,6 +441,7 @@
     ::semantic_lift_c_module_static_emitc
     samples::util::util
   LINKOPTS
+    "LINKER:--defsym=__itcm_length__=1M"
     "LINKER:--defsym=__stack_size__=100k"
   COPTS
     "-DBUILD_EMITC"
diff --git a/samples/quant_model/barcode.c b/samples/quant_model/barcode.c
index 12cf54c..1eb8dd1 100644
--- a/samples/quant_model/barcode.c
+++ b/samples/quant_model/barcode.c
@@ -45,21 +45,16 @@
 #endif
 }
 
-const iree_hal_executable_library_header_t **library_query(
-    iree_hal_executable_library_version_t max_version, void *reserved) {
+iree_hal_executable_library_query_fn_t library_query(void) {
 #if !defined(BUILD_EMITC)
-  return barcode_bytecode_module_static_linked_llvm_library_query(
-      max_version,
-      /*reserved=*/reserved);
+  return &barcode_bytecode_module_static_linked_llvm_library_query;
 #else
-  return barcode_c_module_static_linked_llvm_library_query(
-      max_version,
-      /*reserved=*/reserved);
+  return &barcode_c_module_static_linked_llvm_library_query;
 #endif
 }
 
 iree_status_t load_input_data(const MlModel *model, void **buffer,
-                              iree_byte_span_t **byte_span) {
+                              iree_const_byte_span_t **byte_span) {
   iree_status_t result = alloc_input_buffer(model, buffer);
   // Populate initial value
   srand(768954);
@@ -68,8 +63,8 @@
       ((uint8_t *)*buffer)[i] = (uint8_t)rand();
     }
   }
-  byte_span[0] = malloc(sizeof(iree_byte_span_t));
-  *byte_span[0] = iree_make_byte_span(
+  byte_span[0] = malloc(sizeof(iree_const_byte_span_t));
+  *byte_span[0] = iree_make_const_byte_span(
       buffer[0], model->input_size_bytes[0] * model->input_length[0]);
   return result;
 }
diff --git a/samples/quant_model/daredevil.c b/samples/quant_model/daredevil.c
index 86ff0fb..25212d4 100644
--- a/samples/quant_model/daredevil.c
+++ b/samples/quant_model/daredevil.c
@@ -43,21 +43,16 @@
 #endif
 }
 
-const iree_hal_executable_library_header_t **library_query(
-    iree_hal_executable_library_version_t max_version, void *reserved) {
+iree_hal_executable_library_query_fn_t library_query(void) {
 #if !defined(BUILD_EMITC)
-  return daredevil_bytecode_module_static_linked_llvm_library_query(
-      max_version,
-      /*reserved=*/reserved);
+  return &daredevil_bytecode_module_static_linked_llvm_library_query;
 #else
-  return daredevil_c_module_static_linked_llvm_library_query(
-      max_version,
-      /*reserved=*/reserved);
+  return &daredevil_c_module_static_linked_llvm_library_query;
 #endif
 }
 
 iree_status_t load_input_data(const MlModel *model, void **buffer,
-                              iree_byte_span_t **byte_span) {
+                              iree_const_byte_span_t **byte_span) {
   iree_status_t result = alloc_input_buffer(model, buffer);
   // Populate initial value
   srand(3689964);
@@ -66,8 +61,8 @@
       ((uint8_t *)*buffer)[i] = (uint8_t)rand();
     }
   }
-  byte_span[0] = malloc(sizeof(iree_byte_span_t));
-  *byte_span[0] = iree_make_byte_span(
+  byte_span[0] = malloc(sizeof(iree_const_byte_span_t));
+  *byte_span[0] = iree_make_const_byte_span(
       buffer[0], model->input_size_bytes[0] * model->input_length[0]);
   return result;
 }
diff --git a/samples/quant_model/fssd_25_8bit_v2.c b/samples/quant_model/fssd_25_8bit_v2.c
index 0ba243e..21613b5 100644
--- a/samples/quant_model/fssd_25_8bit_v2.c
+++ b/samples/quant_model/fssd_25_8bit_v2.c
@@ -46,21 +46,16 @@
 #endif
 }
 
-const iree_hal_executable_library_header_t **library_query(
-    iree_hal_executable_library_version_t max_version, void *reserved) {
+iree_hal_executable_library_query_fn_t library_query(void) {
 #if !defined(BUILD_EMITC)
-  return fssd_25_8bit_v2_bytecode_module_static_linked_llvm_library_query(
-      max_version,
-      /*reserved=*/reserved);
+  return &fssd_25_8bit_v2_bytecode_module_static_linked_llvm_library_query;
 #else
-  return fssd_25_8bit_v2_c_module_static_linked_llvm_library_query(
-      max_version,
-      /*reserved=*/reserved);
+  return &fssd_25_8bit_v2_c_module_static_linked_llvm_library_query;
 #endif
 }
 
 iree_status_t load_input_data(const MlModel *model, void **buffer,
-                              iree_byte_span_t **byte_span) {
+                              iree_const_byte_span_t **byte_span) {
   iree_status_t result = alloc_input_buffer(model, buffer);
 
   ImageU8 input = {
@@ -69,8 +64,8 @@
       .width = 320, .height = 320, .num_channels = 3, .data = buffer[0]};
   isp_pipeline(&input, &output);
 
-  byte_span[0] = malloc(sizeof(iree_byte_span_t));
-  *byte_span[0] = iree_make_byte_span(
+  byte_span[0] = malloc(sizeof(iree_const_byte_span_t));
+  *byte_span[0] = iree_make_const_byte_span(
       buffer[0], model->input_size_bytes[0] * model->input_length[0]);
   return result;
 }
diff --git a/samples/quant_model/mobilenet_v1.c b/samples/quant_model/mobilenet_v1.c
index 248d81f..b4f7b34 100644
--- a/samples/quant_model/mobilenet_v1.c
+++ b/samples/quant_model/mobilenet_v1.c
@@ -47,25 +47,20 @@
 #endif
 }
 
-const iree_hal_executable_library_header_t **library_query(
-    iree_hal_executable_library_version_t max_version, void *reserved) {
+iree_hal_executable_library_query_fn_t library_query(void) {
 #if !defined(BUILD_EMITC)
-  return mobilenet_v1_bytecode_module_static_linked_llvm_library_query(
-      max_version,
-      /*reserved=*/reserved);
+  return &mobilenet_v1_bytecode_module_static_linked_llvm_library_query;
 #else
-  return mobilenet_v1_c_module_static_linked_llvm_library_query(
-      max_version,
-      /*reserved=*/reserved);
+  return &mobilenet_v1_c_module_static_linked_llvm_library_query;
 #endif
 }
 
 iree_status_t load_input_data(const MlModel *model, void **buffer,
-                              iree_byte_span_t **byte_span) {
-  byte_span[0] = malloc(sizeof(iree_byte_span_t));
-  *byte_span[0] =
-      iree_make_byte_span(mobilenet_quant_input,
-                          model->input_size_bytes[0] * model->input_length[0]);
+                              iree_const_byte_span_t **byte_span) {
+  byte_span[0] = malloc(sizeof(iree_const_byte_span_t));
+  *byte_span[0] = iree_make_const_byte_span(
+      mobilenet_quant_input,
+      model->input_size_bytes[0] * model->input_length[0]);
   return iree_ok_status();
 }
 
diff --git a/samples/quant_model/mobilenet_v2.c b/samples/quant_model/mobilenet_v2.c
index 711937d..b1abe12 100644
--- a/samples/quant_model/mobilenet_v2.c
+++ b/samples/quant_model/mobilenet_v2.c
@@ -47,25 +47,20 @@
 #endif
 }
 
-const iree_hal_executable_library_header_t **library_query(
-    iree_hal_executable_library_version_t max_version, void *reserved) {
+iree_hal_executable_library_query_fn_t library_query(void) {
 #if !defined(BUILD_EMITC)
-  return mobilenet_v2_bytecode_module_static_linked_llvm_library_query(
-      max_version,
-      /*reserved=*/reserved);
+  return &mobilenet_v2_bytecode_module_static_linked_llvm_library_query;
 #else
-  return mobilenet_v2_c_module_static_linked_llvm_library_query(
-      max_version,
-      /*reserved=*/reserved);
+  return &mobilenet_v2_c_module_static_linked_llvm_library_query;
 #endif
 }
 
 iree_status_t load_input_data(const MlModel *model, void **buffer,
-                              iree_byte_span_t **byte_span) {
-  byte_span[0] = malloc(sizeof(iree_byte_span_t));
-  *byte_span[0] =
-      iree_make_byte_span(mobilenet_quant_input,
-                          model->input_size_bytes[0] * model->input_length[0]);
+                              iree_const_byte_span_t **byte_span) {
+  byte_span[0] = malloc(sizeof(iree_const_byte_span_t));
+  *byte_span[0] = iree_make_const_byte_span(
+      mobilenet_quant_input,
+      model->input_size_bytes[0] * model->input_length[0]);
   return iree_ok_status();
 }
 
diff --git a/samples/quant_model/person_detection.c b/samples/quant_model/person_detection.c
index 1ef7f56..b3b2e5a 100644
--- a/samples/quant_model/person_detection.c
+++ b/samples/quant_model/person_detection.c
@@ -47,25 +47,20 @@
 #endif
 }
 
-const iree_hal_executable_library_header_t **library_query(
-    iree_hal_executable_library_version_t max_version, void *reserved) {
+iree_hal_executable_library_query_fn_t library_query(void) {
 #if !defined(BUILD_EMITC)
-  return person_detection_bytecode_module_static_linked_llvm_library_query(
-      max_version,
-      /*reserved=*/reserved);
+  return &person_detection_bytecode_module_static_linked_llvm_library_query;
 #else
-  return person_detection_c_module_static_linked_llvm_library_query(
-      max_version,
-      /*reserved=*/reserved);
+  return &person_detection_c_module_static_linked_llvm_library_query;
 #endif
 }
 
 iree_status_t load_input_data(const MlModel *model, void **buffer,
-                              iree_byte_span_t **byte_span) {
-  byte_span[0] = malloc(sizeof(iree_byte_span_t));
-  *byte_span[0] =
-      iree_make_byte_span(person_detection_quant_input,
-                          model->input_size_bytes[0] * model->input_length[0]);
+                              iree_const_byte_span_t **byte_span) {
+  byte_span[0] = malloc(sizeof(iree_const_byte_span_t));
+  *byte_span[0] = iree_make_const_byte_span(
+      person_detection_quant_input,
+      model->input_size_bytes[0] * model->input_length[0]);
   return iree_ok_status();
 }
 
diff --git a/samples/quant_model/scenenet_v2.c b/samples/quant_model/scenenet_v2.c
index ac5f01f..fa0783c 100644
--- a/samples/quant_model/scenenet_v2.c
+++ b/samples/quant_model/scenenet_v2.c
@@ -43,21 +43,16 @@
 #endif
 }
 
-const iree_hal_executable_library_header_t **library_query(
-    iree_hal_executable_library_version_t max_version, void *reserved) {
+iree_hal_executable_library_query_fn_t library_query(void) {
 #if !defined(BUILD_EMITC)
-  return scenenet_v2_bytecode_module_static_linked_llvm_library_query(
-      max_version,
-      /*reserved=*/reserved);
+  return &scenenet_v2_bytecode_module_static_linked_llvm_library_query;
 #else
-  return scenenet_v2_c_module_static_linked_llvm_library_query(
-      max_version,
-      /*reserved=*/reserved);
+  return &scenenet_v2_c_module_static_linked_llvm_library_query;
 #endif
 }
 
 iree_status_t load_input_data(const MlModel *model, void **buffer,
-                              iree_byte_span_t **byte_span) {
+                              iree_const_byte_span_t **byte_span) {
   iree_status_t result = alloc_input_buffer(model, buffer);
   // Populate initial value
   srand(55555555);
@@ -66,8 +61,8 @@
       ((uint8_t *)*buffer)[i] = (uint8_t)rand();
     }
   }
-  byte_span[0] = malloc(sizeof(iree_byte_span_t));
-  *byte_span[0] = iree_make_byte_span(
+  byte_span[0] = malloc(sizeof(iree_const_byte_span_t));
+  *byte_span[0] = iree_make_const_byte_span(
       buffer[0], model->input_size_bytes[0] * model->input_length[0]);
   return result;
 }
diff --git a/samples/quant_model/semantic_lift.c b/samples/quant_model/semantic_lift.c
index 5abaff2..b6d8477 100644
--- a/samples/quant_model/semantic_lift.c
+++ b/samples/quant_model/semantic_lift.c
@@ -43,21 +43,16 @@
 #endif
 }
 
-const iree_hal_executable_library_header_t **library_query(
-    iree_hal_executable_library_version_t max_version, void *reserved) {
+iree_hal_executable_library_query_fn_t library_query(void) {
 #if !defined(BUILD_EMITC)
-  return semantic_lift_bytecode_module_static_linked_llvm_library_query(
-      max_version,
-      /*reserved=*/reserved);
+  return &semantic_lift_bytecode_module_static_linked_llvm_library_query;
 #else
-  return semantic_lift_c_module_static_linked_llvm_library_query(
-      max_version,
-      /*reserved=*/reserved);
+  return &semantic_lift_c_module_static_linked_llvm_library_query;
 #endif
 }
 
 iree_status_t load_input_data(const MlModel *model, void **buffer,
-                              iree_byte_span_t **byte_span) {
+                              iree_const_byte_span_t **byte_span) {
   iree_status_t result = alloc_input_buffer(model, buffer);
   // Populate initial value
   srand(66666666);
@@ -66,8 +61,8 @@
       ((uint8_t *)*buffer)[i] = (uint8_t)rand();
     }
   }
-  byte_span[0] = malloc(sizeof(iree_byte_span_t));
-  *byte_span[0] = iree_make_byte_span(
+  byte_span[0] = malloc(sizeof(iree_const_byte_span_t));
+  *byte_span[0] = iree_make_const_byte_span(
       buffer[0], model->input_size_bytes[0] * model->input_length[0]);
   return result;
 }
diff --git a/samples/quant_model/voice_commands.c b/samples/quant_model/voice_commands.c
index e7bdf99..94a68ab 100644
--- a/samples/quant_model/voice_commands.c
+++ b/samples/quant_model/voice_commands.c
@@ -43,21 +43,16 @@
 #endif
 }
 
-const iree_hal_executable_library_header_t **library_query(
-    iree_hal_executable_library_version_t max_version, void *reserved) {
+iree_hal_executable_library_query_fn_t library_query(void) {
 #if !defined(BUILD_EMITC)
-  return voice_commands_bytecode_module_static_linked_llvm_library_query(
-      max_version,
-      /*reserved=*/reserved);
+  return &voice_commands_bytecode_module_static_linked_llvm_library_query;
 #else
-  return voice_commands_c_module_static_linked_llvm_library_query(
-      max_version,
-      /*reserved=*/reserved);
+  return &voice_commands_c_module_static_linked_llvm_library_query;
 #endif
 }
 
 iree_status_t load_input_data(const MlModel *model, void **buffer,
-                              iree_byte_span_t **byte_span) {
+                              iree_const_byte_span_t **byte_span) {
   iree_status_t result = alloc_input_buffer(model, buffer);
   // Populate initial value
   srand(77777777);
@@ -66,8 +61,8 @@
       ((uint8_t *)*buffer)[i] = (uint8_t)rand();
     }
   }
-  byte_span[0] = malloc(sizeof(iree_byte_span_t));
-  *byte_span[0] = iree_make_byte_span(
+  byte_span[0] = malloc(sizeof(iree_const_byte_span_t));
+  *byte_span[0] = iree_make_const_byte_span(
       buffer[0], model->input_size_bytes[0] * model->input_length[0]);
   return result;
 }
diff --git a/samples/simple_vec_mul/float_vec.c b/samples/simple_vec_mul/float_vec.c
index d9c53dd..a890031 100644
--- a/samples/simple_vec_mul/float_vec.c
+++ b/samples/simple_vec_mul/float_vec.c
@@ -39,14 +39,12 @@
 #endif
 }
 
-const iree_hal_executable_library_header_t **library_query(
-    iree_hal_executable_library_version_t max_version, void *reserved) {
-  return simple_mul_dispatch_0_library_query(max_version,
-                                             /*reserved=*/reserved);
+iree_hal_executable_library_query_fn_t library_query(void) {
+  return &simple_mul_dispatch_0_library_query;
 }
 
 iree_status_t load_input_data(const MlModel *model, void **buffer,
-                              iree_byte_span_t **byte_span) {
+                              iree_const_byte_span_t **byte_span) {
   iree_status_t result = alloc_input_buffer(model, buffer);
   // Populate initial values
   // arg0 = 0, 1/4, 1/2, 3/4... 1023/4
@@ -58,8 +56,8 @@
     }
   }
   for (int i = 0; i < model->num_input; ++i) {
-    byte_span[i] = malloc(sizeof(iree_byte_span_t));
-    *byte_span[i] = iree_make_byte_span(
+    byte_span[i] = malloc(sizeof(iree_const_byte_span_t));
+    *byte_span[i] = iree_make_const_byte_span(
         buffer[i], model->input_size_bytes[i] * model->input_length[i]);
   }
   return result;
diff --git a/samples/simple_vec_mul/int_vec.c b/samples/simple_vec_mul/int_vec.c
index 01019e3..61ab705 100644
--- a/samples/simple_vec_mul/int_vec.c
+++ b/samples/simple_vec_mul/int_vec.c
@@ -40,14 +40,12 @@
 #endif
 }
 
-const iree_hal_executable_library_header_t **library_query(
-    iree_hal_executable_library_version_t max_version, void *reserved) {
-  return simple_mul_dispatch_0_library_query(max_version,
-                                             /*reserved=*/reserved);
+iree_hal_executable_library_query_fn_t library_query(void) {
+  return &simple_mul_dispatch_0_library_query;
 }
 
 iree_status_t load_input_data(const MlModel *model, void **buffer,
-                              iree_byte_span_t **byte_span) {
+                              iree_const_byte_span_t **byte_span) {
   iree_status_t result = alloc_input_buffer(model, buffer);
   // Populate initial values
   // arg0 = 0, 0, 1, 1,..., 511
@@ -59,8 +57,8 @@
     }
   }
   for (int i = 0; i < model->num_input; ++i) {
-    byte_span[i] = malloc(sizeof(iree_byte_span_t));
-    *byte_span[i] = iree_make_byte_span(
+    byte_span[i] = malloc(sizeof(iree_const_byte_span_t));
+    *byte_span[i] = iree_make_const_byte_span(
         buffer[i], model->input_size_bytes[i] * model->input_length[i]);
   }
   return result;
diff --git a/samples/util/alloc.c b/samples/util/alloc.c
index 08cf339..973b70a 100644
--- a/samples/util/alloc.c
+++ b/samples/util/alloc.c
@@ -1,14 +1,11 @@
 #include "samples/util/alloc.h"
 
-iree_status_t alloc_input_buffer(const MlModel *model,
-                                               void **buffer) {
+iree_status_t alloc_input_buffer(const MlModel *model, void **buffer) {
   iree_status_t result = iree_ok_status();
   for (int i = 0; i < model->num_input; ++i) {
     if (iree_status_is_ok(result)) {
-      buffer[i] =
-          iree_aligned_alloc(
-              sizeof(uint32_t),
-              model->input_size_bytes[i] * model->input_length[i]);
+      buffer[i] = aligned_alloc(sizeof(uint32_t), model->input_size_bytes[i] *
+                                                      model->input_length[i]);
       if (buffer[i] == NULL) {
         result = iree_make_status(IREE_STATUS_RESOURCE_EXHAUSTED);
       }
diff --git a/samples/util/model_api.h b/samples/util/model_api.h
index 1df0c9c..18f7a2a 100644
--- a/samples/util/model_api.h
+++ b/samples/util/model_api.h
@@ -30,13 +30,12 @@
 } MlModel;
 
 typedef struct {
-  void* result;
+  void *result;
   uint32_t len;
 } MlOutput;
 
 // Load the statically embedded library
-const iree_hal_executable_library_header_t **library_query(
-    iree_hal_executable_library_version_t max_version, void *reserved);
+iree_hal_executable_library_query_fn_t library_query(void);
 
 // Function to create the bytecode or C module.
 iree_status_t create_module(iree_vm_module_t **module);
@@ -45,13 +44,13 @@
 // and prepare the data. It can be loaded from a embedded image binary, a
 // randomly generated stream, or a pointer from the sensor/ISP output.
 iree_status_t load_input_data(const MlModel *model, void **buffer,
-                              iree_byte_span_t **byte_span);
+                              iree_const_byte_span_t **byte_span);
 
 // Process the ML execution output into the final data to be sent to the
 // host. The final format is model dependent, so the address and size
 // are returned via `output.`
 iree_status_t process_output(const MlModel *model,
-                              iree_hal_buffer_mapping_t *buffers,
-                              MlOutput *output);
+                             iree_hal_buffer_mapping_t *buffers,
+                             MlOutput *output);
 
 #endif  // SW_VEC_IREE_SAMPLES_UTIL_MODEL_API_H_
diff --git a/samples/util/util.c b/samples/util/util.c
index 82c02c5..37d1699 100644
--- a/samples/util/util.c
+++ b/samples/util/util.c
@@ -23,7 +23,7 @@
 
   // Prepare the input buffer, and populate the initial value.
   // The input buffer must be released by the caller.
-  iree_byte_span_t *byte_span[MAX_MODEL_INPUT_NUM] = {NULL};
+  iree_const_byte_span_t *byte_span[MAX_MODEL_INPUT_NUM] = {NULL};
   result = load_input_data(model, arg_buffers, byte_span);
 
   // Wrap buffers in shaped buffer views.
@@ -37,11 +37,11 @@
       .usage = IREE_HAL_BUFFER_USAGE_ALL};
   for (int i = 0; i < model->num_input; ++i) {
     if (iree_status_is_ok(result)) {
-      result = iree_hal_buffer_view_wrap_or_clone_heap_buffer(
+      result = iree_hal_buffer_view_allocate_buffer(
           iree_hal_device_allocator(device), model->input_shape[i],
           model->num_input_dim[i], model->hal_element_type,
           IREE_HAL_ENCODING_TYPE_DENSE_ROW_MAJOR, buffer_params, *byte_span[i],
-          iree_allocator_null(), &(arg_buffer_views[i]));
+          &(arg_buffer_views[i]));
     }
     if (byte_span[i] != NULL) {
       free(byte_span[i]);
@@ -176,7 +176,7 @@
   iree_vm_list_release(outputs);
   for (int i = 0; i < model->num_input; ++i) {
     if (arg_buffers[i] != NULL) {
-      iree_aligned_free(arg_buffers[i]);
+      free(arg_buffers[i]);
     }
   }
   iree_vm_context_release(context);