cuda::experimental::places::locality_domain_ctx_cache#

class locality_domain_ctx_cache#

Cache of per-domain green contexts and stream pools.

For each device, splits the SM resource by locality domain via cuDevSmResourceSplit (one CU_DEV_SM_RESOURCE_GROUP_PARAMS per domain with CU_DEV_SM_RESOURCE_GROUP_LOCALITY_DOMAIN_ID), then creates one green context per domain. Each green context provides a primary CUcontext used as the execution place’s context: streams created there are bound to the domain’s SM partition.

Domain index i corresponds directly to the domain ordinal used for localized memory, so exec_place::locality_domain(d, i) and data_place::locality_domain(d, i) are co-located.

Each SM split method (see locality_domain_sm_split) gets its own set of green contexts, so places built with different methods for the same domain are distinct places with distinct SM partitions. On a device with a single domain (or when the driver cannot report domains) the method is ignored and every method maps to one whole-device green context.

Entries are created lazily per (device, split method) and kept alive for the process, which also guarantees the (non-owning) exec_place_cuda_ctx_impl places built on top always refer to a live context. Thread-safe.

Public Functions

inline const domain_entry &get(
int dev_id,
int domain_id,
locality_domain_sm_split split
)#

Public Static Functions

static inline locality_domain_ctx_cache &instance()#
struct domain_entry#

Public Members

CUgreenCtx g_ctx = {}#
CUcontext primary_ctx = nullptr#
stream_pool pool#