mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 00:38:48 +02:00
ethosu: Add quantize operation
The quantize operation lowers to a pooling nop operation. Signed-off-by: Rob Herring (Arm) <robh@kernel.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39975>
This commit is contained in:
parent
e6f4f6aa5d
commit
08d93a60f5
2 changed files with 27 additions and 0 deletions
|
|
@ -582,6 +582,26 @@ ethosu_lower_leakyrelu(struct ethosu_subgraph *subgraph,
|
|||
ethosu_sched_operation(subgraph, operation);
|
||||
}
|
||||
|
||||
static void
|
||||
ethosu_lower_quantize(struct ethosu_subgraph *subgraph,
|
||||
const struct pipe_ml_operation *poperation,
|
||||
struct ethosu_operation *operation)
|
||||
{
|
||||
operation->type = ETHOSU_OPERATION_TYPE_POOLING;
|
||||
operation->round_mode = ETHOSU_ROUNDING_DOUBLE;
|
||||
operation->pooling.nop = true;
|
||||
|
||||
if (ethosu_ml_device(subgraph->base.device)->is_u65)
|
||||
operation->pooling.type = ETHOSU_POOLING_TYPE_AVG;
|
||||
else
|
||||
operation->pooling.type = ETHOSU_POOLING_TYPE_SUM;
|
||||
|
||||
set_feature_maps(subgraph, poperation->input_tensors[0], poperation->output_tensors[0], operation);
|
||||
|
||||
allocate_feature_maps(subgraph, operation);
|
||||
ethosu_sched_operation(subgraph, operation);
|
||||
}
|
||||
|
||||
static void
|
||||
ethosu_lower_concatenation(struct ethosu_subgraph *subgraph,
|
||||
const struct pipe_ml_operation *poperation,
|
||||
|
|
@ -914,6 +934,12 @@ ethosu_lower_graph(struct ethosu_subgraph *subgraph,
|
|||
break;
|
||||
}
|
||||
|
||||
case PIPE_ML_OPERATION_TYPE_QUANTIZE: {
|
||||
ethosu_lower_quantize(subgraph, &poperations[i], &operation);
|
||||
util_dynarray_append(&subgraph->operations, operation);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
DBG("poperation->type %d\n", poperations[i].type);
|
||||
UNREACHABLE("Unsupported ML operation type");
|
||||
|
|
|
|||
|
|
@ -149,6 +149,7 @@ ethosu_ml_operation_supported(struct pipe_ml_device *pdevice,
|
|||
case PIPE_ML_OPERATION_TYPE_TANH:
|
||||
case PIPE_ML_OPERATION_TYPE_HSWISH:
|
||||
case PIPE_ML_OPERATION_TYPE_LEAKY_RELU:
|
||||
case PIPE_ML_OPERATION_TYPE_QUANTIZE:
|
||||
supported = true;
|
||||
break;
|
||||
case PIPE_ML_OPERATION_TYPE_RESIZE: {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue