diff --git a/src/gallium/drivers/ethosu/ethosu_cmd.c b/src/gallium/drivers/ethosu/ethosu_cmd.c
index 18d6c5e345b..7ca89e884c9 100644
--- a/src/gallium/drivers/ethosu/ethosu_cmd.c
+++ b/src/gallium/drivers/ethosu/ethosu_cmd.c
@@ -539,16 +539,42 @@ emit_pooling(struct ethosu_subgraph *subgraph, struct ethosu_operation *operatio
emit_acc_format(subgraph, operation);
}
+static void
+emit_ifm2_precision(struct ethosu_subgraph *subgraph,
+ struct ethosu_operation *operation,
+ bool has_scalar)
+{
+ struct ethosu_tensor *tensor = ethosu_find_tensor(subgraph, operation->ifm2.tensor_idx);
+ unsigned prec = 0;
+
+ prec |= NPU_SET_IFM2_PRECISION_ACTIVATION_TYPE(operation->ifm2.is_signed);
+ prec |= NPU_SET_IFM2_PRECISION_ACTIVATION_PRECISION(operation->ifm2.precision);
+
+ if (tensor->layout == ETHOSU_LAYOUT_NHCWB16)
+ prec |= NPU_SET_IFM2_PRECISION_ACTIVATION_FORMAT(1);
+
+ /* Vela: scalar → NONE(3), non-scalar → TILE2X2(0) */
+ if (has_scalar)
+ prec |= NPU_SET_IFM2_PRECISION_ACTIVATION_STORAGE(3);
+
+ EMIT0(NPU_SET_IFM2_PRECISION, prec);
+}
+
static void
emit_ifm2(struct ethosu_subgraph *subgraph, struct ethosu_operation *operation, bool has_scalar)
{
- if (!has_scalar) {
+ if (has_scalar) {
+ if (ethosu_is_u65(ethosu_screen(subgraph->base.context->screen)))
+ EMIT0(NPU_SET_IFM2_SCALAR, operation->ifm2.scalar);
+ else {
+ emit_ifm2_precision(subgraph, operation, true);
+ EMIT1(NPU_SET_OP_SCALAR, 0, operation->ifm2.scalar);
+ }
+ } else {
EMIT0(NPU_SET_IFM2_REGION, IO_REGION);
emit_addresses(subgraph, &operation->ifm2, NPU_SET_IFM2_BASE0, NPU_SET_IFM2_BASE1, NPU_SET_IFM2_BASE2, NPU_SET_IFM2_BASE3);
emit_tiles(subgraph, &operation->ifm2, NPU_SET_IFM2_HEIGHT0_M1, NPU_SET_IFM2_HEIGHT1_M1, NPU_SET_IFM2_WIDTH0_M1);
emit_strides(subgraph, &operation->ifm2, NPU_SET_IFM2_STRIDE_C, NPU_SET_IFM2_STRIDE_Y, NPU_SET_IFM2_STRIDE_X);
- } else {
- EMIT0(NPU_SET_IFM2_SCALAR, operation->ifm2.scalar);
}
EMIT0(NPU_SET_IFM2_ZERO_POINT, operation->ifm2.zero_point);
}
diff --git a/src/gallium/drivers/ethosu/registers.xml b/src/gallium/drivers/ethosu/registers.xml
index fc156e48e5c..0290e7ced43 100644
--- a/src/gallium/drivers/ethosu/registers.xml
+++ b/src/gallium/drivers/ethosu/registers.xml
@@ -242,10 +242,13 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-
-
-
+
+
+
+
+
+
+
@@ -379,6 +382,10 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
+
+