Conversation
|
!test |
|
Review updated until commit 475f7b3 Description
|
| Relevant files | |||||||
|---|---|---|---|---|---|---|---|
| Error handling |
| ||||||
| Enhancement |
| ||||||
| Tests |
|
PR Reviewer Guide
Here are some key observations to aid the review process:
| 🧪 PR contains tests |
| ⚡ Recommended focus areas for review |
Potential Runtime Failures
|
|
!test |
Greptile OverviewGreptile SummaryThis PR removes codegen support for non-exact Key Changes:
Impact: Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant Registry as Scheduler Registry
participant ExprEval as ExprEval Scheduler
participant TensorIndexer
participant LegacyIndexer as Legacy Indexer (to be removed)
User->>Registry: Schedule fusion with GatherOp
alt Non-exact gather (exactSizes() == false)
Registry-->>User: Reject: "Non-exact gather ops"
Note over Registry: checkCanSchedule returns false
Registry->>ExprEval: Delegate to ExprEval
ExprEval-->>User: Use ATen evaluation
else Exact gather (takeAlongAxis)
Registry->>TensorIndexer: Attempt scheduling
TensorIndexer->>TensorIndexer: isSupported check
alt isSupported fails
TensorIndexer-->>Registry: NVF_ERROR assertion
Note over TensorIndexer: Should not happen after<br/>scheduler changes
else isSupported passes
TensorIndexer-->>User: Compile with TensorIndexer
end
end
Note over LegacyIndexer: Legacy indexer will be<br/>removed in follow-up PR
|
tests/cpp/test_gather.cpp
Outdated
| // Test grouped reduction on IterType::GatherScatter | ||
| TEST_F(GatherTest, GatherIterGoupedReduction) { | ||
| // Codegen support of non-exact gather dropped | ||
| TEST_F(GatherTest, DISABLED_GatherIterGoupedReduction) { |
There was a problem hiding this comment.
Do we still plan to support this later? wondering if we should remove the tests instead.
|
!build |
| // TODO: remove IndexPutAccumulateOp | ||
| if (exprs.front() | ||
| ->isOneOf< | ||
| GatherOp, |
There was a problem hiding this comment.
Adding GatherOp here routes ALL gather operations (including exact-sized takeAlongAxis) to ExprEval/ATen evaluation. The PR title says "but not takeAlongAxis", suggesting exact gather should still be compiled. Consider filtering to only accept non-exact gather:
| GatherOp, | |
| !exprs.front()->isa<GatherOp>() || !exprs.front()->as<GatherOp>()->exactSizes() ? GatherOp : void, |
Or clarify if the performance regression for takeAlongAxis is intentional.
|
!build |
3 similar comments
|
!build |
|
!build |
|
!build |
Gather allows non-gathered indices to have smaller output dimensions, which complicates indexing and is not yet supported by TensorIndexer and is supported only by the legacy indexer. Note that takeAlongAxis, which is a limited case of gather, is supported.
The motivation is to remove the legacy indexer. This is the only remaining fallback case.
One way to support it is to decompose it into a takeAlongAxis and slice. For now, this PR disables codegen of gather and delegates to ExprEval.
Note that the cross-entropy benchmark does use gather rather than takeAlongAxis. There's a pending change needed in Thunder. See #3924 (comment). While this is a perf regression, at this point I think it'd more important to remove the large technical debt.
In a follow-up PR, I'll remove the legacy indexer. This PR just inserts an assertion that no fallback is necessary, which should be true by the scheduler changes.