Performance Engineering: Being Friendly to Your Hardware## 20 24 September 15 - 20 ## +24 ## Performance Engineering Being Friendly to Your Hardware ## I GNAS BAGDONAS ## Being Friendly to Your Hardware Performance Engineering A gentle introduction to hardware0 码力 | 111 页 | 2.23 MB | 1 年前3
Bringing Existing Code to CUDA Using constexpr and std::pmr## +21 ## Bringing Existing Code to CUDA Using constexpr and std::pmr BOWIE OWENS 20 21 October 24-29 ## Outline • Introduction • Memory • Host vs Device Functions • Return on Investment • Concluding 17. --expt-relaxed-constexpr (-expt-relaxed-constexpr) Experimental flag: Allow host code to invoke ___device___{constexpr} functions, and device code to invoke ___host___{constexpr} functions. Note that -nvcc/ index.html#options-for-altering-compiler-linker-behavior-expt-relaxed- constexpr ## Using constexpr constexpr void _add(std::size_t n, float const* x, float* y) { for (std::size_t i = 0;0 码力 | 51 页 | 3.68 MB | 1 年前3
Cache-Friendly Design in Robot Path Planning## Cache-friendly Design in Robot Path Planning ## BRIAN CAIRI 2023 | October ## About Me - This is my first time at CppCon! • Regularly program in C++ for robotics  ## Cache-friendly design ## Cache-friendly design Program design focused on optimizing code by avoiding pathological effects of computer system. ## Cache-friendly design Modern memory pipelines are so complex you are basically optimizing for the cache - Random person on StackOverflow ## Cache-friendly design  Complete OverviewExpressions • Pack Expansion in Lambda Captures ☐ constexpr Changes • virtual functions • union, try/catch, dynamic_cast, typeid • allocations • constexpr string & vector ☐ Concurrency Changes std::invoke(f, args...); }; Allowed in C++20 ## constexpr Changes ## constexpr ☐ constexpr virtual functions ☐ constexpr functions can now: • use dynamic cast() and typeid • do dynamic blocks But still cannot throw exceptions ## constexpr string & vector □ std::string and std::vector are now constexpr ☐ Needed to support constexpr reflection in the future  { std::array ## constexpr:强迫编译器在编译期求值(续) #includearr{}; for (int i = 1; i return ret; } int func() { constexpr int ret = func_impl(); return ret; } 结论:如果发现编译器放弃了自动优化,可以用 constexpr 函数迫使编译器进行常量折叠! 不过,constexpr 函数中无法使用非 constexpr 的容器:vector, map, set, string 等.... cpp:18: } movl $5050, %eax #, ret .cfi_endproc template constexpr int func_impl() { std::array arr{}; for (int 0 码力 | 108 页 | 9.47 MB | 2 年前3
Fast and small C++pair 1 template2 struct default_delete { 3 default_delete() = default; 4 5 constexpr void operator()(T* ptr) const noexcept 6 { 7 static_assert(0 < sizeof(T), "can't 24); constexpr static size_t max_cap() { return std::numeric_limits ::max(); } constexpr static size_t sso_cap() { return sizeof(mBuf) - 1; /* -1 for \0' */ } constexpr static bool fits_into_sso(size_t len) { return len <= sso_cap(); } constexpr bool is_long() const { return mPtr != mBuf; } constexpr string() : mPtr{mBuf}, mBuf{} constexpr string(const char* data, size_t len) : 0 码力 | 17 页 | 790.91 KB | 1 年前3
C++20 STL Features: 1 Year of Development on GitHubu=""> constexpr bool cmp_equal(T t, U u) noexcept; templateconstexpr bool cmp_not_equal(T t, U u) noexcept; template ## constexpr Algorithms ## C++20 constexpr Everything • constexpr enables compile-timeconstexpr bool cmp_less(T u=""> constexpr bool cmp_greater(T t, U u) noexcept; template constexpr bool cmp_less_equal(T t, U u) noexcept; template constexpr bool cmp_greater_equal(T class="" t=""> constexpr bool in_range(T t) noexcept; 0 码力 | 45 页 | 702.09 KB | 1 年前3
C++20 STL Features: 1 Year of Development on GitHubu=""> constexpr bool cmp_equal(T t, U u) noexcept; templateconstexpr bool cmp_not_equal(T t, U u) noexcept; template ## constexpr Algorithms ## C++20 constexpr Everything • constexpr enables compile-timeconstexpr bool cmp_less(T u=""> constexpr bool cmp_greater(T t, U u) noexcept; template constexpr bool cmp_less_equal(T t, U u) noexcept; template constexpr bool cmp_greater_equal(T class="" t=""> constexpr bool in_range(T t) noexcept; 0 码力 | 45 页 | 989.72 KB | 1 年前3
Compile-Time Compression and Resource Generation with C++20libraries I created for this code • Discuss some techniques I found building compile-time libraries ## constexpr in Brief • Specifies a variable or function CAN appear in a constant expression • Constant expressions expressions can be evaluated at compile-time • eg: ■ Array size ☐ non-type template parameter ## constexpr Variable • Must be a Literal Type ☐ scalar (int, char, etc) array of literals ■ struct/class/union Implies const constexpr int Base{0b0010'1000}; constexpr std::arrayValues{1, 2, 3}; int main() { // Base += 1; // ERROR return Base + Values[1]; } # constexpr Function0 码力 | 59 页 | 1.86 MB | 1 年前3
共 1000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 100
相关搜索词
Performance EngineeringHardwareMemcpyAlignmentPerformance Testingconstexprstd::pmrCUDA性能优化内存管理缓存友好的设计路径规划机器人计算机缓存结构内存访问模式C++ Scripting BindingsChaiScriptC++嵌入式脚本引擎constexpr friendlyModulesRangesCoroutinesConcurrency Changes编译器优化restrict汇编内联Small String Optimizationtemplatestruct压缩对联结GitHubC++20STLVisual C++ LibrariesC++20 STL FeaturesGitHub DevelopmentrangesvNextlookup tablesconfiguration fusesUSB descriptors













