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

moved *InferModel classes to infer.{cpp|h} #6922

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

firewave
Copy link
Collaborator

No description provided.

@firewave
Copy link
Collaborator Author

As suggested by @pfultz2 in #6845 (comment).

lib/infer.cpp Outdated
@@ -390,6 +390,7 @@ std::vector<MathLib::bigint> getMaxValue(const ValuePtr<InferModel>& model, cons

namespace {
struct IntegralInferModel : InferModel {
private:
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is private being added? I don't think it's necessary and it's a little confusing since the interface is public.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That is so it can only call it through the interface and not on the object it inherits from.

Copy link
Contributor

Choose a reason for hiding this comment

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

Why? Its faster calling it directly(there is no vtable lookup).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In that case - why having an interface?

Also this change is probably pedantic because the callers will never see the actual implementation and only use the interface.

Copy link
Contributor

@pfultz2 pfultz2 Oct 15, 2024

Choose a reason for hiding this comment

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

In that case - why having an interface?

So we can check that the interface is implemented correctly. Also if this is used across TUs we will need the interface, but if its in the same TU we can use a template function and use REQUIRES("T must be an InferModel", std::is_base_of<T, InferModel>) to improve error messages.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Also if this is used across TUs we will need the interface, but if its in the same TU we can use a template function and use REQUIRES("T must be an InferModel", std::is_base_of<T, InferModel>) to improve error messages.

Interesting point. I was wondering if there was some cleanup which could be done now they are all in the same place. Will look into it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I dropped commit making things private for now.

@firewave firewave marked this pull request as ready for review February 6, 2025 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants