Skip to content

KEP-2628: Support KAI Scheduler in Kubeflow Trainer#2663

Closed
Harshal292004 wants to merge 5 commits into
kubeflow:masterfrom
Harshal292004:kai_kep
Closed

KEP-2628: Support KAI Scheduler in Kubeflow Trainer#2663
Harshal292004 wants to merge 5 commits into
kubeflow:masterfrom
Harshal292004:kai_kep

Conversation

@Harshal292004

@Harshal292004 Harshal292004 commented Jun 8, 2025

Copy link
Copy Markdown
Contributor

This is the Kubeflow Enhancement Proposal for supporting KAI Scheduler in Kubeflow Trainer V2:

Related: #2628

Any suggestions or feedback are welcome !
@romanbaron @kannon92
/cc @andreyvelich @tenzen-y @Electronic-Waste

Signed-off-by: Harshal292004 <malaniharshal95@gmail.com>
@google-oss-prow

Copy link
Copy Markdown

@Harshal292004: GitHub didn't allow me to request PR reviews from the following users: romanbaron, kannon92.

Note that only kubeflow members and repo collaborators can review this PR, and authors cannot review their own PRs.

Details

In response to this:

This is the Kubeflow Enhancement Proposal for supporting KAI Scheduler in Kubeflow Trainer V2:

Related: #2628

Any suggestions or feedback are welcome !

/cc @andreyvelich @tenzen-y @Electronic-Waste @romanbaron @kannon92

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@google-oss-prow

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign electronic-waste for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@coveralls

coveralls commented Jun 8, 2025

Copy link
Copy Markdown

Pull Request Test Coverage Report for Build 15726042285

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 29.19%

Totals Coverage Status
Change from base Build 15579727901: 0.0%
Covered Lines: 897
Relevant Lines: 3073

💛 - Coveralls

Signed-off-by: Harshal292004 <malaniharshal95@gmail.com>
@@ -0,0 +1,89 @@
# KEP-2628: Support KAI Scheduler in Kubeflow Trainer

This KEP proposes integrating NVIDIA's KAI Scheduler into Kubeflow Trainer V2 to enable gang-scheduling capabilities for TrainJob resources, extending the existing PodGroupPolicy API to support KAI alongside current schedulers like Co-Scheduling. The integration will leverage KAI's PodGrouper service to create scheduling queues and apply appropriate labels for efficient resource allocation in AI workloads.

@romanbaron romanbaron Jun 9, 2025

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Small comment here: PodGrouper Service will create the podGroup object, queues will have to be created by a different entity, probably by a trainer plugin.
This point is perfectly explained below so the rest is accurate.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I have resolved this , you may have a look @romanbaron

}

type KAIConfig struct {
Queue string `json:"queue,omitempty"`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is going to be really confusing to someone who uses KAI + Kueue.

cc @romanbaron.

Is there anyway to use gang scheduling in KAI without needing a KAI queue?

Volcano is used for PodGroup functionality in Trainer but I don't think one has to use Volcano Queues to use this.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Each KAI PodGroup must reference a designated KAI scheduling queue to clarify which queue’s resources are allocated to it.

One approach to integrating KAI with Kueue is to configure a single, unlimited queue for KAI, allowing Kueue to govern resources and dispatch workloads. Under this model, KAI schedules only the workloads that have been dispatched (i.e., pods are created and ungated), while fairness enforcement remains outside its scope.

@kannon92 - does it sounds like a possible solution? If not, we can discuss the possible options further.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think that makes sense to me.

Harshal292004 and others added 2 commits June 15, 2025 20:40
Signed-off-by: Harshal292004 <malaniharshal95@gmail.com>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@Harshal292004, starting from v0.6.0 release KAI-Scheduler uses a different label key for queue, now it is kai.scheduler/queue instead of runai/queue.
Some more details are available here:
https://github.com/NVIDIA/KAI-Scheduler/tree/main/docs/migrationguides/v0.6.0#scheduling-queue-label-key
I think it will be best to align to the new version from now on.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed it

Signed-off-by: Harshal292004 <malaniharshal95@gmail.com>
@Harshal292004 Harshal292004 requested a review from romanbaron June 18, 2025 06:58
@Harshal292004

Copy link
Copy Markdown
Contributor Author

@romanbaron Does this make sense ?:

type PodGroupPolicySource struct {
	Coscheduling  *CoschedulingPodGroupPolicySource  `json:"coscheduling,omitempty"`
	Kaischeduling *KaischedulingPodGroupPolicySource `json:"kaischeduling,omitempty"`
}

type KaischedulingPodGroupPolicySource struct {
	MinMember         *int32  `json:"minMember,omitempty"`
	Queue             *string `json:"queue,omitempty"`
	PriorityClassName *string `json:"priorityClassName,omitempty"`
	MarkUnschedulable *bool   `json:"markUnschedulable,omitempty"`
	SchedulingBackoff *int32  `json:"schedulingBackoff,omitempty"`
}

@romanbaron

romanbaron commented Jun 30, 2025

Copy link
Copy Markdown
KaischedulingPodGroupPolicySource

KaischedulingPodGroupPolicySource is not needed, once the pods of the workload have schedulerName: kai-scheduler in the spec and kai.scheduler/queue label with the queue name, the pod-group will be created automatically by KAI and the workload will be scheduled.

@github-actions

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@andreyvelich

Copy link
Copy Markdown
Member

@Harshal292004 Are you going to work on this, or we should find new contributors who can take this over ?

@Harshal292004

Copy link
Copy Markdown
Contributor Author

@andreyvelich This PR can be reassigned to new contributors

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants