Skip to content

[FEA] cuda.core: green context / device-resource follow-ons (CUDA 13.0-13.3) #2366

Description

@leofang

Summary

Green-context support in cuda.core (epic #112, closed) predates CUDA 12.8, and
_device_resources.pyx
already covers part of the 13.1 additions (SM-resource split via cuDevSmResourceSplit,
workqueue scope enums, backfill flag). This issue tracks the remaining 13.x deltas.

Underlying C APIs to cover

Symbol Purpose
cuGreenCtxGetId(CUgreenCtx, unsigned long long* greenCtxId) (13.0) stable green-context identifier
CUdevSmResource.minSmPartitionSize / .smCoscheduledAlignment (13.0), .flags (13.1) new SM-resource introspection fields
cuStreamGetDevResource(CUstream, CUdevResource*, CUdevResourceType) (13.1) query resources of the context a stream belongs to
CU_DEV_SM_RESOURCE_SPLIT_{IGNORE_SM_COSCHEDULING,MAX_POTENTIAL_CLUSTER_SIZE} (13.1) split-by-count flags (unexposed; BACKFILL group flag is already used)
CU_DEV_SM_RESOURCE_GROUP_DEFAULT (13.1) group flag
CUdevWorkqueueResource, CUdevWorkqueueConfigResource, CUdevResource.wq/.wqConfig/.nextResource (13.1) workqueue resource structs/fields (the enum members are recognized, the structs are unexposed)
CU_GREEN_CTX_NONE (13.3) green-ctx creation flag
cuCtxGetDevice_v2 / cuCtxSynchronize_v2 (13.0) green-ctx-aware variants — audit which entry points cuda.core should call on 13.x

Design sketch (draft — needs design-meeting review)

Important

Starting point only, not a settled design — review in the cuda.core design meeting.

  • GreenContext.id property (cuGreenCtxGetId).
  • Stream.device_resources accessor (cuStreamGetDevResource).
  • Split-by-count keyword flags on the existing split API
    (ignore_sm_coscheduling=, max_potential_cluster_size=).
  • Workqueue resource wrapper types mirroring the existing SM-resource wrappers.
  • Audit task: switch context-query/sync call sites to the _v2 entry points where semantics
    require it on 13.x.

Open questions for the meeting:

  1. How much of the workqueue config (sharingScope, wqConcurrencyLimit, device) to surface.
  2. Whether the new CUdevSmResource fields belong on the existing resource wrapper as plain
    properties (probably yes; mechanical).
  3. Flag defaults and naming for split options.

References

-- Leo's bot

Activity

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

Metadata

Metadata

Assignees

Labels

cuda.coreEverything related to the cuda.core modulefeatureNew feature or request

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions