Skip to content

Fill(cpp wrapper) #800

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

Merged
merged 7 commits into from
Jul 17, 2025
Merged

Conversation

AdvancedCompiler
Copy link
Contributor

PR Category

Operator

Type of Change

New Feature

Description

CPP wrapper packaging for fill op.

Issue

Progress

  • Change is properly reviewed (1 reviewer required, 2 recommended).
  • Change is responded to an issue.
  • Change is fully covered by a UT.

Performance

m.def("fill_scalar(Tensor input, const Scalar& value) -> Tensor");
m.def("fill_tensor(Tensor input, const Tensor& value) -> Tensor");
m.def("fill_scalar_(Tensor! input, const Scalar& value) -> Tensor!");
m.def("fill_tensor_(Tensor! input, const Tensor& value) -> Tensor!");
Copy link
Collaborator

Choose a reason for hiding this comment

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

The schemas here do not need to include const Scalar&, just Scalar is fine. but the function signatures do.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the review,I've applied the suggested changes

lib/fill.cpp Outdated
namespace flag_gems {
using namespace triton_jit;

at::Tensor fill_scalar(const at::Tensor& input, const c10::Scalar value) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use const c10::Scalar&.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the review,I've applied the suggested changes


at::Tensor fill_tensor(const at::Tensor &input, const at::Tensor &value);

void fill_scalar_(at::Tensor &input, const c10::Scalar value);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use const c10::Scalar&

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the review,I've applied the suggested changes

lib/fill.cpp Outdated
return out;
}

void fill_scalar_(at::Tensor& input, const c10::Scalar value) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use const c10::Scalar&

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the review,I've applied the suggested changes

iclementine
iclementine previously approved these changes Jul 17, 2025
@StrongSpoon StrongSpoon merged commit 3224708 into FlagOpen:master Jul 17, 2025
12 of 13 checks passed
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.

4 participants