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

Improve lowering logic and lower few more ops #22

Merged
merged 1 commit into from
Jul 30, 2024

Conversation

sdjordjevicTT
Copy link
Contributor

@sdjordjevicTT sdjordjevicTT commented Jul 29, 2024

With these code changes, I managed to simplify the lowering logic. The lowering function is now a template that can be registered for all new ops. Additionally, lowering the following ops:

  • Subtract
  • Matmul
  • Relu
  • Softmax

Solves:

@sdjordjevicTT sdjordjevicTT self-assigned this Jul 29, 2024
@sdjordjevicTT sdjordjevicTT force-pushed the sdjordjevic/improve_lowering_logic branch 2 times, most recently from ec1751e to 693975e Compare July 29, 2024 10:03
@sdjordjevicTT sdjordjevicTT changed the title Improve lowering logic and lower few ops Improve lowering logic and lower few more ops Jul 29, 2024
@sdjordjevicTT sdjordjevicTT force-pushed the sdjordjevic/improve_lowering_logic branch from 693975e to d28b081 Compare July 29, 2024 11:43
@sdjordjevicTT sdjordjevicTT requested a review from pilkicTT July 29, 2024 14:10
llvm::SmallVector<mlir::Value> output_vector;
output_vector.push_back(emit_mlir_empty_tensor(graph, op_node));
mlir::ValueRange outputs = mlir::ValueRange(output_vector);
auto op = builder_.create<TTIROp>(
Copy link
Contributor

Choose a reason for hiding this comment

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

This is the only part of this function which depends on the template argument. Why not extract this into a function template instead?

Copy link
Contributor Author

@sdjordjevicTT sdjordjevicTT Jul 29, 2024

Choose a reason for hiding this comment

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

Take a look at few lines above:
::llvm::ArrayRef<::llvm::StringRef> operation_attributes = TTIROp::getAttributeNames();

We are getting specific operation attributes to decide which attributes to build...

Copy link
Contributor

Choose a reason for hiding this comment

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

I see... sorry, missed that one...

@sdjordjevicTT sdjordjevicTT force-pushed the sdjordjevic/improve_lowering_logic branch from d28b081 to 3a631f4 Compare July 29, 2024 16:01
@sdjordjevicTT sdjordjevicTT merged commit b73675a into main Jul 30, 2024
1 check failed
@sdjordjevicTT sdjordjevicTT deleted the sdjordjevic/improve_lowering_logic branch August 2, 2024 08:37
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