Hello Radxa Community,
thank you for the Fogwise Airbox hardware.
I really appreciate the product and the documentation.
Also, thank you very much for the Fogwise® AIRbox Q900. I didn’t expect such a significant increase in performance.
I’m working on getting TPU-MLIR running to compile models for the Airbox, and I’ve hit multiple build issues that I’d like to ask for guidance on. I’ve been stuck on this for a while and feel like I’m missing something obvious. Perhaps the error lies with my environment.
Goal: Convert FLUX.1-Krea
I want to convert the model FLUX.1-Krea (Hugging Face: https://huggingface.co/black-forest-labs/FLUX.1-Krea-dev) to run on the Radxa Fogwise Airbox using the TPU-MLIR toolchain described here:
https://docs.radxa.com/en/sophon/airbox/model-compile/tpu_mlir_env
Also, the docs mention Flux model conversion as TODO:
https://docs.radxa.com/en/sophon/airbox/local-ai-deploy/text-to-image/flux_1
There is no step-by-step guide for Flux models. I would greatly appreciate any guidance or example conversion commands.
As I understand it, the conversion should be possible, since only the LoRA parts in Flux 1 Krea differ from Flux 1 Dev.
Environment & setup
- Host: Windows 11 (using Docker Desktop)
- Docker image used:
sophgo/tpuc_dev:latest(running inside WSL2 Docker) - Cloned repo: https://github.com/sophgo/tpu-mlir
- CMake: 3.25.x (from container)
- Compilers seen during build: clang 14 (container image), gcc 11 (used when using Unix Makefiles)
- Tried both Ninja and Unix Makefiles (Ninja had a lexing error with this container; switching to Unix Makefiles avoided that specific issue)
What I tried (summary)
- Cloned
sophgo/tpu-mlir - Fixed Windows CRLF problems.
- Ninja produced
ninja: error: build.ninja:37: lexing errorin this image; switching tocmake -G "Unix Makefiles"helped get past that. - Several missing directories/files were created as a workaround to continue the build:
-
mkdir -p /usr/local/python/debugger(to allow generated bmodel python output) - Created a small stub
/usr/local/python/utils/tpuc_cmd_builder.pybecause the builder script attempted to write/read it and failed in the container image.
-
- Many C++ warnings were being treated as errors (
-Werror), and several third-party files (e.g.cnpy) required exception support (-fexceptions) or suppression of specific warnings. I adjusted CMake flags and added local patches to:- add
-fexceptions - add
-Wno-error/-Wno-unused-variable/-Wno-return-typefor problematic targets
- add
- Changed a naming conflict in
include/tpu_mlir/.../LayerGroupDefs.hwhere a variable had the same name as a class; renamed the variable to avoid compile error.
Current state & blocking errors
After many fixes we are further but still blocked by the following build errors (examples copied from the build log):
- Missing python utility generation (I already worked around this by creating a stub file):
2025-10-12 05:53:14.394 | ERROR | **main**:generate_builder:195 - Generation failed: [Errno 2] No such file or directory: '/usr/local/python/utils/tpuc_cmd_builder.py'
FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/python/utils/tpuc_cmd_builder.py'
- Exception-handling disabled in some translation units (e.g.
cnpyand other code usingthroworcatch):
/workspace/tpu-mlir/third_party/cnpy/cnpy.cpp:163:66: error: exception handling disabled, use ‘-fexceptions’ to enable
163 | throw std::runtime_error("parse_npy_header: failed fread");
- Later in the build a
std::bad_variant_accesscatch fails due to exceptions disabled inRewriterConfigUtils.cpp:
/workspace/tpu-mlir/lib/Support/RewriterConfigUtils.cpp:215:5: error: exception handling disabled, use ‘-fexceptions’ to enable
215 | } catch (const std::bad_variant_access &) {
| ^~~~~
I tried forcing -fexceptions and -Wno-error via:
cmake .. -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_FLAGS="-O2 -fPIC -fexceptions -Wno-error -Wno-unused-variable -Wno-return-type"
and also added CMake-level add_compile_options(-fexceptions -Wno-error ...), but the build still surfaces files that appear to be compiled without exception support — this suggests some targets or third-party CMakeLists may explicitly set flags that override mine, or there are compile rules that need per-target fixes.
My Questions
-
Is there an officially recommended branch/commit/tag of
tpu-mlirthat Radxa uses and verifies for the Fogwise Airbox environment? -
Is there any prebuilt toolchain ? (That would tremendously speed things up).
-
Flux 1 Krea conversion guide: The docs mention Flux but the page is TODO — is there an internal / example workflow for converting Flux/FLUX.1 models to the Radxa/Tpu-mlir pipeline? Specifically:
Thank you very much for your help and support.
Best regards,
Matthias
