Skip to content

preseg optimization pass - optimization for cat#2373

Merged
jjsjann123 merged 156 commits intomainfrom
preseg_propagate_pad
Oct 19, 2024
Merged

preseg optimization pass - optimization for cat#2373
jjsjann123 merged 156 commits intomainfrom
preseg_propagate_pad

Conversation

@jjsjann123
Copy link
Collaborator

@jjsjann123 jjsjann123 commented Jun 9, 2024

Adding pre-segmentation optimization pass that optimize cat (PadOp + CatOp) to avoid multiple kernels.

  1. The mutation tries to push PadOp further to its producer as described below. The goal is to either have the pad op directly on inputs to fusion, or to a point where segmentation at pad leaves a no-op fusion segment before pad.
// The concept is that the following program:
//   tv1 = UnaryOp(tv0)
//   tv2 = PadOp(tv1)
// can be replayed as the program below:
//   tv0_padded = PadOp(tv0)
//   tv2_new = UnaryOp(tv0_padded)

For details on the propagation logic, please see code comment
Note [ PadOp Propagation Rule ]
Note [ Handling TV with Multiple Uses via Frontier ]

  1. As a result of moving the PadOp, we also need to replace the CatOp with a series of binary add, since its inputs are no longer directly produced by PadOp.

@jjsjann123
Copy link
Collaborator Author

!build

@jjsjann123
Copy link
Collaborator Author

!build

@jjsjann123
Copy link
Collaborator Author

!build

@jjsjann123
Copy link
Collaborator Author

!build --pybench

@jjsjann123
Copy link
Collaborator Author

!build --pybench

@jjsjann123
Copy link
Collaborator Author

!build

@jjsjann123
Copy link
Collaborator Author

Don't see any odd failure in pybench. I'll merge this PR after CI clears.

@jjsjann123
Copy link
Collaborator Author

!build

@jjsjann123
Copy link
Collaborator Author

failures are related to distributed stuff. Don't seem to related but I'm gonna try merging main again.

@jjsjann123
Copy link
Collaborator Author

!build

@jjsjann123
Copy link
Collaborator Author

!build

@jjsjann123
Copy link
Collaborator Author

!build

@jjsjann123
Copy link
Collaborator Author

!build

@jjsjann123
Copy link
Collaborator Author

!build

@jjsjann123
Copy link
Collaborator Author

!build

@jjsjann123
Copy link
Collaborator Author

!build

@jjsjann123 jjsjann123 merged commit 530c62d into main Oct 19, 2024
@jjsjann123 jjsjann123 deleted the preseg_propagate_pad branch October 19, 2024 21:36
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