← Back to Pull requests

[FEA] Add support for mdspan #1227

Closed
unknown closed this pull request without merging on Aug 26, 2026 22:43 UTC
View on GitHub
unknown unknown commented on Aug 17, 2026 05:29 UTC
Author

What this does

Adds two features:

1. Create a MatX tensor from an mdspan

make_tensor can now create a MatX tensor from a cuda::std::mdspan

2. Ability to use tensor[i, j] with C++23

When the compiler supports C++23 multidimensional indexing, tensors can use:

tensor[2, 3] = value;
auto value = tensor[2, 3];

Testing

Added tests for mdspan and operator[]

Built and ran the tensor tests with:

cmake --build build \
  --target test_00_tensor_MakeTensorTests \
  --parallel 2

./build/test/test_00_tensor_MakeTensorTests \
  --gtest_filter='MakeTensorTests.*Mdspan*'

./build/test/test_00_tensor_MakeTensorTests

Testing was done using:

  • Google Colab

  • Tesla T4 GPU

  • CUDA 12.8.93

  • NVIDIA driver 580.82.07

  • GCC 11.4.0

  • CMake 3.31.10

  • C++20
  • The mdspan changes and the full MakeTensorTests suite passed with C++20

    The new operator[] feature requires C++23 multidimensional subscript support,
    which is not available with CUDA 12.8. I could not update the CUDA environment
    due to administrative permission restrictions

    I would really appreciate it if the C++23 tests could be run in a compatible
    environment during review.

    Documentation

    Updated the documentation with:

  • How to create a MatX tensor from an mdspan

  • The new C++23 tensor[i, j] syntax

  • Continued support for tensor(i, j)` in C++20 and C++23
  • Related issue

    Closes #582

    Diff: 181 lines (+135 / -46) across 2 files Reviewer: MashrafeeAryan Review duration: 13993m
    All Vouch review confidence checks passed
    Residual risk 0.15 = Change Risk (0.36) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.36 · 181 lines diff across 2 files
    0.36
    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.311
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #1227"
    general weight: 0.35
    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: 35.6% (MEDIUM) · Higher = larger blast radius
    35.6%
    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: 15.4% · Safe to merge
    15.4%
    Repository