Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [High] accel: ethosu: missing NPU_SET_IFM_UPSCALE check in feat_matrix_validate() --
commit a2e33d72a9a5c1a79fd1f24546e3bdc167a7ece4 Author: Rob Herring (Arm) <[email protected]> accel: ethosu: Support IFM upscaling This commit tracks NPU_SET_IFM_UPSCALE during command stream validation, adjusts IFM bounds for 2x resampling modes, and rejects incompatible stride, chained storage, resize, and pooling configurations. > diff --git a/drivers/accel/ethosu/ethosu_gem.c > b/drivers/accel/ethosu/ethosu_gem.c > index d2884d9922aea..b4544298742f1 100644 > --- a/drivers/accel/ethosu/ethosu_gem.c > +++ b/drivers/accel/ethosu/ethosu_gem.c [ ... ] > @@ -402,6 +403,11 @@ static int feat_matrix_validate(struct ethosu_device > *edev, > !cmd_state_reg_is_set(st, NPU_SET_IFM_PRECISION) || > !cmd_state_reg_is_set(st, NPU_SET_IFM_DEPTH_M1)) > return -EINVAL; > + if (st->ifm_upscale && > + (!cmd_state_reg_is_set(st, NPU_SET_KERNEL_STRIDE) || > + feat_matrix_chained(edev, fm) || > + (st->ifm.stride_kernel & (BIT(0) | BIT(1) | BIT(6) | > BIT(9))))) > + return -EINVAL; > if (feat_matrix_chained(edev, fm)) > return 0; > if (!cmd_state_reg_is_set(st, NPU_SET_IFM_WIDTH0_M1) || [Severity: High] Should feat_matrix_validate() require cmd_state_reg_is_set(st, NPU_SET_IFM_UPSCALE) for FEAT_MATRIX_IFM? The NPU is not reset between consecutive jobs, so NPU_SET_IFM_UPSCALE persists in hardware from a previous job while cmd_state_init() zero-initializes st->ifm_upscale to NPU_IFM_UPSCALE_NONE. If a second job omits NPU_SET_IFM_UPSCALE, it runs with IFM upscaling enabled in hardware while validation checks st->ifm_upscale == NPU_IFM_UPSCALE_NONE, bypassing the chained-IFM and kernel-stride checks here as well as the upscaling restrictions in calc_sizes_resize() and NPU_OP_POOL. -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=18
