Skip to content

Change Prefill and Decode filters to be based on a common filter#188

Merged
shmuelk merged 4 commits intollm-d:mainfrom
mayabar:pd-filters
Jun 30, 2025
Merged

Change Prefill and Decode filters to be based on a common filter#188
shmuelk merged 4 commits intollm-d:mainfrom
mayabar:pd-filters

Conversation

@mayabar
Copy link
Contributor

@mayabar mayabar commented Jun 17, 2025

Change Prefill and Decode filters to be based on a common Filter which contains list of valid values in the role label.

These filters cannot be based on ByLabel filter since it uses kubernetes selector which does not support OR between multiple conditions (the logic is: is specific label exists - must have one of the specified values OR the specific label does not defined at all)

Currently P/D schedulers use Prefill and Decode filters, which are filtering pods based on value of the role label.
Remove the old implementation and create these two filters as instances of ByLabel filter

Fixes #16
Supersedes #161

@nirrozenbaum
Copy link
Collaborator

I'd be very happy if we can wait with merging this PR few days until the work on #179 is completed.
#179 includes the transition to the latest GIE version and includes a lot of changes which are inevitable.
if possible, I prefer to avoid conflicts as much as possible cause each conflict makes it harder to merge changes and keep it consistent.. I don't like having such big PRs but unfortunately in this case there is no other way to make the transition to the latest GIE version.

Copy link
Collaborator

@elevran elevran left a comment

Choose a reason for hiding this comment

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

missing case of label not being defined at all. Otherwise, LGTM

@mayabar
Copy link
Contributor Author

mayabar commented Jun 18, 2025

@elevran is it a valid situation that there are pods which are not marked with 'llm-d.ai/role' label?
The previous Prefill/Decode filters filtered out such pods too.

@elevran
Copy link
Collaborator

elevran commented Jun 18, 2025

@elevran is it a valid situation that there are pods which are not marked with 'llm-d.ai/role' label? The previous Prefill/Decode filters filtered out such pods too.

Decode Pods were allowed when no label was defined. The code and comment on the function were inconsistent and the code had !defined in the set of conditions.

@mayabar mayabar changed the title Change Prefill and Decode filters to be based on ByLabel filter Change Prefill and Decode filters to be based on a common filter Jun 22, 2025
@mayabar
Copy link
Contributor Author

mayabar commented Jun 22, 2025

@shmuelk @elevran - can you please review again
the implementation was changed back to be based on a common filter with list of relevant roles + boolean that defines if missing label is ok. It is not based in ByLabel filter since it cannot support all required logic

@mayabar mayabar requested a review from elevran June 22, 2025 07:28
elevran
elevran previously approved these changes Jun 22, 2025
Copy link
Collaborator

@elevran elevran left a comment

Choose a reason for hiding this comment

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

approve.

However, note that the filter can be generalized to a cater for the Role based use cases even if it is defined in terms of labels (i.e., not the existing by-label which uses a label-selector).
What you need:

  • label name
  • allowed values
  • what to do when the label is missing

There's no reason to bind the implementation name to "Role". You can create specific instances of the label filter that use the "role" label name just as easily.
I don't want to hold this PR further, but I would prefer it is implemented more generically and not specific to the Role label.

shmuelk
shmuelk previously approved these changes Jun 22, 2025
@nirrozenbaum nirrozenbaum added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. and removed do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. labels Jun 22, 2025
mayabar added 2 commits June 30, 2025 13:34
Signed-off-by: Maya Barnea <mayab@il.ibm.com>
… the ByRoleLabel + add related test in scheduler test

Signed-off-by: Maya Barnea <mayab@il.ibm.com>
@mayabar mayabar dismissed stale reviews from shmuelk and elevran via dc460b7 June 30, 2025 11:10
@mayabar
Copy link
Contributor Author

mayabar commented Jun 30, 2025

approve.

However, note that the filter can be generalized to a cater for the Role based use cases even if it is defined in terms of labels (i.e., not the existing by-label which uses a label-selector). What you need:

  • label name
  • allowed values
  • what to do when the label is missing

There's no reason to bind the implementation name to "Role". You can create specific instances of the label filter that use the "role" label name just as easily. I don't want to hold this PR further, but I would prefer it is implemented more generically and not specific to the Role label.

@elevran Agree, current implementation has the label name hard-coded, I'll add it as a parameter and rename to ByLabel
@elevran what do you think about renaming the current ByLabel filter to ByLabelSelector

…rameter). Prefill and decode filters are instances of this filter

Signed-off-by: Maya Barnea <mayab@il.ibm.com>
@mayabar mayabar requested review from elevran and shmuelk June 30, 2025 11:28
Signed-off-by: Maya Barnea <mayab@il.ibm.com>
Comment on lines +33 to +34
// validValuesApp - list of valid values
func NewByLabel(name string, labelName string, allowsNoLabel bool, validValuesApp ...string) *ByLabel {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
// validValuesApp - list of valid values
func NewByLabel(name string, labelName string, allowsNoLabel bool, validValuesApp ...string) *ByLabel {
// validValues - list of valid values
func NewByLabel(name string, labelName string, allowsNoLabel bool, validValues ...string) *ByLabel {

Copy link
Collaborator

Choose a reason for hiding this comment

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

you can change to ByLabelSelector
Also change the doc to use the new name

@shmuelk shmuelk merged commit 3d8429a into llm-d:main Jun 30, 2025
2 checks passed
Jooho pushed a commit to Jooho/llm-d-inference-scheduler that referenced this pull request Sep 30, 2025
Signed-off-by: konflux-internal-p02 <170854209+konflux-internal-p02[bot]@users.noreply.github.com>
Co-authored-by: konflux-internal-p02[bot] <170854209+konflux-internal-p02[bot]@users.noreply.github.com>
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.

Merge Prefill and Decode filters into one

4 participants