From 6933207435ada42331629790d97db5f841394eb4 Mon Sep 17 00:00:00 2001 From: "Rob Herring (Arm)" Date: Wed, 18 Mar 2026 16:47:03 -0500 Subject: [PATCH] teflon: Add TANH operation support Add the plumbing for TANH operations. Signed-off-by: Rob Herring (Arm) Part-of: --- src/gallium/frontends/teflon/tfl_device.c | 8 ++++++++ src/gallium/include/pipe/p_state.h | 1 + 2 files changed, 9 insertions(+) diff --git a/src/gallium/frontends/teflon/tfl_device.c b/src/gallium/frontends/teflon/tfl_device.c index d7df96ebe45..43199d0f193 100644 --- a/src/gallium/frontends/teflon/tfl_device.c +++ b/src/gallium/frontends/teflon/tfl_device.c @@ -255,6 +255,9 @@ fill_operation(struct teflon_delegate *delegate, TfLiteContext *tf_context, TfLi case kTfLiteBuiltinLogistic: operation->type = PIPE_ML_OPERATION_TYPE_LOGISTIC; break; + case kTfLiteBuiltinTanh: + operation->type = PIPE_ML_OPERATION_TYPE_TANH; + break; case kTfLiteBuiltinSub: operation->type = PIPE_ML_OPERATION_TYPE_SUBTRACT; break; @@ -480,6 +483,9 @@ dump_graph(struct pipe_tensor *tensors, unsigned tensor_count, struct pipe_ml_op case PIPE_ML_OPERATION_TYPE_LOGISTIC: teflon_debug("%-15s ", "LOG"); break; + case PIPE_ML_OPERATION_TYPE_TANH: + teflon_debug("%-15s ", "TANH"); + break; case PIPE_ML_OPERATION_TYPE_SUBTRACT: teflon_debug("%-15s ", "SUB"); break; @@ -722,6 +728,8 @@ tflite_builtin_op_name(TfLiteBuiltinOperator op) return "ABS"; case kTfLiteBuiltinLogistic: return "LOG"; + case kTfLiteBuiltinTanh: + return "TANH"; case kTfLiteBuiltinSub: return "SUB"; case kTfLiteBuiltinTranspose: diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h index cebc4f133c8..ccba0f74050 100644 --- a/src/gallium/include/pipe/p_state.h +++ b/src/gallium/include/pipe/p_state.h @@ -1061,6 +1061,7 @@ enum pipe_ml_operation_type { PIPE_ML_OPERATION_TYPE_RELU, PIPE_ML_OPERATION_TYPE_ABSOLUTE, PIPE_ML_OPERATION_TYPE_LOGISTIC, + PIPE_ML_OPERATION_TYPE_TANH, PIPE_ML_OPERATION_TYPE_SUBTRACT, PIPE_ML_OPERATION_TYPE_TRANSPOSE, PIPE_ML_OPERATION_TYPE_STRIDED_SLICE,