From 15bc152185475060b9a7e3e84d23c0ae6f1c08d7 Mon Sep 17 00:00:00 2001 From: "Rob Herring (Arm)" Date: Tue, 24 Feb 2026 16:50:16 -0600 Subject: [PATCH] teflon: Add LeakyRelu operation Add the plumbing for LeakyRelu operations. Signed-off-by: Rob Herring (Arm) Part-of: --- src/gallium/frontends/teflon/tfl_device.c | 12 ++++++++++++ src/gallium/include/pipe/p_state.h | 5 +++++ 2 files changed, 17 insertions(+) diff --git a/src/gallium/frontends/teflon/tfl_device.c b/src/gallium/frontends/teflon/tfl_device.c index f18df0800d1..cafbca920e5 100644 --- a/src/gallium/frontends/teflon/tfl_device.c +++ b/src/gallium/frontends/teflon/tfl_device.c @@ -246,6 +246,13 @@ fill_operation(struct teflon_delegate *delegate, TfLiteContext *tf_context, TfLi memcpy(operation->reshape.shape, shape, 4 * sizeof(*operation->reshape.shape)); break; } + case kTfLiteBuiltinLeakyRelu: { + TfLiteLeakyReluParams *params = node->builtin_data; + + operation->type = PIPE_ML_OPERATION_TYPE_LEAKY_RELU; + operation->leakyrelu.alpha = params->alpha; + break; + } case kTfLiteBuiltinRelu: operation->type = PIPE_ML_OPERATION_TYPE_RELU; break; @@ -507,6 +514,9 @@ dump_graph(struct pipe_tensor *tensors, unsigned tensor_count, struct pipe_ml_op case PIPE_ML_OPERATION_TYPE_MUL: teflon_debug("%-15s ", "MUL"); break; + case PIPE_ML_OPERATION_TYPE_LEAKY_RELU: + teflon_debug("%-15s ", "LEAKY_RELU"); + break; } char *input_buf = ralloc_strdup(NULL, ""); @@ -740,6 +750,8 @@ tflite_builtin_op_name(TfLiteBuiltinOperator op) return "SUB"; case kTfLiteBuiltinTranspose: return "TRANSPOSE"; + case kTfLiteBuiltinLeakyRelu: + return "LEAKY_RELU"; default: return "unknown"; } diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h index cd2b8217f2b..0a19768ddcb 100644 --- a/src/gallium/include/pipe/p_state.h +++ b/src/gallium/include/pipe/p_state.h @@ -1068,6 +1068,7 @@ enum pipe_ml_operation_type { PIPE_ML_OPERATION_TYPE_STRIDED_SLICE, PIPE_ML_OPERATION_TYPE_RESIZE, PIPE_ML_OPERATION_TYPE_MUL, + PIPE_ML_OPERATION_TYPE_LEAKY_RELU, }; enum pipe_ml_pooling_type { @@ -1268,6 +1269,10 @@ struct pipe_ml_operation int end[4]; int strides[4]; } slice; + + struct { + float alpha; + } leakyrelu; }; };