← Back to Pull requests

cub, libcu++: advertised properties + their checking in DeviceReduce. #11577

Closed
unknown closed this pull request without merging on Nov 18, 2026 00:17 UTC
View on GitHub
unknown unknown commented on Sep 22, 2026 05:17 UTC
Author

Description

Resolves #7797.

An incorrectly implemented environment query can silently select a default in CUB. This PR lets environments advertise the customizations they provide and makes cub::DeviceReduce diagnose broken advertised queries.

cuda::execution::property_keys_t<T> obtains a type's advertised query list. User-defined types supply that list through T::property_keys, using cuda::execution::property_key_list<...>. An entry property_query<Key, Args...> describes a CPO invocation with a const environment and the specified additional argument types; a bare Key is shorthand for a nullary invocation.

The advertisement is a nested typedef, so discovering it does not depend on dispatching another query. Standard-library types keep their metadata under a reserved implementation name, accessed through property_keys_t, to allow a future standard property interface without a source-compatibility conflict.

Metadata is supplied by cuda::std::execution::{prop, env}, cuda::stream_ref, cuda::mr::memory_resource_base, and asynchronous resource references. env combines and deduplicates its components' advertisements while retaining first-matching-member lookup. Validation checks individual advertised contributions so another provider cannot hide a broken advertisement, including in nested and inherited environments.

Validation checks the CPO invocation and instantiates its body without executing the query. Each advertised expression is checked separately so the failing query appears in the instantiation trace. Automatic CUB validation is limited to DeviceReduce: environments with metadata have their advertised customizations checked, while objects without metadata must support a stream or memory-resource query. Working unadvertised customizations remain usable, and unavailable queries retain their defaults.

cuda::checked_env<Queries...>(env) explicitly validates selected CPO invocations and returns a member-query-forwarding adaptor. It can also add metadata to a third-party environment or replace an existing advertised list.

A requested invocation may use the CPO's default when the input does not advertise that customization. If the input advertises a requested customization, its member must be present. The adaptor advertises only the requested expressions backed by supplied members; default-only invocations are checked without being advertised or manufacturing a member. This lets a checked default compose with other environments without shadowing a later provider. Supported member queries outside the checked list remain forwarded.

Checklist

  • New or existing tests cover these changes.

  • The documentation is up to date with these changes.
  • Diff: 341 lines (+255 / -86) across 4 files Reviewer: gonidelis Review duration: 81780m
    All Vouch review confidence checks passed
    Residual risk 0.18 = Change Risk (0.42) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.42 · 341 lines diff across 4 files
    0.42
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    56%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.349
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #11577"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 42.3% (MEDIUM) · Higher = larger blast radius
    42.3%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 56.8% · Lower = rushed or shallow review
    56.8%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 18.3% · Safe to merge
    18.3%
    Repository