Skip to content

Commit

Permalink
[luci/export] Support RoPE operation (Samsung#14103)
Browse files Browse the repository at this point in the history
This commit supports RoPE For luci export

ONE-DCO-1.0-Signed-off-by: youngsik kim [email protected]
  • Loading branch information
ys44kim authored Sep 27, 2024
1 parent 2f545db commit c59ddc6
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 0 deletions.
4 changes: 4 additions & 0 deletions compiler/luci/export/src/CircleBuiltinTypesExtractor.h
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,10 @@ class BuiltinOptionsExtractor final
{
return circle::CreateRmsNormOptions(_builder, node->epsilon()).Union();
}
flatbuffers::Offset<void> visit(luci::CircleRoPE *node)
{
return circle::CreateRoPEOptions(_builder, to_circle_rope(node->mode())).Union();
}

protected:
flatbuffers::FlatBufferBuilder &_builder;
Expand Down
13 changes: 13 additions & 0 deletions compiler/luci/export/src/CircleExporterUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,19 @@ circle::MirrorPadMode to_circle_mirrorpadmode(luci::MirrorPadMode mode)
}
}

circle::RoPEMode to_circle_rope(luci::RoPEMode mode)
{
switch (mode)
{
case luci::RoPEMode::GPT_NEOX:
return circle::RoPEMode::RoPEMode_GPT_NEOX;
case luci::RoPEMode::GPT_J:
return circle::RoPEMode::RoPEMode_GPT_J;
default:
INTERNAL_EXN_V("trying to convert unsupported luci::RoPEMode", oops::to_uint32(mode));
}
}

circle::FullyConnectedOptionsWeightsFormat
to_circle_weightsformat(luci::CircleFullyConnected::WeightsFormat format)
{
Expand Down
1 change: 1 addition & 0 deletions compiler/luci/export/src/CircleExporterUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ namespace luci
circle::ActivationFunctionType to_circle_actfunc(luci::FusedActFunc func);
circle::TensorType to_circle_tensortype(loco::DataType type);
circle::MirrorPadMode to_circle_mirrorpadmode(luci::MirrorPadMode mode);
circle::RoPEMode to_circle_rope(luci::RoPEMode mode);
circle::FullyConnectedOptionsWeightsFormat
to_circle_weightsformat(luci::CircleFullyConnected::WeightsFormat format);
circle::DimensionType to_circle_dimensiontype(luci::DimensionType type);
Expand Down
1 change: 1 addition & 0 deletions compiler/luci/export/src/CircleOps.lst
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ CIRCLE_NODE(CircleBCQGather, BuiltinOperator_BCQ_GATHER, BuiltinOptions_BCQGathe
CIRCLE_NODE(CircleGRU, BuiltinOperator_GRU, BuiltinOptions_GRUOptions)
CIRCLE_NODE(CircleInstanceNorm, BuiltinOperator_INSTANCE_NORM, BuiltinOptions_InstanceNormOptions)
CIRCLE_NODE(CircleRmsNorm, BuiltinOperator_RMS_NORM, BuiltinOptions_RmsNormOptions)
CIRCLE_NODE(CircleRoPE, BuiltinOperator_ROPE, BuiltinOptions_RoPEOptions)
// Virtual node(s)
CIRCLE_VNODE(CircleBidirectionalSequenceLSTMOut)
CIRCLE_VNODE(CircleConst)
Expand Down

0 comments on commit c59ddc6

Please sign in to comment.