Skip to content

Commit

Permalink
[triton][NFC] Refactor build function of ScanOp (#5861)
Browse files Browse the repository at this point in the history
It's better to use ScanOp's build function to replace ReduceOp's.

<!---
The core Triton is a small number of people, and we receive many PRs
(thank
you!).  To help us review your code more quickly, **if you are a new
contributor (less than 3 PRs merged) we ask that you complete the
following
tasks and include the filled-out checklist in your PR description.**

Complete the following tasks before sending your PR, and replace `[ ]`
with
`[x]` to indicate you have done them.
-->

# New contributor declaration
- [x] I am not making a trivial change, such as fixing a typo in a
comment.

- [x] I have written a PR description following these
  [rules](https://cbea.ms/git-commit/#why-not-how).

- [x] I have run `pre-commit run --from-ref origin/main --to-ref HEAD`.

- Select one of the following.
  - [ ] I have added tests.
    - `/test` for `lit` tests
    - `/unittest` for C++ tests
    - `/python/test` for end-to-end tests
  - [x] This PR does not need a test because `FILL THIS IN`.

- Select one of the following.
  - [x] I have not added any `lit` tests.
- [ ] The `lit` tests I have added follow these [best
practices](https://mlir.llvm.org/getting_started/TestingGuide/#filecheck-best-practices),
including the "tests should be minimal" section. (Usually running Python
code
    and using the instructions it generates is not minimal.)
  • Loading branch information
lcvon007 authored Feb 8, 2025
1 parent eef7e22 commit c5036b9
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/Dialect/Triton/IR/Ops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -551,10 +551,9 @@ unsigned ReduceOp::getNumOperands() { return this->getOperands().size(); }
void ScanOp::build(OpBuilder &builder, OperationState &state,
ValueRange operands, int axis, bool reverse) {
SmallVector<Type> inferredReturnTypes;
state.addAttribute("reverse", builder.getBoolAttr(reverse));
for (auto arg : operands)
inferredReturnTypes.push_back(arg.getType());
ReduceOp::build(builder, state, inferredReturnTypes, operands, axis);
ScanOp::build(builder, state, inferredReturnTypes, operands, axis, reverse);
}

LogicalResult
Expand Down

0 comments on commit c5036b9

Please sign in to comment.