Skip to content

Add composite relu - #3316

Merged
copybara-service[bot] merged 1 commit into
mainfrom
mdgrs/compositeRelu
Aug 7, 2026
Merged

Add composite relu#3316
copybara-service[bot] merged 1 commit into
mainfrom
mdgrs/compositeRelu

Conversation

@mdgrs

@mdgrs mdgrs commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Ports the 3 stage RELU approximation from the Orion paper. It is hidden behind a flag.

@mdgrs
mdgrs requested review from asraa and j2kun August 7, 2026 11:28

@j2kun j2kun left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Fantastic work! I will try to carve out some time in the future to do a more detailed analysis of the tradeoff between the composite method and the vanilla approximation.


#map = affine_map<(d0, d1) -> (d0, d1)>

// A fused elementwise generic can carry more than one ReLU. Every maximumf must

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

In your opinion, would it make sense in the future to aim for a general handler of linalg.generic for canoncalizing activations?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Just to make sure we are on the same page, you mean grouping operations that belong to the same activation function together, so they can be treated as a unit. I think that would indeed make sense since we typically want to treat each activation function as a unit (since we think in terms of layers in the neural network)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Right, I was mainly surprised that the linalg produced by torch-mlir can produce generics with multiple ops operating on different operands within.

@j2kun j2kun added the pull_ready Indicates whether a PR is ready to pull. The copybara worker will import for internal testing label Aug 7, 2026
@copybara-service
copybara-service Bot merged commit cbf0016 into main Aug 7, 2026
21 checks passed
@copybara-service
copybara-service Bot deleted the mdgrs/compositeRelu branch August 7, 2026 16:25
@j2kun

j2kun commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

I did notice that enabling this flag for the HE-LRM model actually causes a segfault, but I think I will not have the time to investigate until after the blog deadline + my 2 weeks of vacation. However, next week you will be able to see the exact invocation and I can tell you where I flipped this flag and saw an error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pull_ready Indicates whether a PR is ready to pull. The copybara worker will import for internal testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants