mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 09:08:10 +02:00
teflon: Add support for custom nodes
If a custom operation is claimed by teflon delegate, mark it as such to prevent other delegates (like XNNPack) from trying to handle it, which could result in an "Encountered unresolved op" error. Signed-off-by: Ioana Ciocoi-Radulescu <ruxandra.radulescu@nxp.com>
This commit is contained in:
parent
2b1d9a2afc
commit
3c0a55d93f
2 changed files with 19 additions and 1 deletions
|
|
@ -304,6 +304,11 @@ fill_operation(struct teflon_delegate *delegate, TfLiteContext *tf_context, TfLi
|
|||
operation->type = PIPE_ML_OPERATION_TYPE_QUANTIZE;
|
||||
break;
|
||||
}
|
||||
case kTfLiteBuiltinCustom: {
|
||||
operation->type = PIPE_ML_OPERATION_TYPE_CUSTOM;
|
||||
operation->custom.name = node_registration->custom_name ? strdup(node_registration->custom_name) : NULL;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
|
@ -536,6 +541,9 @@ dump_graph(struct pipe_tensor *tensors, unsigned tensor_count, struct pipe_ml_op
|
|||
case PIPE_ML_OPERATION_TYPE_LEAKY_RELU:
|
||||
teflon_debug("%-15s ", "LEAKY_RELU");
|
||||
break;
|
||||
case PIPE_ML_OPERATION_TYPE_CUSTOM:
|
||||
teflon_debug("%-15s ", "CUSTOM");
|
||||
break;
|
||||
}
|
||||
|
||||
char *input_buf = ralloc_strdup(NULL, "");
|
||||
|
|
@ -775,6 +783,8 @@ tflite_builtin_op_name(TfLiteBuiltinOperator op)
|
|||
return "TRANSPOSE";
|
||||
case kTfLiteBuiltinLeakyRelu:
|
||||
return "LEAKY_RELU";
|
||||
case kTfLiteBuiltinCustom:
|
||||
return "CUSTOM";
|
||||
default:
|
||||
return "unknown";
|
||||
}
|
||||
|
|
@ -929,8 +939,12 @@ PrepareDelegate(TfLiteContext *tf_context, TfLiteDelegate *tf_delegate)
|
|||
}
|
||||
teflon_debug("\n");
|
||||
|
||||
if (supported)
|
||||
if (supported) {
|
||||
supported_nodes->data[node_count++] = node_index;
|
||||
// If custom node is claimed by teflon delegate, tell other delegates to skip it
|
||||
if (registration->builtin_code == kTfLiteBuiltinCustom)
|
||||
registration->builtin_code = kTfLiteBuiltinDelegate;
|
||||
}
|
||||
}
|
||||
supported_nodes->size = node_count;
|
||||
|
||||
|
|
|
|||
|
|
@ -1072,6 +1072,7 @@ enum pipe_ml_operation_type {
|
|||
PIPE_ML_OPERATION_TYPE_QUANTIZE,
|
||||
PIPE_ML_OPERATION_TYPE_MAXIMUM,
|
||||
PIPE_ML_OPERATION_TYPE_MINIMUM,
|
||||
PIPE_ML_OPERATION_TYPE_CUSTOM,
|
||||
};
|
||||
|
||||
enum pipe_ml_pooling_type {
|
||||
|
|
@ -1276,6 +1277,9 @@ struct pipe_ml_operation
|
|||
struct {
|
||||
float alpha;
|
||||
} leakyrelu;
|
||||
struct {
|
||||
char *name;
|
||||
} custom;
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue