Skip to content

CORE/SERVICE_COLL: Add embedded req flag and ctx-scoped allreduce - #1347

Open
bwestheimer wants to merge 3 commits into
openucx:masterfrom
bwestheimer:bwestheimer/pub-team-cache-service-allreduce
Open

CORE/SERVICE_COLL: Add embedded req flag and ctx-scoped allreduce#1347
bwestheimer wants to merge 3 commits into
openucx:masterfrom
bwestheimer:bwestheimer/pub-team-cache-service-allreduce

Conversation

@bwestheimer

Copy link
Copy Markdown
Collaborator

What

Add embedded flag to ucc_service_coll_req_t and a new ucc_service_allreduce_ctx() function.

When embedded is set, ucc_service_coll_finalize skips ucc_free(req) so callers can embed the request inside a larger struct rather than heap-allocating it. ucc_service_allreduce_ctx() runs a BAND allreduce over a caller-supplied ctx-rank subset via the context-level service team, without requiring a built team ctx_map.

Why

Part of the communicator caching series (see #1346 for context). The cache agreement vote runs during ucc_team_create_post before the new team's ctx_map is available. The existing ucc_service_allreduce requires a built map; this variant takes a direct ctx-rank list. The embedded flag lets the vote request live inside ucc_team_t with no separate allocation.

Depends on #1346.

The alloc path builds an id as i * 64 + pos, where i is the pool word
index and pos is in [1, 64], so bit (pos - 1) of word i encodes that id.
The release path instead computed map_pos = id / 64, which for any id
that is a multiple of 64 names the next word: id 64 was released as
word 1 bit 63, the slot for id 128. That leaks id 64 and hands out
id 128 twice.

Use map_pos = (id - 1) / 64 so release is the exact inverse of alloc.
Expose the two pool bit helpers so the boundary behavior can be tested
directly, and add a gtest that round-trips ids across every word
boundary and checks no residue is left in the pool.
Move the ucc_assert(id >= 1) guard to the top of
ucc_team_id_pool_set_bit so invalid ids are rejected before
the (id - 1) subtraction; a value of 0 or INT_MIN would
cause signed overflow UB before the assert fires.
Add an 'embedded' flag to ucc_service_coll_req_t. When set,
ucc_service_coll_finalize skips ucc_free(req) so the request can live in
caller-owned storage instead of being heap allocated. The team agreement
vote embeds its request directly in ucc_team_t and relies on this.

Add ucc_service_allreduce_ctx, which runs an allreduce over a
pre-materialized subset of context endpoints using the context-level
service team. The existing ucc_service_allreduce resolves subset ranks
through team->ctx_map, which is not yet built while a team is being
created. The new entry point maps subset indices straight to context
ranks and routes through ctx->service_team, so the agreement vote can run
before ctx_map exists.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant