build/nexus: add soundstream encoder model & sound test app Change-Id: Ieb6ca9cab6f15cbb8e3437b0c156d3a05c97ca80
diff --git a/cantrip_apps.mk b/cantrip_apps.mk index 7acb193..8715d1c 100644 --- a/cantrip_apps.mk +++ b/cantrip_apps.mk
@@ -126,6 +126,11 @@ ## Build the playback Rust application in release mode. playback_release: $(CANTRIP_OUT_RUST_APP_RELEASE)/playback/playback.app +## Build the sound Rust application in debug mode. +sound_debug: $(CANTRIP_OUT_RUST_APP_DEBUG)/sound/sound.app +## Build the sound Rust application in release mode. +sound_release: $(CANTRIP_OUT_RUST_APP_RELEASE)/sound/sound.app + ## Build the suicide C application in debug mode. suicide_debug: $(CANTRIP_OUT_C_APP_DEBUG)/suicide/suicide.app ## Build the suicide C application in release mode. @@ -143,5 +148,6 @@ .PHONY:: mltest_debug mltest_release .PHONY:: panic_debug panic_release .PHONY:: playback_debug playback_release +.PHONY:: sound_debug sound_release .PHONY:: suicide_debug suicide_release .PHONY:: timer_debug timer_release
diff --git a/platforms/nexus/cantrip_builtins.mk b/platforms/nexus/cantrip_builtins.mk index da2bc99..c8d5c33 100644 --- a/platforms/nexus/cantrip_builtins.mk +++ b/platforms/nexus/cantrip_builtins.mk
@@ -19,10 +19,17 @@ $(CANTRIP_OUT_RUST_APP_RELEASE)/mltest/mltest.app \ $(CANTRIP_OUT_RUST_APP_RELEASE)/panic/panic.app \ $(CANTRIP_OUT_RUST_APP_RELEASE)/playback/playback.app \ + $(CANTRIP_OUT_RUST_APP_RELEASE)/sound/sound.app \ $(CANTRIP_OUT_C_APP_RELEASE)/suicide/suicide.app \ $(CANTRIP_OUT_RUST_APP_RELEASE)/timer/timer.app -# Temporarily have only 5M for builtins; not enough for an IREE model -CANTRIP_MODEL_RELEASE := $(OUT)//kelvin/sw/bazel_out/hello_world.kelvin +# Builtins are loaded from SPI flash which is 16M by default +CANTRIP_MODEL_RELEASE := $(OUT)/kelvin/sw/bazel_out/hello_world.kelvin \ + $(OUT)/kelvin_iree/sparrow_iree/samples/microbenchmarks/conv1x1_test_emitc_static.kelvin +ifneq ("$(wildcard $(ROOTDIR)/ml/ml-models)", "") +CANTRIP_MODEL_RELEASE += $(OUT)/kelvin/sw/bazel_out/soundstream_encoder_non_streaming.kelvin +else +# TODO(sleffler): fallback to IREE version +endif CANTRIP_APPS_DEBUG := $(CANTRIP_OUT_C_APP_DEBUG)/hello/hello.app \ $(CANTRIP_OUT_RUST_APP_DEBUG)/fibonacci/fibonacci.app \ @@ -31,12 +38,13 @@ $(CANTRIP_OUT_RUST_APP_DEBUG)/mltest/mltest.app \ $(CANTRIP_OUT_RUST_APP_DEBUG)/panic/panic.app \ $(CANTRIP_OUT_RUST_APP_DEBUG)/playback/playback.app \ + $(CANTRIP_OUT_RUST_APP_DEBUG)/sound/sound.app \ $(CANTRIP_OUT_C_APP_DEBUG)/suicide/suicide.app \ $(CANTRIP_OUT_RUST_APP_DEBUG)/timer/timer.app # NB: debug builds only run on Renode where we have 16M for builtins -CANTRIP_MODEL_DEBUG := $(OUT)/kelvin_iree/sparrow_iree/samples/microbenchmarks/conv1x1_test_emitc_static +CANTRIP_MODEL_DEBUG := $(OUT)/kelvin_iree/sparrow_iree/samples/microbenchmarks/conv1x1_test_emitc_static.kelvin CANTRIP_SCRIPTS := $(ROOTDIR)/build/platforms/$(PLATFORM)/builtins.repl -$(patsubst %.kelvin,%.elf,$(CANTRIP_MODEL_RELEASE)): kelvin_hello_world +$(patsubst %.kelvin,%.elf,$(CANTRIP_MODEL_RELEASE)): kelvin_hello_world kelvin_soundstream $(CANTRIP_MODEL_DEBUG): iree_model_builtins
diff --git a/platforms/nexus/kelvin.mk b/platforms/nexus/kelvin.mk index 94ac8f8..7c38932 100644 --- a/platforms/nexus/kelvin.mk +++ b/platforms/nexus/kelvin.mk
@@ -13,6 +13,7 @@ KELVIN_SIM_SRC_DIR := $(ROOTDIR)/sim/kelvin KELVIN_SIM_OUT_DIR := $(OUT)/kelvin/sim +MODEL_INTERNAL_SRC_DIR:=$(ROOTDIR)/ml/ml-models $(KELVIN_SW_BAZEL_OUT_DIR): mkdir -p "$(KELVIN_SW_BAZEL_OUT_DIR)" @@ -43,6 +44,13 @@ -wholename "*ST-*/*.bin" \) \ -exec cp -f {} "$(KELVIN_SW_BAZEL_OUT_DIR)/" \; +## Build Kelvin soundstream artifacts +kelvin_soundstream: | $(KELVIN_SW_BAZEL_OUT_DIR) + cd "$(MODEL_INTERNAL_SRC_DIR)" && \ + bazel build //quant_models/tflm/soundstream:soundstream_encoder_non_streaming && \ + cd bazel-out ; find . -type f -wholename "*ST-*/*.elf" \ + -exec cp -f {} "$(KELVIN_SW_BAZEL_OUT_DIR)/" \; + ## Test Kelvin SW artifacts # @@ -115,5 +123,7 @@ rm -rf $(KELVIN_SIM_OUT_DIR) PHONY:: kelvin_hw_clean kelvin_hw_sim kelvin_hw_test kelvin_hw_verilog -PHONY:: kelvin_sw kelvin_sw_clean kelvin_sw_test kelvin_hello_world +PHONY:: kelvin_sw kelvin_sw_clean kelvin_sw_test +PHONY:: kelvin_hello_world +PHONY:: kelvin_soundstream PHONY:: kelvin_sim kelvin_sim_clean