-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[luci/service] Support RoPE operation (#14091)
This commit supports RoPE for luci service ONE-DCO-1.0-Signed-off-by: youngsik kim [email protected]
- Loading branch information
Showing
7 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Copyright (c) 2024 Samsung Electronics Co., Ltd. All Rights Reserved | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#include "CircleCloneNode.h" | ||
|
||
namespace luci | ||
{ | ||
|
||
luci::CircleNode *CloneNode::visit(const luci::CircleRoPE *node) | ||
{ | ||
if (node->mode() == luci::RoPEMode::UNDEFINED) | ||
return nullptr; | ||
|
||
auto *cloned = _graph->nodes()->create<luci::CircleRoPE>(); | ||
|
||
return cloned; | ||
} | ||
|
||
} // namespace luci |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Copyright (c) 2024 Samsung Electronics Co., Ltd. All Rights Reserved | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#include "luci/Service/CircleNodeClone.h" | ||
|
||
#include <gtest/gtest.h> | ||
|
||
TEST(CloneNodeTest, clone_RoPE) | ||
{ | ||
auto g = loco::make_graph(); | ||
auto node_rp = g->nodes()->create<luci::CircleRoPE>(); | ||
node_rp->mode(luci::RoPEMode::GPT_NEOX); | ||
|
||
auto gc = loco::make_graph(); | ||
auto cloned = luci::clone_node(node_rp, gc.get()); | ||
ASSERT_NE(nullptr, cloned); | ||
ASSERT_EQ(gc.get(), cloned->graph()); | ||
|
||
auto cloned_rp = dynamic_cast<luci::CircleRoPE *>(cloned); | ||
ASSERT_NE(nullptr, cloned_rp); | ||
ASSERT_EQ(node_rp->mode(), cloned_rp->mode()); | ||
} | ||
|
||
TEST(CloneNodeTest, clone_RoPE_NEG) | ||
{ | ||
auto g = loco::make_graph(); | ||
auto node_rp = g->nodes()->create<luci::CircleRoPE>(); | ||
node_rp->mode(luci::RoPEMode::UNDEFINED); | ||
|
||
auto gc = loco::make_graph(); | ||
auto cloned = luci::clone_node(node_rp, gc.get()); | ||
ASSERT_EQ(nullptr, cloned); | ||
} |