~/talk

Is C++23 std::mdspan a Zero-overhead Abstraction?

Talkat CppCon 2023 · on Wednesday, 2023-10-04· at 15:15· Cottonwood 8/9, 6700 North Gaylord Rockies Boulevard· [rust]
links:none on file
slides:none on file

Asks whether std::mdspan is zero‑overhead and measures it concretely: compiles matrix and image kernels, compares generated assembly against BLAS‑style low‑level code using Clang at O2/O1 and Google Benchmark, counts assembly lines (baseline ~32, initial mdspan ~42 then ~35 after tweaks), isolates the extra instructions to ABI and layout choices, implements a stride‑only layout and splits extents to shrink the object so registers instead of stack are used, and finds parity on System V but extra stacks and memory ops remain on MSVC due to the System V ABI and Windows calling convention limits; uses std::mdspan and layout_stride variants to reach zero overhead only with careful layout and platform-aware packing.

AI-written summary · about

  1. 0:00Introduction
  2. 1:08What is std::mdspan
  3. 3:15Matrix addition with BLAS
  4. 5:47Assembly for matrix add
  5. 7:12Benchmarking O2 vs O1
  6. 9:18std::mdspan for matrix ops
  7. 13:21Matrix addition with std::mdspan
  8. 16:17Overhead in std::mdspan asm
  9. 19:50Optimizing std::mdspan
  10. 23:06ABI limitations
  11. 25:16Identical asm with optimizations
  12. 27:26User-friendly wrappers
  13. 30:14MSVC ABI issues
  14. 32:29Key takeaways
  15. 34:23Q&A
  16. 36:54Q&A
  17. 39:27Higher-dim std::mdspan
  18. 46:25Conclusion
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.