diff --git a/src/gallium/drivers/ethosu/ethosu_coefs.c b/src/gallium/drivers/ethosu/ethosu_coefs.c index 3505ee147ab..cbb9609d811 100644 --- a/src/gallium/drivers/ethosu/ethosu_coefs.c +++ b/src/gallium/drivers/ethosu/ethosu_coefs.c @@ -87,12 +87,14 @@ fill_scale_and_biases(struct ethosu_subgraph *subgraph, struct ethosu_operation uint32_t shift; int scale = ethosu_quantize_scale(conv_scale, &shift); + uint64_t bias = biases ? biases[i] : 0; + if (ethosu_ml_device(subgraph->base.device)->is_u65) encode_bias_scale_u65( - biases[i], scale, shift, &(*scales)[idx]); + bias, scale, shift, &(*scales)[idx]); else encode_bias_scale_u85( - biases[i], scale, shift, &(*scales)[idx]); + bias, scale, shift, &(*scales)[idx]); /* Saved for NPU_SET_OFM_SCALE emission in the command stream. */ if (i == 0) { diff --git a/src/gallium/drivers/ethosu/ethosu_lower.c b/src/gallium/drivers/ethosu/ethosu_lower.c index e296127cbf2..5a91d8b1402 100644 --- a/src/gallium/drivers/ethosu/ethosu_lower.c +++ b/src/gallium/drivers/ethosu/ethosu_lower.c @@ -105,6 +105,8 @@ ethosu_lower_convolution(struct ethosu_subgraph *subgraph, struct pipe_tensor *input_tensor, struct ethosu_operation *operation) { + uint8_t *bias_data = poperation->conv.bias_tensor ? poperation->conv.bias_tensor->data : NULL; + operation->type = ETHOSU_OPERATION_TYPE_CONVOLUTION; operation->conv.depthwise = is_depthwise(poperation); @@ -148,8 +150,8 @@ ethosu_lower_convolution(struct ethosu_subgraph *subgraph, allocate_feature_maps(subgraph, operation); ethosu_sched_operation(subgraph, operation); - fill_coefs(subgraph, operation, - (int32_t *)poperation->conv.bias_tensor->data, + + fill_coefs(subgraph, operation, (int32_t *)bias_data, poperation->conv.weight_tensor->data, poperation->conv.weight_tensor->dims[0] * poperation->conv.weight_tensor->dims[1] *