# KTC Local Patch Notes This file records local changes made to `ktc` so future updates can be re-applied and re-tested. ## 2026-01-28: Prefer prebuild toolchain binaries when USE_PREBUILD is set ### Why - Toolchain binaries/scripts were hard-coded to `/workspace/libs_V2` or `/workspace/libs`. - In this repo, we want to use `toolchain/prebuild` without modifying those system paths. ### Changes 1) **Add `_resolve_compiler_paths()` helper** File: `ktc/toolchain.py` - If `USE_PREBUILD` exists and is a directory, uses: - `prebuild/gen_config.py` - `prebuild/batch_compile` - `prebuild/kneron_nef_utils` - `prebuild/opt_compile` (via `OPT_COMPILE_DIR`) - Otherwise falls back to `LIBS_V1_FOLDER`/`LIBS_V2_FOLDER`. 2) **Use `_resolve_compiler_paths()` in these functions:** - `gen_config_for_single_model()` → uses `gen_config.py` from resolved path and sets `OPT_COMPILE_DIR`. - `generate_batch_conf()` → uses `gen_config.py` from resolved path. - `encrypt_compile()` → uses `batch_compile` (both 520 and non-520 cases) and `kneron_nef_utils` (for 730). ### Reapply checklist (if KTC updated) - Re-add `_resolve_compiler_paths()` helper to `ktc/toolchain.py`. - Rewire the call sites listed above to use the helper. ### Tests to run ``` pytest -s ./tests/workers/test_bie_core.py pytest -s ./tests/workers/test_nef_core.py ``` ### Notes - `kneron_nef_utils` must exist in `toolchain/prebuild/`. If missing, copy it from `libs_V2/compiler/`.