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

[Operator] Type promotion for pointwise Ops #79

Merged
merged 7 commits into from
Jul 1, 2024

Conversation

Bowen12992
Copy link
Collaborator

@Bowen12992 Bowen12992 commented Jun 21, 2024

  • Add Type promotion for pointwise Ops
  • Add trunc & floor mode for divOp
  • Move Type promotion into pointwise JIT
  • Support different condition of whereOp
  • Add UTs of type promotion for pointwise Ops
  • Fix related docs

import torch._prims_common as utils


def type_promotion(*args, type_promotion: utils.ELEMENTWISE_TYPE_PROMOTION_KIND):
Copy link
Collaborator

@iclementine iclementine Jun 25, 2024

Choose a reason for hiding this comment

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

Maybe we can use a simpler implementation for type promotion rules.(e.g. use torch.promote_types or torch.result_type for ELEMENTWISE_TYPE_PROMOTION_KIND.DEFAULT, and write our own implementation for other cases).

Copy link
Collaborator Author

@Bowen12992 Bowen12992 Jun 26, 2024

Choose a reason for hiding this comment

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

Yeah, we can simplify the logic! but I have two concerns. 1. Will Gems support dynamic-shape with maybe sympy in the feature?2. I‘m going to figure out if there are differences among torch.promote_types torch.result_type and ELEMENTWISE_TYPE_PROMOTION_KIND.DEFAULT

Copy link
Collaborator

Choose a reason for hiding this comment

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

We may not support symbolic shape since flaggems is basically designed for processing real tensors, with concrete shapes.

@Bowen12992 Bowen12992 changed the title [WIP] Type promotion for pointwise Ops [OP] Type promotion for pointwise Ops Jul 1, 2024
@Bowen12992 Bowen12992 changed the title [OP] Type promotion for pointwise Ops [Operator] Type promotion for pointwise Ops Jul 1, 2024
Copy link
Collaborator

@iclementine iclementine left a comment

Choose a reason for hiding this comment

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

LGTM

@Bowen12992 Bowen12992 merged commit 566daf7 into FlagOpen:master Jul 1, 2024
3 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.

3 participants