Leveraging C++20/23 Features for Low Level Interactions
can we use C++ to make HW access cleaner, safer, and more testable?Why is C so proli�c? It’s the kernel, silly! 30 years ago, all low level interaction was done with C Organizations are very comfortable Safety Sophisticated Strong Typing System Inheritance and Polymorphism But you may still need: Kernel functions Existing APIs Conversion to raw pointers So, use C++, but don’t negate the advantages LOTS of code out there!1 To rewrite a modest sized C code base would take years! Rewriting the linux kernel is likely intractable. �. See also Stroustrup (2023), in referencesWhy not rewrite all the C0 码力 | 56 页 | 5.39 MB | 5 月前3simd: How to Express Inherent Parallelism Efficiently Via Data-Parallel Types
Overview Example: Image Processing Programming Models Outlook Summary single-precision multiply-add Linux, GCC 13, Intel Xeon W-2145 (2 AVX-512 FMA ports) 1 void peak(benchmark::State& state) { 2 float Overview Example: Image Processing Programming Models Outlook Summary single-precision multiply-add Linux, GCC 13, Intel Xeon W-2145 (2 AVX-512 FMA ports) 1 void peak(benchmark::State& state) { 2 float Overview Example: Image Processing Programming Models Outlook Summary single-precision multiply-add Linux, GCC 13, Intel Xeon W-2145 (2 AVX-512 FMA ports) 1 void peak(benchmark::State& state) { 2 float0 码力 | 160 页 | 8.82 MB | 5 月前3Boosting Software Efficiency
network issues. 19 None of the errors were seen in the lab.Technology Stack 20TECHNOLOGY STACK ⊡ Linux kernel, Yocto distribution – old image – no sources. ⊡ 32 MB RAM. ⊡ C++17 (in style of C++11 and earlier) ⊡ Qt – an application framework – a wrapper to low-level programming. 21TECHNOLOGY STACK ⊡ Linux kernel, Yocto distribution – old image – no sources. ⊡ 32 MB RAM. ⊡ C++17 (in style of C++11 and earlier) ⊡ Qt – an application framework – a wrapper to low-level programming. 22TECHNOLOGY STACK ⊡ Linux kernel, Yocto distribution – old image – no sources. ⊡ 32 MB RAM. ⊡ C++17 (in style of C++11 and earlier)0 码力 | 180 页 | 1.65 MB | 5 月前3Shared Libraries and Where To Find Them
linker [ld] ● Program is typically called ld ○ other implementations: ld.gold, lld, mold ● On Linux, typically invoked by gcc itself via the collect2 tool g++ my_program.cpp -o my_program -lfoo linker [ld] - search procedure (cont’d)The dynamic linker/loader [ld-linux.so] ELF executables are “interpreted” by an application: ld-linux.so The full path to it is embedded in the executable ELF headers:The linker/loader [ld-linux.so] ● Default search path ○ Man ld.so ○ /etc/ld.so.conf.d/ ○ (a cache) ● LD_DEBUG=libs ./executable (for search procedure) ● ldd ./executable (to list locations)Linux example: library0 码力 | 94 页 | 6.49 MB | 5 月前3Common Package Specification: Getting Build Tools to Talk to Each Other
build & host contexts myapp protobuf protobuf Windows, x86_64 msvc 16 Linux, armv8 gcc 5 linux Host context (embedded Linux) Build context (Windows PC) |--include | protobuf.h |--lib | protobuf build & host contexts myapp protobuf protobuf Windows, x86_64 msvc 16 Linux, armv8 gcc 5 linux Host context (embedded Linux) Build context (Windows PC) |--include | protobuf.h |--lib | protobuf build & host contexts myapp protobuf protobuf Windows, x86_64 msvc 16 Linux, armv8 gcc 5 linux Host context (embedded Linux) Build context (Windows PC) |--include | protobuf.h |--lib | protobuf0 码力 | 94 页 | 1.58 MB | 5 月前3LLVM's Realtime Safety Revolution: Tools for Modern Mission Critical Systems
problematic code - Be able to fail a CI pipeline build:linux build:mac build:win build rtsan real-time safety unit:mac unit tests unit:win unit:linux unit:mac:armLLVM 20 1. RealtimeSanitizer 2. Performance /app/example.cpp:6:12 #1 0x7dbed6c29d8f (/lib/x86_64-linux-gnu/libc.so.6+0x29d8f) #2 0x7dbed6c29e3f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e3f) #3 0x5770e08ba394 in _start __rtsan_expect_not_realtime(“pthread_cond_sigKernel System Call Interface (SCI) Kernel Internals User space Kernel space User C++ Application auto w = std::make_unique(); throw std: 0 码力 | 153 页 | 1.38 MB | 5 月前3Tracy: A Profiler You Don't Want to Miss
(nanosecond resolution) Negligible overhead (a few nanoseconds per zone) Cross-platform (Windows, Linux, macOS, iOS, Android, WASM*) Hybrid profiling capabilities (sampling and/or instrumentation) (CPU (nanosecond resolution) Negligible overhead (a few nanoseconds per zone) Cross-platform (Windows, Linux, macOS, iOS, Android, WASM*) Hybrid profiling capabilities (sampling and/or instrumentation) Tracing (nanosecond resolution) Negligible overhead (a few nanoseconds per zone) Cross-platform (Windows, Linux, macOS, iOS, Android, WASM*) Hybrid profiling capabilities (sampling and/or instrumentation) Tracing0 码力 | 85 页 | 6.51 MB | 5 月前3Adventures in SIMD Thinking (Part 2 of 2)
interesting problems • Intra-register sorting • Fast linear median-of-seven filter • Fast small-kernel convolution • Faster (?) UTF-8 to UTF-32 conversion (with AVX2) • No heavy code, but lots of pictures Bob Steagall Small-Kernel Convolution 3 CppCon 2020 - Adventures in SIMD ThinkingCopyright © 2020 Bob Steagall K E W B C O M P U T I N G Convolution • f is a signal • g is a kernel • Output f*g is the len) { //- The convolution kernel must have non-negative size and fit with a single register. // static_assert(KernelSize > 1 && KernelSize <= 16); //- The index of the kernel center must be valid. //0 码力 | 135 页 | 551.08 KB | 5 月前3Just-in-Time Compilation - J F Bastien - CppCon 2020
network packets, into the kernel, safely.Exokernel An Operating System Architecture for Application-Level Resource Management In the exokernel architecture, a small kernel securely exports all hardware which a complete and unmodified operating system is run in a virtual machine and Linux user mode emulation where a Linux process compiled for one target CPU can be run on another CPU. — 2005 (read)QEMU which a complete and unmodified operating system is run in a virtual machine and Linux user mode emulation where a Linux process compiled for one target CPU can be run on another CPU. — 2005 (read)QEMU0 码力 | 111 页 | 3.98 MB | 5 月前3Tracy: A Profiler You Don't Want to Miss
(nanosecond resolution) Negligible overhead (a few nanoseconds per zone) Cross-platform (Windows, Linux, macOS, iOS, Android, WASM*) Hybrid profiling capabilities (sampling and/or instrumentation) (CPU (nanosecond resolution) Negligible overhead (a few nanoseconds per zone) Cross-platform (Windows, Linux, macOS, iOS, Android, WASM*) Hybrid profiling capabilities (sampling and/or instrumentation) Tracing (nanosecond resolution) Negligible overhead (a few nanoseconds per zone) Cross-platform (Windows, Linux, macOS, iOS, Android, WASM*) Hybrid profiling capabilities (sampling and/or instrumentation) Tracing0 码力 | 84 页 | 8.70 MB | 5 月前3
共 174 条
- 1
- 2
- 3
- 4
- 5
- 6
- 18
相关搜索词
LeveragingC++2023FeaturesforLowLevelInteractionssimdHowtoExpressInherentParallelismEfficientlyViaDataParallelTypesBoostingSoftwareEfficiencySharedLibrariesandWhereToFindThemCommonPackageSpecificationGettingBuildToolsTalkEachOtherLLVMRealtimeSafetyRevolutionModernMissionCriticalSystemsTracyProfilerYouDonWantMissAdventuresinSIMDThinkingPartofJustTimeCompilationBastienCppCon2020