-
Notifications
You must be signed in to change notification settings - Fork 74
Simplify IdModel options #5808
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
Simplify IdModel options #5808
Conversation
|
!test --diff |
Greptile OverviewGreptile SummaryThis PR significantly simplifies the IdModel configuration system by consolidating multiple granular options into a single unified approach. The primary goal is to make the IdModel easier to enable globally before it becomes the default indexing path. Key SimplificationsOption Configuration
Code Architecture
Behavioral ChangesAlways-Built Components (important for understanding resource usage):
These are constructed regardless of whether TensorIndexer will be used, which increases baseline memory/compute overhead but simplifies the code paths. Automatic TensorIndexer Enabling (IMPORTANT - functional change):
This means MMA operations and certain complex tensor transformations will use the legacy indexer by default unless IdModel is explicitly enabled or the fusion contains other triggering operations (ArgsortOp, PadOp, ScanOp, ScatterOp, SliceOp, TopKOp, CpAsyncBulk, or reshape with expanded broadcast). Test UpdatesAll tests updated to remove argument passing to Confidence Score: 4/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant User
participant ENV as Environment Variable
participant Options as EnableOptions
participant IdModelOpts as IdModelOptions
participant Lower as GpuLower::analysis
participant IdModel
participant TensorIndexer
participant Indexer as Index/Predicate Compute
User->>ENV: Set NVFUSER_ENABLE=id_model
Note over ENV: OLD: id_model(all)<br/>NEW: id_model
ENV->>Options: Parse environment variable
Options->>IdModelOpts: Create with isOptionEnabled(IdModel)
Note over IdModelOpts: OLD: 7 boolean flags<br/>NEW: 1 tensor_indexer_enabled_
IdModelOpts->>Lower: getIdModelOptions(fusion)
Note over Lower: Check for specific ops:<br/>- CpAsyncBulk<br/>- ArgsortOp, PadOp, etc.<br/>- ReshapeOp with expanded broadcast
alt TensorIndexer needed for ops
Lower->>IdModelOpts: setTensorIndexer(true)
end
alt TensorIndexer not supported
Lower->>IdModelOpts: setTensorIndexer(false)
end
Lower->>IdModel: Always build IdModel
Note over IdModel: OLD: Conditional on buildIdModel()<br/>NEW: Always built
Lower->>TensorIndexer: Always build TensorIndexer
Note over TensorIndexer: OLD: Conditional on buildTensorIndexer()<br/>NEW: Always built
alt isTensorIndexerEnabled()
Lower->>IdModel: allocateLoopIndexVariables()
end
Indexer->>IdModelOpts: isTensorIndexerEnabled()?
alt Enabled
Indexer->>TensorIndexer: Use TensorIndexer for indexing/predicates
else Disabled
Indexer->>Indexer: Use legacy indexer
end
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No files reviewed, no comments
|
!test |
|
Review updated until commit be3515d Description
|
| Relevant files | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Enhancement | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Tests | 1 files
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Additional files | 57 files
|
PR Reviewer Guide
Here are some key observations to aid the review process:
| 🧪 PR contains tests |
| ⚡ Recommended focus areas for review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No files reviewed, no comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 files reviewed, 2 comments
| tensor_indexer_ = std::make_unique<TensorIndexer>(info().idModel()); | ||
|
|
||
| non_divisible_predicate_info_ = | ||
| std::make_unique<NonDivisiblePredicateInfo>(fusion_); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Behavioral Change: TensorIndexer and NonDivisiblePredicateInfo are now always constructed, regardless of whether TensorIndexer is enabled for use.
Previously, these were only constructed when buildTensorIndexer() was true. This means:
- Additional memory allocation occurs in all cases now
- Construction overhead happens even when not used
- Any code checking
GpuLower::current()->isTensorIndexerEnabled()(which checks if the pointer is non-null) will now always return true
The decision to use TensorIndexer is now solely controlled by idModelOptions().isTensorIndexerEnabled() (the boolean flag), but the object itself always exists. This separation is important to understand for maintenance.
jjsjann123
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks straightforward to me.
|
!build |
I used to use selective options to enable part of the new indexer such as
NVFUSER_ENABLE=id_model(producer_index), but I rarely use the selective options anymore.Before globally enabling the new indexer, this PR just simplifies the option configuration. Previously, it has to be
NVFUSER_ENABLE=id_model(all). With this PR, it's justNVFUSER_ENABLE=id_model.