Add shodan quantized models to build/run on springbok

Add shodan quantized ML models to build/run on springbok emulator.

Currently some quant models are not yet supported by IREE upstream and
are commented out in makefile (b/198476354).

All other models can be compiled and run on qemu linux emulator. But not all models can run on qemu springbok, due to a known issue on the upstream:
- Large HAL buffer: b/196910893

Currently only the daredevil_quant model can run on qemu and renode
springbok.

Change-Id: Ia8150531d09cb384e538333f11f04e43fcc5ce62
diff --git a/samples/float_model_embedding/CMakeLists.txt b/samples/float_model_embedding/CMakeLists.txt
index f3445e9..30d67f0 100644
--- a/samples/float_model_embedding/CMakeLists.txt
+++ b/samples/float_model_embedding/CMakeLists.txt
@@ -156,6 +156,8 @@
 #
 # to increase it.
 
+# Currently only the person_detection model can run with springbok (b/196910893)
+
 if(NOT ${BUILD_WITH_SPRINGBOK})
   iree_cc_binary(
     NAME
diff --git a/samples/quant_model_embedding/CMakeLists.txt b/samples/quant_model_embedding/CMakeLists.txt
new file mode 100644
index 0000000..9a36686
--- /dev/null
+++ b/samples/quant_model_embedding/CMakeLists.txt
@@ -0,0 +1,240 @@
+#-------------------------------------------------------------------------------
+# Build the mlir bytecode modules with iree-translate. Note the last two flags
+# and "+experimental-v" are for RVV support.
+#-------------------------------------------------------------------------------
+
+if(NOT ${BUILD_INTERNAL_MODELS})
+  return()
+endif()
+
+if(NOT ${BUILD_WITH_SPRINGBOK})
+# TODO(b/198476354): uncomment below after operator tosa.clz is supported
+#  springbok_bytecode_module(
+#    NAME
+#      mobilenet_v2_bytecode_module_dylib
+#    SRC
+#      "$ENV{ROOTDIR}/ml/ml-models/quant_models/mobilenet_v2_1.0_224_quant.tflite"
+#    C_IDENTIFIER
+#      "samples_quant_model_embedding_mobilenet_v2_bytecode_module_dylib"
+#    FLAGS
+#      "-iree-input-type=tosa"
+#      "-riscv-v-vector-bits-min=512"
+#      "-riscv-v-fixed-length-vector-lmul-max=8"
+#      "-riscv-v-fixed-length-vector-elen-max=32"
+#    PUBLIC
+#  )
+
+  springbok_bytecode_module(
+    NAME
+      scenenet_v2_bytecode_module_dylib
+    SRC
+      "$ENV{ROOTDIR}/ml/ml-models/quant_models/scenenet_v2_quant.tflite"
+    C_IDENTIFIER
+      "samples_quant_model_embedding_scenenet_v2_bytecode_module_dylib"
+    FLAGS
+      "-iree-input-type=tosa"
+      "-riscv-v-vector-bits-min=512"
+      "-riscv-v-fixed-length-vector-lmul-max=8"
+      "-riscv-v-fixed-length-vector-elen-max=32"
+    PUBLIC
+  )
+endif()
+
+springbok_bytecode_module(
+  NAME
+    barcode_bytecode_module_dylib
+  SRC
+    "$ENV{ROOTDIR}/ml/ml-models/quant_models/barcode_quant.tflite"
+  C_IDENTIFIER
+    "samples_quant_model_embedding_barcode_bytecode_module_dylib"
+  FLAGS
+    "-iree-input-type=tosa"
+    "-riscv-v-vector-bits-min=512"
+    "-riscv-v-fixed-length-vector-lmul-max=8"
+    "-riscv-v-fixed-length-vector-elen-max=32"
+  PUBLIC
+)
+
+springbok_bytecode_module(
+  NAME
+    daredevil_bytecode_module_dylib
+  SRC
+    "$ENV{ROOTDIR}/ml/ml-models/quant_models/daredevil_quant.tflite"
+  C_IDENTIFIER
+    "samples_quant_model_embedding_daredevil_bytecode_module_dylib"
+  FLAGS
+    "-iree-input-type=tosa"
+    "-riscv-v-vector-bits-min=512"
+    "-riscv-v-fixed-length-vector-lmul-max=8"
+    "-riscv-v-fixed-length-vector-elen-max=32"
+  PUBLIC
+)
+
+springbok_bytecode_module(
+  NAME
+    fssd_25_8bit_v2_bytecode_module_dylib
+  SRC
+    "$ENV{ROOTDIR}/ml/ml-models/quant_models/fssd_25_8bit_v2_quant.tflite"
+  C_IDENTIFIER
+    "samples_quant_model_embedding_fssd_25_8bit_v2_bytecode_module_dylib"
+  FLAGS
+    "-iree-input-type=tosa"
+    "-riscv-v-vector-bits-min=512"
+    "-riscv-v-fixed-length-vector-lmul-max=8"
+    "-riscv-v-fixed-length-vector-elen-max=32"
+  PUBLIC
+)
+
+# TODO(b/198476354): uncomment below after operator tosa.clz is supported
+#springbok_bytecode_module(
+#  NAME
+#    mobilenet_v1_bytecode_module_dylib
+#  SRC
+#    "$ENV{ROOTDIR}/ml/ml-models/quant_models/mobilenet_v1_0.25_224_quant.tflite"
+#  C_IDENTIFIER
+#    "samples_quant_model_embedding_mobilenet_v1_bytecode_module_dylib"
+#  FLAGS
+#    "-iree-input-type=tosa"
+#    "-riscv-v-vector-bits-min=512"
+#    "-riscv-v-fixed-length-vector-lmul-max=8"
+#    "-riscv-v-fixed-length-vector-elen-max=32"
+#  PUBLIC
+#)
+
+#springbok_bytecode_module(
+#  NAME
+#    person_detection_bytecode_module_dylib
+#  SRC
+#    "$ENV{ROOTDIR}/ml/ml-models/quant_models/person_detection_quant.tflite"
+#  C_IDENTIFIER
+#    "samples_quant_model_embedding_person_detection_bytecode_module_dylib"
+#  FLAGS
+#    "-iree-input-type=tosa"
+#    "-riscv-v-vector-bits-min=512"
+#    "-riscv-v-fixed-length-vector-lmul-max=8"
+#    "-riscv-v-fixed-length-vector-elen-max=32"
+#  PUBLIC
+#)
+
+springbok_bytecode_module(
+  NAME
+    voice_commands_bytecode_module_dylib
+  SRC
+    "$ENV{ROOTDIR}/ml/ml-models/quant_models/voice_commands_quant.tflite"
+  C_IDENTIFIER
+    "samples_quant_model_embedding_voice_commands_bytecode_module_dylib"
+  FLAGS
+    "-iree-input-type=tosa"
+    "-riscv-v-vector-bits-min=512"
+    "-riscv-v-fixed-length-vector-lmul-max=8"
+    "-riscv-v-fixed-length-vector-elen-max=32"
+  PUBLIC
+)
+
+#-------------------------------------------------------------------------------
+# Binaries to execute the MLIR bytecode modules
+#-------------------------------------------------------------------------------
+
+
+# If the program requires a larger stack size, add
+#
+#   LINKOPTS
+#     "LINKER:--defsym=__stack_size__=<new stack size>"
+#
+# to increase it.
+
+# Currently only the daredevil model can run with springbok (b/196910893)
+
+if(NOT ${BUILD_WITH_SPRINGBOK})
+# TODO(b/198476354): uncomment below after operator tosa.clz is supported
+#  iree_cc_binary(
+#    NAME
+#      mobilenet_v2_embedded_sync
+#    SRCS
+#      "mobilenet_v2.c"
+#    DEPS
+#      ::mobilenet_v2_bytecode_module_dylib_c
+#      samples::util::util
+#  )
+
+  iree_cc_binary(
+    NAME
+      scenenet_v2_embedded_sync
+    SRCS
+      "scenenet_v2.c"
+    DEPS
+      ::scenenet_v2_bytecode_module_dylib_c
+      samples::util::util
+  )
+endif()
+
+iree_cc_binary(
+  NAME
+    barcode_embedded_sync
+  SRCS
+    "barcode.c"
+  DEPS
+    ::barcode_bytecode_module_dylib_c
+    samples::util::util
+  LINKOPTS
+    "LINKER:--defsym=__stack_size__=100k"
+)
+
+iree_cc_binary(
+  NAME
+    daredevil_embedded_sync
+  SRCS
+    "daredevil.c"
+  DEPS
+    ::daredevil_bytecode_module_dylib_c
+    samples::util::util
+  LINKOPTS
+    "LINKER:--defsym=__stack_size__=100k"
+)
+
+iree_cc_binary(
+  NAME
+    fssd_25_8bit_v2_embedded_sync
+  SRCS
+    "fssd_25_8bit_v2.c"
+  DEPS
+    ::fssd_25_8bit_v2_bytecode_module_dylib_c
+    samples::util::util
+  LINKOPTS
+    "LINKER:--defsym=__stack_size__=100k"
+)
+
+# TODO(b/198476354): uncomment below after operator tosa.clz is supported
+#iree_cc_binary(
+#  NAME
+#    mobilenet_v1_embedded_sync
+#  SRCS
+#    "mobilenet_v1.c"
+#  DEPS
+#    ::mobilenet_v1_bytecode_module_dylib_c
+#    samples::util::util
+#  LINKOPTS
+#    "LINKER:--defsym=__stack_size__=100k"
+#)
+
+#iree_cc_binary(
+#  NAME
+#    person_detection_embedded_sync
+#  SRCS
+#    "person_detection.c"
+#  DEPS
+#    ::person_detection_bytecode_module_dylib_c
+#    samples::util::util
+#  LINKOPTS
+#    "LINKER:--defsym=__stack_size__=100k"
+#)
+
+iree_cc_binary(
+  NAME
+    voice_commands_embedded_sync
+  SRCS
+    "voice_commands.c"
+  DEPS
+    ::voice_commands_bytecode_module_dylib_c
+    samples::util::util
+)
diff --git a/samples/quant_model_embedding/barcode.c b/samples/quant_model_embedding/barcode.c
new file mode 100644
index 0000000..4f89811
--- /dev/null
+++ b/samples/quant_model_embedding/barcode.c
@@ -0,0 +1,56 @@
+// Barcode quant model
+// MlModel struct initialization to include model I/O info.
+// Bytecode loading, input/output processes.
+
+#include <springbok.h>
+
+#include "iree/base/api.h"
+#include "iree/hal/api.h"
+#include "samples/util/util.h"
+
+// Compiled module embedded here to avoid file IO:
+#include "samples/quant_model_embedding/barcode_bytecode_module_dylib_c.h"
+
+const MlModel kModel = {
+    .num_input_dim = 4,
+    .input_shape = {1, 320, 320, 1},
+    .input_length = 320 * 320 * 1,
+    .input_size_bytes = sizeof(uint8_t),
+    .num_output = 12,
+    .output_length = {20 * 20 * 36, 20 * 20 * 9, 10 * 10 * 72, 10 * 10 * 18,
+                      5 * 5 * 72, 5 * 5 * 18, 3 * 3 * 72, 3 * 3 * 18,
+                      2 * 2 * 72, 2 * 2 * 18, 72, 18},
+    .output_size_bytes = sizeof(uint8_t),
+    .hal_element_type = IREE_HAL_ELEMENT_TYPE_UINT_8,
+    .model_name = "barcode_quant",
+};
+
+const iree_const_byte_span_t load_bytecode_module_data() {
+  const struct iree_file_toc_t *module_file_toc =
+      samples_quant_model_embedding_barcode_bytecode_module_dylib_create();
+  return iree_make_const_byte_span(module_file_toc->data,
+                                   module_file_toc->size);
+}
+
+iree_status_t load_input_data(const MlModel *model, void **buffer) {
+  // Populate initial value
+  srand(768954);
+  for (int i = 0; i < model->input_length; ++i) {
+    ((uint8_t *)*buffer)[i] = rand() % 256;
+  }
+  return iree_ok_status();
+}
+
+iree_status_t check_output_data(const MlModel *model,
+                                iree_hal_buffer_mapping_t *mapped_memory,
+                                int index_output) {
+  iree_status_t result = iree_ok_status();
+  if (index_output > model->num_output ||
+      mapped_memory->contents.data_length / model->output_size_bytes !=
+          model->output_length[index_output]) {
+    result = iree_make_status(IREE_STATUS_UNKNOWN, "output length mismatches");
+  }
+  LOG_INFO("Output #%d data length: %d \n", index_output,
+           mapped_memory->contents.data_length / model->output_size_bytes);
+  return result;
+}
diff --git a/samples/quant_model_embedding/daredevil.c b/samples/quant_model_embedding/daredevil.c
new file mode 100644
index 0000000..c234929
--- /dev/null
+++ b/samples/quant_model_embedding/daredevil.c
@@ -0,0 +1,54 @@
+// Daredevil quant model
+// MlModel struct initialization to include model I/O info.
+// Bytecode loading, input/output processes.
+
+#include <springbok.h>
+
+#include "iree/base/api.h"
+#include "iree/hal/api.h"
+#include "samples/util/util.h"
+
+// Compiled module embedded here to avoid file IO:
+#include "samples/quant_model_embedding/daredevil_bytecode_module_dylib_c.h"
+
+const MlModel kModel = {
+    .num_input_dim = 3,
+    .input_shape = {1, 96, 64},
+    .input_length = 96 * 64,
+    .input_size_bytes = sizeof(uint8_t),
+    .num_output = 1,
+    .output_length = {527},
+    .output_size_bytes = sizeof(uint8_t),
+    .hal_element_type = IREE_HAL_ELEMENT_TYPE_UINT_8,
+    .model_name = "daredevil_quant",
+};
+
+const iree_const_byte_span_t load_bytecode_module_data() {
+  const struct iree_file_toc_t *module_file_toc =
+      samples_quant_model_embedding_daredevil_bytecode_module_dylib_create();
+  return iree_make_const_byte_span(module_file_toc->data,
+                                   module_file_toc->size);
+}
+
+iree_status_t load_input_data(const MlModel *model, void **buffer) {
+  // Populate initial value
+  srand(3689964);
+  for (int i = 0; i < model->input_length; ++i) {
+    ((uint8_t *)*buffer)[i] = rand() % 256;
+  }
+  return iree_ok_status();
+}
+
+iree_status_t check_output_data(const MlModel *model,
+                                iree_hal_buffer_mapping_t *mapped_memory,
+                                int index_output) {
+  iree_status_t result = iree_ok_status();
+  if (index_output > model->num_output ||
+      mapped_memory->contents.data_length / model->output_size_bytes !=
+          model->output_length[index_output]) {
+    result = iree_make_status(IREE_STATUS_UNKNOWN, "output length mismatches");
+  }
+  LOG_INFO("Output #%d data length: %d \n", index_output,
+           mapped_memory->contents.data_length / model->output_size_bytes);
+  return result;
+}
diff --git a/samples/quant_model_embedding/fssd_25_8bit_v2.c b/samples/quant_model_embedding/fssd_25_8bit_v2.c
new file mode 100644
index 0000000..ad72fac
--- /dev/null
+++ b/samples/quant_model_embedding/fssd_25_8bit_v2.c
@@ -0,0 +1,55 @@
+// Fssd_25_8bit_v2 quant model
+// MlModel struct initialization to include model I/O info.
+// Bytecode loading, input/output processes.
+
+#include <springbok.h>
+
+#include "iree/base/api.h"
+#include "iree/hal/api.h"
+#include "samples/util/util.h"
+
+// Compiled module embedded here to avoid file IO:
+#include "samples/quant_model_embedding/fssd_25_8bit_v2_bytecode_module_dylib_c.h"
+
+const MlModel kModel = {
+    .num_input_dim = 4,
+    .input_shape = {1, 320, 320, 3},
+    .input_length = 320 * 320 * 3,
+    .input_size_bytes = sizeof(uint8_t),
+    .num_output = 8,
+    .output_length = {20 * 20 * 48, 20 * 20 * 3, 10 * 10 * 48, 10 * 10 * 3,
+                      5 * 5 * 48, 5 * 5 * 3, 3 * 3 * 48, 3 * 3 * 3},
+    .output_size_bytes = sizeof(uint8_t),
+    .hal_element_type = IREE_HAL_ELEMENT_TYPE_UINT_8,
+    .model_name = "fssd_25_8bit_v2_quant",
+};
+
+const iree_const_byte_span_t load_bytecode_module_data() {
+  const struct iree_file_toc_t *module_file_toc =
+      samples_quant_model_embedding_fssd_25_8bit_v2_bytecode_module_dylib_create();
+  return iree_make_const_byte_span(module_file_toc->data,
+                                   module_file_toc->size);
+}
+
+iree_status_t load_input_data(const MlModel *model, void **buffer) {
+  // Populate initial value
+  srand(11111111);
+  for (int i = 0; i < model->input_length; ++i) {
+    ((uint8_t *)*buffer)[i] = rand() % 256;
+  }
+  return iree_ok_status();
+}
+
+iree_status_t check_output_data(const MlModel *model,
+                                iree_hal_buffer_mapping_t *mapped_memory,
+                                int index_output) {
+  iree_status_t result = iree_ok_status();
+  if (index_output > model->num_output ||
+      mapped_memory->contents.data_length / model->output_size_bytes !=
+          model->output_length[index_output]) {
+    result = iree_make_status(IREE_STATUS_UNKNOWN, "output length mismatches");
+  }
+  LOG_INFO("Output #%d data length: %d \n", index_output,
+           mapped_memory->contents.data_length / model->output_size_bytes);
+  return result;
+}
diff --git a/samples/quant_model_embedding/mobilenet_v1.c b/samples/quant_model_embedding/mobilenet_v1.c
new file mode 100644
index 0000000..b75aca5
--- /dev/null
+++ b/samples/quant_model_embedding/mobilenet_v1.c
@@ -0,0 +1,54 @@
+// Mobilenet_v1_0.25_224 quant model
+// MlModel struct initialization to include model I/O info.
+// Bytecode loading, input/output processes.
+
+#include <springbok.h>
+
+#include "iree/base/api.h"
+#include "iree/hal/api.h"
+#include "samples/util/util.h"
+
+// Compiled module embedded here to avoid file IO:
+#include "samples/quant_model_embedding/mobilenet_v1_bytecode_module_dylib_c.h"
+
+const MlModel kModel = {
+    .num_input_dim = 4,
+    .input_shape = {1, 224, 224, 3},
+    .input_length = 224 * 224 * 3,
+    .input_size_bytes = sizeof(uint8_t),
+    .num_output = 1,
+    .output_length = {1001},
+    .output_size_bytes = sizeof(uint8_t),
+    .hal_element_type = IREE_HAL_ELEMENT_TYPE_UINT_8,
+    .model_name = "mobilenet_v1_0.25_224_quant",
+};
+
+const iree_const_byte_span_t load_bytecode_module_data() {
+  const struct iree_file_toc_t *module_file_toc =
+      samples_quant_model_embedding_mobilenet_v1_bytecode_module_dylib_create();
+  return iree_make_const_byte_span(module_file_toc->data,
+                                   module_file_toc->size);
+}
+
+iree_status_t load_input_data(const MlModel *model, void **buffer) {
+  // Populate initial value
+  srand(33333333);
+  for (int i = 0; i < model->input_length; ++i) {
+    ((uint8_t *)*buffer)[i] = rand() % 256;
+  }
+  return iree_ok_status();
+}
+
+iree_status_t check_output_data(const MlModel *model,
+                                iree_hal_buffer_mapping_t *mapped_memory,
+                                int index_output) {
+  iree_status_t result = iree_ok_status();
+  if (index_output > model->num_output ||
+      mapped_memory->contents.data_length / model->output_size_bytes !=
+          model->output_length[index_output]) {
+    result = iree_make_status(IREE_STATUS_UNKNOWN, "output length mismatches");
+  }
+  LOG_INFO("Output #%d data length: %d \n", index_output,
+           mapped_memory->contents.data_length / model->output_size_bytes);
+  return result;
+}
diff --git a/samples/quant_model_embedding/mobilenet_v2.c b/samples/quant_model_embedding/mobilenet_v2.c
new file mode 100644
index 0000000..021171a
--- /dev/null
+++ b/samples/quant_model_embedding/mobilenet_v2.c
@@ -0,0 +1,54 @@
+// Mobilenet_v2_1.0_224 quant model
+// MlModel struct initialization to include model I/O info.
+// Bytecode loading, input/output processes.
+
+#include <springbok.h>
+
+#include "iree/base/api.h"
+#include "iree/hal/api.h"
+#include "samples/util/util.h"
+
+// Compiled module embedded here to avoid file IO:
+#include "samples/quant_model_embedding/mobilenet_v2_bytecode_module_dylib_c.h"
+
+const MlModel kModel = {
+    .num_input_dim = 4,
+    .input_shape = {1, 224, 224, 3},
+    .input_length = 224 * 224 * 3,
+    .input_size_bytes = sizeof(uint8_t),
+    .num_output = 1,
+    .output_length = {1001},
+    .output_size_bytes = sizeof(uint8_t),
+    .hal_element_type = IREE_HAL_ELEMENT_TYPE_UINT_8,
+    .model_name = "mobilenet_v2_1.0_224_quant",
+};
+
+const iree_const_byte_span_t load_bytecode_module_data() {
+  const struct iree_file_toc_t *module_file_toc =
+      samples_quant_model_embedding_mobilenet_v2_bytecode_module_dylib_create();
+  return iree_make_const_byte_span(module_file_toc->data,
+                                   module_file_toc->size);
+}
+
+iree_status_t load_input_data(const MlModel *model, void **buffer) {
+  // Populate initial value
+  srand(33333333);
+  for (int i = 0; i < model->input_length; ++i) {
+    ((uint8_t *)*buffer)[i] = rand() % 256;
+  }
+  return iree_ok_status();
+}
+
+iree_status_t check_output_data(const MlModel *model,
+                                iree_hal_buffer_mapping_t *mapped_memory,
+                                int index_output) {
+  iree_status_t result = iree_ok_status();
+  if (index_output > model->num_output ||
+      mapped_memory->contents.data_length / model->output_size_bytes !=
+          model->output_length[index_output]) {
+    result = iree_make_status(IREE_STATUS_UNKNOWN, "output length mismatches");
+  }
+  LOG_INFO("Output #%d data length: %d \n", index_output,
+           mapped_memory->contents.data_length / model->output_size_bytes);
+  return result;
+}
diff --git a/samples/quant_model_embedding/person_detection.c b/samples/quant_model_embedding/person_detection.c
new file mode 100644
index 0000000..fc10fd9
--- /dev/null
+++ b/samples/quant_model_embedding/person_detection.c
@@ -0,0 +1,54 @@
+// Person_detection quant model
+// MlModel struct initialization to include model I/O info.
+// Bytecode loading, input/output processes.
+
+#include <springbok.h>
+
+#include "iree/base/api.h"
+#include "iree/hal/api.h"
+#include "samples/util/util.h"
+
+// Compiled module embedded here to avoid file IO:
+#include "samples/quant_model_embedding/person_detection_bytecode_module_dylib_c.h"
+
+const MlModel kModel = {
+    .num_input_dim = 4,
+    .input_shape = {1, 96, 96, 1},
+    .input_length = 96 * 96 * 1,
+    .input_size_bytes = sizeof(int8_t),
+    .num_output = 1,
+    .output_length = {2},
+    .output_size_bytes = sizeof(int8_t),
+    .hal_element_type = IREE_HAL_ELEMENT_TYPE_SINT_8,
+    .model_name = "person_detection_quant",
+};
+
+const iree_const_byte_span_t load_bytecode_module_data() {
+  const struct iree_file_toc_t *module_file_toc =
+      samples_quant_model_embedding_person_detection_bytecode_module_dylib_create();
+  return iree_make_const_byte_span(module_file_toc->data,
+                                   module_file_toc->size);
+}
+
+iree_status_t load_input_data(const MlModel *model, void **buffer) {
+  // Populate initial value
+  srand(44444444);
+  for (int i = 0; i < model->input_length; ++i) {
+    ((int8_t *)*buffer)[i] = rand() % 256 - 128;
+  }
+  return iree_ok_status();
+}
+
+iree_status_t check_output_data(const MlModel *model,
+                                iree_hal_buffer_mapping_t *mapped_memory,
+                                int index_output) {
+  iree_status_t result = iree_ok_status();
+  if (index_output > model->num_output ||
+      mapped_memory->contents.data_length / model->output_size_bytes !=
+          model->output_length[index_output]) {
+    result = iree_make_status(IREE_STATUS_UNKNOWN, "output length mismatches");
+  }
+  LOG_INFO("Output #%d data length: %d \n", index_output,
+           mapped_memory->contents.data_length / model->output_size_bytes);
+  return result;
+}
diff --git a/samples/quant_model_embedding/scenenet_v2.c b/samples/quant_model_embedding/scenenet_v2.c
new file mode 100644
index 0000000..9678eae
--- /dev/null
+++ b/samples/quant_model_embedding/scenenet_v2.c
@@ -0,0 +1,54 @@
+// Scenenet_v2 quant model
+// MlModel struct initialization to include model I/O info.
+// Bytecode loading, input/output processes.
+
+#include <springbok.h>
+
+#include "iree/base/api.h"
+#include "iree/hal/api.h"
+#include "samples/util/util.h"
+
+// Compiled module embedded here to avoid file IO:
+#include "samples/quant_model_embedding/scenenet_v2_bytecode_module_dylib_c.h"
+
+const MlModel kModel = {
+    .num_input_dim = 4,
+    .input_shape = {1, 192, 192, 3},
+    .input_length = 192 * 192 * 3,
+    .input_size_bytes = sizeof(uint8_t),
+    .num_output = 1,
+    .output_length = {170},
+    .output_size_bytes = sizeof(float),
+    .hal_element_type = IREE_HAL_ELEMENT_TYPE_UINT_8,
+    .model_name = "scenenet_v2_quant",
+};
+
+const iree_const_byte_span_t load_bytecode_module_data() {
+  const struct iree_file_toc_t *module_file_toc =
+      samples_quant_model_embedding_scenenet_v2_bytecode_module_dylib_create();
+  return iree_make_const_byte_span(module_file_toc->data,
+                                   module_file_toc->size);
+}
+
+iree_status_t load_input_data(const MlModel *model, void **buffer) {
+  // Populate initial value
+  srand(55555555);
+  for (int i = 0; i < model->input_length; ++i) {
+    ((uint8_t *)*buffer)[i] = rand() % 256;
+  }
+  return iree_ok_status();
+}
+
+iree_status_t check_output_data(const MlModel *model,
+                                iree_hal_buffer_mapping_t *mapped_memory,
+                                int index_output) {
+  iree_status_t result = iree_ok_status();
+  if (index_output > model->num_output ||
+      mapped_memory->contents.data_length / model->output_size_bytes !=
+          model->output_length[index_output]) {
+    result = iree_make_status(IREE_STATUS_UNKNOWN, "output length mismatches");
+  }
+  LOG_INFO("Output #%d data length: %d \n", index_output,
+           mapped_memory->contents.data_length / model->output_size_bytes);
+  return result;
+}
diff --git a/samples/quant_model_embedding/voice_commands.c b/samples/quant_model_embedding/voice_commands.c
new file mode 100644
index 0000000..ca725f3
--- /dev/null
+++ b/samples/quant_model_embedding/voice_commands.c
@@ -0,0 +1,54 @@
+// Voice_commands quant model
+// MlModel struct initialization to include model I/O info.
+// Bytecode loading, input/output processes.
+
+#include <springbok.h>
+
+#include "iree/base/api.h"
+#include "iree/hal/api.h"
+#include "samples/util/util.h"
+
+// Compiled module embedded here to avoid file IO:
+#include "samples/quant_model_embedding/voice_commands_bytecode_module_dylib_c.h"
+
+const MlModel kModel = {
+    .num_input_dim = 3,
+    .input_shape = {1, 198, 32},
+    .input_length = 198 * 32,
+    .input_size_bytes = sizeof(uint8_t),
+    .num_output = 1,
+    .output_length = {63},
+    .output_size_bytes = sizeof(float),
+    .hal_element_type = IREE_HAL_ELEMENT_TYPE_UINT_8,
+    .model_name = "voice_commands_quant",
+};
+
+const iree_const_byte_span_t load_bytecode_module_data() {
+  const struct iree_file_toc_t *module_file_toc =
+      samples_quant_model_embedding_voice_commands_bytecode_module_dylib_create();
+  return iree_make_const_byte_span(module_file_toc->data,
+                                   module_file_toc->size);
+}
+
+iree_status_t load_input_data(const MlModel *model, void **buffer) {
+  // Populate initial value
+  srand(77777777);
+  for (int i = 0; i < model->input_length; ++i) {
+    ((uint8_t *)*buffer)[i] = rand() % 256;
+  }
+  return iree_ok_status();
+}
+
+iree_status_t check_output_data(const MlModel *model,
+                                iree_hal_buffer_mapping_t *mapped_memory,
+                                int index_output) {
+  iree_status_t result = iree_ok_status();
+  if (index_output > model->num_output ||
+      mapped_memory->contents.data_length / model->output_size_bytes !=
+          model->output_length[index_output]) {
+    result = iree_make_status(IREE_STATUS_UNKNOWN, "output length mismatches");
+  }
+  LOG_INFO("Output #%d data length: %d \n", index_output,
+           mapped_memory->contents.data_length / model->output_size_bytes);
+  return result;
+}