Avoid aggregate CUmemLocation initialization - #2673
Conversation
|
|
That's a bummer. I wish we wouldn't need to change code for this. What if we suppressed these specific warnings (for My agent came up with this workaround. What do you think? |
|
I will leave the decision up to you. |
juenglin
left a comment
There was a problem hiding this comment.
Don't like it. Hope the workaround works.
codex gpt-5.6-sol reports: The alternative has three concerns:
@ajost, since you reviewed #2434 and #2593, could you weigh in on the two approaches here? Maybe there is a better 3rd alternative? |
The same concern applies to the changes in this PR. Another alternative is to isolate the 13.3/13.4 difference to the |
Summary
Initialize
CUmemLocationstructures by declaring them and assigning the activetypeandidfields instead of using Cython aggregate constructors. Apply the same pattern when constructing the nestedCUmemLocationinsideCUmemAccessDesc.This preserves the existing behavior while keeping the source compatible with both the older two-member generated declaration and the newer CUDA 13.4 declaration.
Rationale
This issue surfaced while building #2641. Public main's
cuda.coresource used aggregate initializers such as:The older generated declaration exposed only
typeandid, making that initializer complete. CUDA 13.4 adds thelocalizedarm to the anonymous location union, so the generated Cython declaration exposestype,id, andlocalized. With that declaration, Cython reports:All affected paths currently construct location kinds whose active payload is
id:DEVICE,HOST,HOST_NUMA, orHOST_NUMA_CURRENT. They do not constructDEVICE_LOCALITY_DOMAIN, which uses thelocalizedarm. Declaring the structure and assigning only its active fields therefore expresses the intended union use directly and compiles against both generated layouts.This is a source-compatibility change only; it does not alter the selected location types, IDs, access flags, or runtime control flow.
Note for completeness
The aggregate initialization style entered through #2434 and was valid for the generated binding declaration available at that time. Public PR #2593 later centralized one of the location conversions in
_memory/_location.pxd, so this patch updates that shared helper as well as the original call sites. This is a narrow compatibility follow-up that preserves the broader refactoring in those PRs.