Skip to content

feat: let a share of 0 computeUnits run on all CUs without a mask - #55

Merged
moezdil merged 1 commit into
mainfrom
feat/compute-sharing
Nov 17, 2026
Merged

moezdil merged 1 commit into
mainfrom
feat/compute-sharing

Conversation

@moezdil

@moezdil moezdil commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

What type of PR is this?

/kind feature

What this PR does / why we need it:

Under GPUSharing a claim can now request 0 computeUnits and then runs on every CU of the GPU without HSA_CU_MASK, so memory slices can share compute.

Which issue(s) this PR fixes:
Refs Project-HAMi/HAMi#3442

AI Disclosure:

AI assistance was used for the code, tests and checks; I reviewed every change.

Under GPUSharing a claim could not ask for fewer than 1 CU, so a memory
slice always took CUs and got HSA_CU_MASK. computeUnits now accepts 0,
and such a share gets only its memory limit and runs on every CU of the
GPU, next to the other shares.

Signed-off-by: mesutoezdil <mesudozdil@gmail.com>
@hami-robot

hami-robot Bot commented Nov 17, 2026

Copy link
Copy Markdown

@moezdil: The label(s) kind/feature cannot be applied, because the repository doesn't have them.

Details

In response to this:

What type of PR is this?

/kind feature

What this PR does / why we need it:

Under GPUSharing the computeUnits request policy had min: 1, so every share of a GPU took at least one CU and got HSA_CU_MASK. There was no way to share compute and split only memory. The minimum is now 0, and a share that consumes 0 CUs gets no mask and runs on every CU, with only its memory limit. Shares with CUs still get their own CUs; a 0-CU share holds none, so it never blocks them.

HAMi-DRA uses this for its AMD compute sharing mode (roadmap item "AMD: support compute Sharing mode (not setting CU_MASK)" in Project-HAMi/HAMi#3442).

Which issue(s) this PR fixes:
Refs Project-HAMi/HAMi#3442

Special notes for your reviewer:

Tested with unit tests (fail without the change) and in a kind cluster (Kubernetes 1.37) with a device published with this policy: a 0-CU claim was allocated with consumedCapacity.computeUnits: 0 next to a 16-CU claim on the same GPU. With the old min: 1 the scheduler rounds 0 up to 1 CU. Not run on an AMD GPU: no card was reachable.

Does this PR introduce a user-facing change?:

yes. a claim can request computeUnits: 0 to share all CUs of a GPU without HSA_CU_MASK.

AI Disclosure:

I used Claude Code to help investigate the code, write the change and tests, and run the checks; I reviewed every change.

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-sigs/prow repository.

@hami-robot

hami-robot Bot commented Nov 17, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: moezdil

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

The pull request process is described 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

@hami-robot hami-robot Bot added the approved label Nov 17, 2026
@coderabbitai

coderabbitai Bot commented Nov 17, 2026

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: fd908bb9-a124-44b5-92ca-18cd8a7a4006
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@moezdil
moezdil merged commit a063cd1 into main Nov 17, 2026
7 of 8 checks passed
@moezdil moezdil mentioned this pull request Nov 17, 2026
@Shouren Shouren moved this from In review to Done in HAMi Roadmap & Release Tracking Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Development

Successfully merging this pull request may close these issues.

1 participant