Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[luci/service] Migrate Quantize shape inference rule to sinf::Algorithm #13794

Closed
wants to merge 11 commits into from

Conversation

kyeong8139
Copy link
Contributor

When testing dynamic shape inference, the quantize operation successfully handles it.
I have added tests for this case and migrated the inference code.

Related to: #13697
draft: #13779

ONE-DCO-1.0-Signed-off-by: kyeong8139 [email protected]

This commit add dynamic shape inference tests for quantize.

ONE-DCO-1.0-Signed-off-by: kyeong8139 <[email protected]>
This commit add dynamic shape inference tests for quantize.
ONE-DCO-1.0-Signed-off-by: kyeong8139 <[email protected]>
This commit add dynamic shape inference tests for quantize.
ONE-DCO-1.0-Signed-off-by: kyeong8139 <[email protected]>
This commit check order of headers.
ONE-DCO-1.0-Signed-off-by: kyeong8139 <[email protected]>
@kyeong8139 kyeong8139 added PR/ready for review It is ready to review. Please review it. SSAFY labels Aug 28, 2024
@kyeong8139 kyeong8139 changed the title [luci/quantize] add dynamic shape inference test for Quantize [luci/service] add dynamic shape inference test for Quantize Aug 28, 2024
@seanshpark
Copy link
Contributor

add dynamic shape inference test for Quantize

I was expecting to see test codes... but there exist code migration, but no specific algorithm changes for dynamic shape support.

Can you update the title to express this?

@zetwhite , @shs-park , Q) do we MUST relocate codes ? I don't fully understand/agree on existing design that @llFreetimell made.

@shs-park
Copy link
Contributor

Q) do we MUST relocate codes ? I don't fully understand/agree on existing design that @llFreetimell made.

I think this is not a MUST todo,
but we need to have some consistency of the location for the shape inference when we(with SSAFY members)'re working on this time.

The Ops we want to implement this time were discussed in this issue and we have plan to implement them in the location of @llFreetimell's firstly.

@seanshpark
Copy link
Contributor

but we need to have some consistency of the...

Q) does Quantize have any problem with dynamic shape inference?

Thoughts,

  • we can relocate Quantize with additional tests with dynamic shape inference
  • we can skip this Quantize if there is no problem as of now. eventually it looks like migration is needed. that is if there exist other Ops that need to migrate for dynamic shape infer, lets work on that ops with higher priority.
  • current title/comments needs update to express for actual code changes.

@zetwhite
Copy link
Contributor

zetwhite commented Aug 28, 2024

I think re-location is helpful to distinguish which op is ready to support dynamic shape and which op is not yet. If not, others might try to re-investigate to support dynamic shapes for the Quantize node.

we can relocate Quantize with additional tests with dynamic shape inference

For me, this option looks good.

current title/comments needs update to express for actual code changes.

For PR title, how about 'Migrate Quantize shape inference rule to sinf::Algorithm'?

(+) /cc @kyeong8139 plz update pr title :)

@seanshpark
Copy link
Contributor

... is helpful to distinguish which op is ready to ...

👍🏻

'Migrate Quantize shape inference rule to sinf::Algorithm'?

good to me :)

@shs-park
Copy link
Contributor

Q) does Quantize have any problem with dynamic shape inference?

AFAIK roughly, this Op is related to the prompt parsing and token gen parts, from #13697.

@jinevening, could you explain a little bit more..?

@kyeong8139 kyeong8139 changed the title [luci/service] add dynamic shape inference test for Quantize [luci/service] Migrate Quantize shape inference rule to sinf::Algorithm Aug 28, 2024
@kyeong8139
Copy link
Contributor Author

kyeong8139 commented Aug 28, 2024

For PR title, how about 'Migrate Quantize shape inference rule to sinf::Algorithm'?

I change the title to 'Migrate Quantize shape inference rule to sinf::Algorithm'. I think It is appropriate title about this, too.

@seanshpark
Copy link
Contributor

From https://github.com/Samsung/ONE/pull/13794/commits

commit message is

[luci-quantize] add dynamic shape tests

This commit add dynamic shape inference tests for quantize.

can you please fix your commit?
github UI title/commit message won't update the commit itself.

This commit Migrate Quantize shape inference rule to sinf::Algorithm.
ONE-DCO-1.0-Signed-off-by: kyeong8139 <[email protected]>
@kyeong8139
Copy link
Contributor Author

kyeong8139 commented Aug 28, 2024

github UI title/commit message won't update the commit itself.

I fixed my commit.
I'd like to ask something. I changed compiler/luci/service/src/Nodes/CircleQuantize.test.cpp to ensure that original quantize algorithm support dynamic shape inference.
it isn't necessary if OP don't have problem for supporting dynamic shape? or It isn't enough to test it?

@zetwhite
Copy link
Contributor

zetwhite commented Aug 28, 2024

I changed compiler/luci/service/src/Nodes/CircleQuantize.test.cpp to ensure that original quantize algorithm support dynamic shape inference.

I agree with this comment. I think adding tc to show it supports dynamic shape well is good idea.

+) Also current test you wrote looks good to me.

@seanshpark
Copy link
Contributor

I fixed my commit.

https://github.com/Samsung/ONE/pull/13794/commits will show lots of commits
that will be accumulated (we use squash merge) when landing.

you need to update the first commit.

@jinevening
Copy link
Contributor

jinevening commented Aug 28, 2024

@jinevening, could you explain a little bit more..?

Quantize Op is included in mixed-precision LLM.

shs-park
shs-park previously approved these changes Aug 28, 2024
Copy link
Contributor

@shs-park shs-park left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!
=)

@@ -24,4 +27,10 @@ luci::CircleNode *CloneNodeLet<CN::OPQR>::visit(const luci::CircleQuantize *)
return _graph->nodes()->create<luci::CircleQuantize>();
}

loco::TensorShape sinf::Algorithm::visit(const luci::CircleQuantize *node)
{
const auto input_shape = luci::shape_get(node->input()).as<loco::TensorShape>();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you use circle_shape function? shape_get is a temporary function, which will be removed in the future.

CircleShapeInferenceHelper.h

// NOTE Functions in this namespace will be removed after new inference
//      algorithms are fully implemented.

// This function is temporary function for deprecating loco::shape_get
loco::NodeShape shape_get(const loco::Node *node);

This commit add dynamic shape inference tests for quantize.

ONE-DCO-1.0-Signed-off-by: kyeong8139 <[email protected]>
This commit Migrate Quantize shape inference rule to sinf::Algorithm.
ONE-DCO-1.0-Signed-off-by: kyeong8139 <[email protected]>
This commit check order of headers.
ONE-DCO-1.0-Signed-off-by: kyeong8139 <[email protected]>
This commit Migrate Quantize shape inference rule to sinf::Algorithm.
ONE-DCO-1.0-Signed-off-by: kyeong8139 <[email protected]>
This commit use circle_shape function instead of shape_get.
ONE-DCO-1.0-Signed-off-by: kyeong8139 <[email protected]>
@@ -24,4 +27,10 @@ luci::CircleNode *CloneNodeLet<CN::OPQR>::visit(const luci::CircleQuantize *)
return _graph->nodes()->create<luci::CircleQuantize>();
}

loco::TensorShape sinf::Algorithm::visit(const luci::CircleQuantize *node)
{
const auto input_shape = circle_shape(node);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It has to be input's shape.

This commit migrate quantize shape inference rule to sinf::Algorithm.
ONE-DCO-1.0-Signed-off-by: kyeong8139 <[email protected]>

[luci-quantize] add dynamic shape tests

This commit add dynamic shape inference tests for quantize.

ONE-DCO-1.0-Signed-off-by: kyeong8139 <[email protected]>

[luci-quantize] check code format
This commit add dynamic shape inference tests for quantize.
ONE-DCO-1.0-Signed-off-by: kyeong8139 <[email protected]>

[luci-quantize] add dynamic shape tests
This commit add dynamic shape inference tests for quantize.
ONE-DCO-1.0-Signed-off-by: kyeong8139 <[email protected]>

[luci-quantize] modify order of headers
This commit check order of headers.
ONE-DCO-1.0-Signed-off-by: kyeong8139 <[email protected]>

[luci-quantize] Migrate Quantize shape inference rule to sinf::Algorithm
This commit Migrate Quantize shape inference rule to sinf::Algorithm.
ONE-DCO-1.0-Signed-off-by: kyeong8139 <[email protected]>

[luci-quantize] add dynamic shape tests

This commit add dynamic shape inference tests for quantize.

ONE-DCO-1.0-Signed-off-by: kyeong8139 <[email protected]>

[luci-quantize] Migrate Quantize shape inference rule to sinf::Algorithm
This commit Migrate Quantize shape inference rule to sinf::Algorithm.
ONE-DCO-1.0-Signed-off-by: kyeong8139 <[email protected]>

[luci-quantize] modify order of headers
This commit check order of headers.
ONE-DCO-1.0-Signed-off-by: kyeong8139 <[email protected]>

[luci-quantize] Migrate Quantize shape inference rule to sinf::Algorithm
This commit Migrate Quantize shape inference rule to sinf::Algorithm.
ONE-DCO-1.0-Signed-off-by: kyeong8139 <[email protected]>
@kyeong8139
Copy link
Contributor Author

there are some troblems while using git rebase.
after close this pr, I write new pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR/ready for review It is ready to review. Please review it. SSAFY
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants