NVIDIA / NVIDIA/cccl

`logical_device` and `green_context`: can we do better?

Open
#5,484 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
2.5k
Forks
487
Avg merge
2d 7h
Merged PRs (30d)
296

Description

Lately, I've been digging in cudax's and I found some inconsistencies.

I don't understand, why a non-owning wrapper for `physical_device`/`green_context` is called `logical_device`. I find it quite confusing especially now when `device` was renamed to `physical_device`. All other non-owning wrappers are called `name_ref` in our implementation.

And then there is the `green_context` that seems to me a bit abandoned and without any useful implemented features - I mean selecting the device resources for the `green_context`.

What would make sense to me would be renaming `green_context` to `logical_device`, because that's what it basically is - we create a logical/virtual device on a physical device with limited resources.

Then, I think we could move the old `logical_device` functionality to `device_ref`, that would refer either to `physical_device` or `logical_device`. The actual device could be queried by a `kind()` method that would return something like `enum class device_kind`.

Contributor guide

Open the contributing guide

Research direction

Review cudax's existing physical_device, logical_device, green_context, and device_ref wrappers, comparing their ownership and resource-selection behavior. The issue does not identify files or tests, so first locate those definitions and establish the API design before changing names or relationships; done means the wrapper roles and green_context resource selection are consistent.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
backend-api-design
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.