blob: 333c243e3ff1be04b486750e0f020c4273f237c4 [file] [log] [blame]
#-------------------------------------------------------------------------------
# Build the mlir bytecode modules with iree-translate. Note the last three flags
# are for RVV support.
#-------------------------------------------------------------------------------
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-public/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
# )
endif()
# 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-public/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-public/quant_models/person_detection.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
# )
if(${BUILD_INTERNAL_MODELS})
if(NOT ${BUILD_WITH_SPRINGBOK})
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
)
springbok_bytecode_module(
NAME
semantic_lift_bytecode_module_dylib
SRC
"$ENV{ROOTDIR}/ml/ml-models/quant_models/semantic_lift_quant.tflite"
C_IDENTIFIER
"samples_quant_model_embedding_semantic_lift_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
)
endif(${BUILD_INTERNAL_MODELS})
#-------------------------------------------------------------------------------
# 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 daredevil and semantic_lift 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
# )
endif()
# 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"
# )
if(NOT ${BUILD_INTERNAL_MODELS})
return()
endif()
if(NOT ${BUILD_WITH_SPRINGBOK})
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"
)
iree_cc_binary(
NAME
semantic_lift_embedded_sync
SRCS
"semantic_lift.c"
DEPS
::semantic_lift_bytecode_module_dylib_c
samples::util::util
LINKOPTS
"LINKER:--defsym=__stack_size__=20k"
)
iree_cc_binary(
NAME
voice_commands_embedded_sync
SRCS
"voice_commands.c"
DEPS
::voice_commands_bytecode_module_dylib_c
samples::util::util
)