 MACRO-FREE TESTING WITH C++20CPPCON 2020 / CPPCON 2020 / MACRO-FREE TESTING MACRO-FREE TESTING WITH C++20 WITH C++20 | | | | HTTPS://BOOST-EXT.GITHUB.IO/UT/CPPCON-2020 HTTPS://BOOST-EXT.GITHUB.IO/UT/CPPCON-2020 KRIS@JUSIAK SINGLE (2K LOC) WITH NO EXTERNAL DEPENDENCIES (2K LOC) WITH NO EXTERNAL DEPENDENCIES MACRO-FREE (✔ ) MACRO-FREE (✔ ) (*) LIMITATIONS MAY APPLY (*) LIMITATIONS MAY APPLY HTTPS://GITHUB.COM/BOOST-EXT/UT SINGLE (2K LOC) WITH NO EXTERNAL DEPENDENCIES (2K LOC) WITH NO EXTERNAL DEPENDENCIES MACRO-FREE (✔ ) MACRO-FREE (✔ ) FEATURES ( FEATURES ( , , , , , , , , , , , , , , ) (*) LIMITATIONS MAY0 码力 | 53 页 | 1.98 MB | 6 月前3 MACRO-FREE TESTING WITH C++20CPPCON 2020 / CPPCON 2020 / MACRO-FREE TESTING MACRO-FREE TESTING WITH C++20 WITH C++20 | | | | HTTPS://BOOST-EXT.GITHUB.IO/UT/CPPCON-2020 HTTPS://BOOST-EXT.GITHUB.IO/UT/CPPCON-2020 KRIS@JUSIAK SINGLE (2K LOC) WITH NO EXTERNAL DEPENDENCIES (2K LOC) WITH NO EXTERNAL DEPENDENCIES MACRO-FREE (✔ ) MACRO-FREE (✔ ) (*) LIMITATIONS MAY APPLY (*) LIMITATIONS MAY APPLY HTTPS://GITHUB.COM/BOOST-EXT/UT SINGLE (2K LOC) WITH NO EXTERNAL DEPENDENCIES (2K LOC) WITH NO EXTERNAL DEPENDENCIES MACRO-FREE (✔ ) MACRO-FREE (✔ ) FEATURES ( FEATURES ( , , , , , , , , , , , , , , ) (*) LIMITATIONS MAY0 码力 | 53 页 | 1.98 MB | 6 月前3
 Data Is All You Need for Fusioncblas_sgemm(....); return 0; } High Performance code is about Hardware Matrix Multiply #define macro_n4 {\ b_pref = b_ptr + 4 * K;\ __asm__ __volatile__(\ "movq %7,%%r15; movq %1,%%r14; movq %6,%%r11; "zmm29","zmm30","zmm31");\ ,! a_ptr -= M * K; b_ptr += 4 * K; c_ptr += 4 * ldc - M;\ } #define macro_n2 {\ b_pref = b_ptr + 2 * K;\ __asm__ __volatile__(\ "movq %7,%%r15; movq %1,%%r14; movq %6,%%r11; packing_b_k18(B+k_count+second_n_count*LDB,b_buffer+(second_n_count-n_count)*k_inc,LDB,k_inc,second_n_inc); macro_kernel_k18(a_buffer,b_buffer+(second_n_count-n_count)*k_inc,m_inc,second_n_inc,k_inc,&C(0,second_n_count)0 码力 | 151 页 | 9.90 MB | 6 月前3 Data Is All You Need for Fusioncblas_sgemm(....); return 0; } High Performance code is about Hardware Matrix Multiply #define macro_n4 {\ b_pref = b_ptr + 4 * K;\ __asm__ __volatile__(\ "movq %7,%%r15; movq %1,%%r14; movq %6,%%r11; "zmm29","zmm30","zmm31");\ ,! a_ptr -= M * K; b_ptr += 4 * K; c_ptr += 4 * ldc - M;\ } #define macro_n2 {\ b_pref = b_ptr + 2 * K;\ __asm__ __volatile__(\ "movq %7,%%r15; movq %1,%%r14; movq %6,%%r11; packing_b_k18(B+k_count+second_n_count*LDB,b_buffer+(second_n_count-n_count)*k_inc,LDB,k_inc,second_n_inc); macro_kernel_k18(a_buffer,b_buffer+(second_n_count-n_count)*k_inc,m_inc,second_n_inc,k_inc,&C(0,second_n_count)0 码力 | 151 页 | 9.90 MB | 6 月前3
 Bridging the Gap: Writing Portable Programs for CPU and GPUyou host device template - Solution � � 1 enum class HDC { Hst , Dev , HstDev }; 2 3 #define MACRO( targ_ , hdc_ , func_ ) \ 4 template < targ_ , HDC x = hdc_ > requires( x == HDC::Hst ) \ 5 __host__ template < targ_ , HDC x = hdc_ > requires( x == HDC:: HstDev ) \ 9 __host__ __device__ func_ 10 11 MACRO( typename Container , hdc < Container >, 12 void fill_ones( Container & ct ) { for( auto & e : ct ); 17 } � �49/66 Motivation Patterns The dark path Cuda proposal Thank you host device template macro - Extra points � � 1 __global__ void kernel () { 2 // fill_ones( H{} ); // compilation error 30 码力 | 124 页 | 4.10 MB | 6 月前3 Bridging the Gap: Writing Portable Programs for CPU and GPUyou host device template - Solution � � 1 enum class HDC { Hst , Dev , HstDev }; 2 3 #define MACRO( targ_ , hdc_ , func_ ) \ 4 template < targ_ , HDC x = hdc_ > requires( x == HDC::Hst ) \ 5 __host__ template < targ_ , HDC x = hdc_ > requires( x == HDC:: HstDev ) \ 9 __host__ __device__ func_ 10 11 MACRO( typename Container , hdc < Container >, 12 void fill_ones( Container & ct ) { for( auto & e : ct ); 17 } � �49/66 Motivation Patterns The dark path Cuda proposal Thank you host device template macro - Extra points � � 1 __global__ void kernel () { 2 // fill_ones( H{} ); // compilation error 30 码力 | 124 页 | 4.10 MB | 6 月前3
 Expressive Compile-time Parsersitem{ rule, position, term }; }Compile Time Parsing in C++23Macro Rules • Created by Maksym Pasichnyk • Uses C++23 • Create DSL with Rust’s macro rules syntax • More of an experimental proof of concept – Overview Procedural macro is a compile-time function that modifies the token stream #[proc_macro] pub fn my_macro(input: TokenStream) -> TokenStream { /*...*/ } my_macro!(tokens); #[derive(Clone #[derive(Clone, Debug, my_macro)] struct MyStruct;Rust Macros – Overview Macro rules matches a syntax pattern and produces an AST macro_rules! vec { ( $( $x:expr ),* ) => { { let mut temp_vec = Vec::new();0 码力 | 134 页 | 1.73 MB | 6 月前3 Expressive Compile-time Parsersitem{ rule, position, term }; }Compile Time Parsing in C++23Macro Rules • Created by Maksym Pasichnyk • Uses C++23 • Create DSL with Rust’s macro rules syntax • More of an experimental proof of concept – Overview Procedural macro is a compile-time function that modifies the token stream #[proc_macro] pub fn my_macro(input: TokenStream) -> TokenStream { /*...*/ } my_macro!(tokens); #[derive(Clone #[derive(Clone, Debug, my_macro)] struct MyStruct;Rust Macros – Overview Macro rules matches a syntax pattern and produces an AST macro_rules! vec { ( $( $x:expr ),* ) => { { let mut temp_vec = Vec::new();0 码力 | 134 页 | 1.73 MB | 6 月前3
 Vectorizing a CFD Code With std::simd Supplemented by Transparent Loading and Storingoverloadable ▪ Currently no general solution, since index is the second argument ▪ Possible workaround: macro ▪ Rewrite (but no rearrangement) necessary ▪ Same code for scalar and vector versions SIMD_ACCESS(z simd_size> simd_access::index_array Vectorizing a CFD Code With std::simd Supplemented by Transparent Loading and Storingoverloadable ▪ Currently no general solution, since index is the second argument ▪ Possible workaround: macro ▪ Rewrite (but no rearrangement) necessary ▪ Same code for scalar and vector versions SIMD_ACCESS(z simd_size> simd_access::index_array- SIMD_ACCESS Basic Features: The SIMD_ACCESS Macro Using index types Replacement for the expression array[index] ▪ index: simd or scalar version possible SIMD_ACCESS(array, index) SIMD_ACCESS(data, i) = some_value;SIMD_ACCESS Basic Features: The SIMD_ACCESS Macro Using index types Replacement for the expression array[index] ▪ index: simd or scalar version possible 0 码力 | 58 页 | 2.68 MB | 6 月前3
 C++ Modules: Getting Started Todaymacros — File: libm.cpp export module lib; #define AWESOME_MACRO 42 — File: main.cpp import lib; int main () { return AWESOME_MACRO ; // error! macros // cannot be exported }45/50 Modularizing module lib; // ... — File: libm.hpp #define AWESOME_MACRO 42 — File: main.cpp #include C++ Modules: Getting Started Todaymacros — File: libm.cpp export module lib; #define AWESOME_MACRO 42 — File: main.cpp import lib; int main () { return AWESOME_MACRO ; // error! macros // cannot be exported }45/50 Modularizing module lib; // ... — File: libm.hpp #define AWESOME_MACRO 42 — File: main.cpp #include- import lib; int main () { return AWESOME_MACRO ; }46/50 Modularizing legacy libraries - Preprocessor Preprocessor macros — File: libm.cpp export module lib; #define AWESOME_MACRO 42 export constexpr int AwesomeConstant = AWESOME_MACRO ; — File: main.cpp import lib; int main () { return AwesomeConstant 0 码力 | 65 页 | 1.97 MB | 6 月前3
 Plug-in Based Software Architecture for Roboticsnner) ● Add macro at the end of the implementation class ● The macro takes base and derived class types as arguments ● Macro to create the factory method 41What does the macro call #define Creates a static object of type ProxyExecUniqueID ## is a concatenation operator 42What does the macro call #define CLASS_LOADER_REGISTER_CLASS_INTERNAL_WITH_MESSAGE(Derived, Base, UniqueID, Message) first started And it can be modified during runtime Can change out plugins 54• Add EXPORT macro in implementation file • Add an XML file which contains library name, plugin name, base class type0 码力 | 75 页 | 2.40 MB | 6 月前3 Plug-in Based Software Architecture for Roboticsnner) ● Add macro at the end of the implementation class ● The macro takes base and derived class types as arguments ● Macro to create the factory method 41What does the macro call #define Creates a static object of type ProxyExecUniqueID ## is a concatenation operator 42What does the macro call #define CLASS_LOADER_REGISTER_CLASS_INTERNAL_WITH_MESSAGE(Derived, Base, UniqueID, Message) first started And it can be modified during runtime Can change out plugins 54• Add EXPORT macro in implementation file • Add an XML file which contains library name, plugin name, base class type0 码力 | 75 页 | 2.40 MB | 6 月前3
 Make Successor Build Systems: World Tour of Build Systemsadd_definitions(-D__DATE__="May 14 2021") add_definitions(-D__TIME__="17:11:43") add_compile_options(-Wno-builtin-macro-redefined)Will it CMake? Problem 3: Randomness when using `-flto` with GCC LTO on GCC will produce endforeach()Will it CMake? Problem 4: __FILE__ macro The __FILE__ macro is very likely to change between different workstations and thus produce different results__FILE__ macro and path prefix Just build in the problem : we can optimize it Let's use CMake SET_DEPENDENCY_PROVIDERIntercept FetchContent calls macro(tipi_provide_dependency method package_name) set(oneValueArgs GIT_REPOSITORY GIT_TAG ) cmake_parse_arguments(0 码力 | 115 页 | 7.02 MB | 6 月前3 Make Successor Build Systems: World Tour of Build Systemsadd_definitions(-D__DATE__="May 14 2021") add_definitions(-D__TIME__="17:11:43") add_compile_options(-Wno-builtin-macro-redefined)Will it CMake? Problem 3: Randomness when using `-flto` with GCC LTO on GCC will produce endforeach()Will it CMake? Problem 4: __FILE__ macro The __FILE__ macro is very likely to change between different workstations and thus produce different results__FILE__ macro and path prefix Just build in the problem : we can optimize it Let's use CMake SET_DEPENDENCY_PROVIDERIntercept FetchContent calls macro(tipi_provide_dependency method package_name) set(oneValueArgs GIT_REPOSITORY GIT_TAG ) cmake_parse_arguments(0 码力 | 115 页 | 7.02 MB | 6 月前3
 Contracts for C++audio // vector.h T& operator[] (size_t i); // can't put assert macro here :( void resize(size_t n); // can't put assert macro here :( P2900 pre / post can go on declarations79 Copyright (c) Timur audio // vector.h T& operator[] (size_t i); // can't put assert macro here :( void resize(size_t n); // can't put assert macro here :( // vector.h T& operator[] (size_t i) pre (i < size()); audio // vector.h T& operator[] (size_t i); // can't put assert macro here :( void resize(size_t n); // can't put assert macro here :( // vector.h T& operator[] (size_t i) pre (i < size());0 码力 | 181 页 | 4.44 MB | 6 月前3 Contracts for C++audio // vector.h T& operator[] (size_t i); // can't put assert macro here :( void resize(size_t n); // can't put assert macro here :( P2900 pre / post can go on declarations79 Copyright (c) Timur audio // vector.h T& operator[] (size_t i); // can't put assert macro here :( void resize(size_t n); // can't put assert macro here :( // vector.h T& operator[] (size_t i) pre (i < size()); audio // vector.h T& operator[] (size_t i); // can't put assert macro here :( void resize(size_t n); // can't put assert macro here :( // vector.h T& operator[] (size_t i) pre (i < size());0 码力 | 181 页 | 4.44 MB | 6 月前3
 Conan 1.16 Documentation.. set(CONAN_LIBS mylib ${CONAN_LIBS}) Those variables, will be used in the conan_basic_setup() macro to actually set the relevant cmake variables. If the developer wants to switch configuration of the ace/cmake/chat/src") set(PACKAGE_chat_BUILD " Conan 1.16 Documentation.. set(CONAN_LIBS mylib ${CONAN_LIBS}) Those variables, will be used in the conan_basic_setup() macro to actually set the relevant cmake variables. If the developer wants to switch configuration of the ace/cmake/chat/src") set(PACKAGE_chat_BUILD "- /examples/workspace/cmake/chat/build/Debug") macro(conan_workspace_subdirectories) add_subdirectory(${PACKAGE_say_SRC} ${PACKAGE_say_BUILD}) add_su Global variables approach The simplest way to consume it would be to invoke the conan_basic_setup() macro, which will basically set global include directories, libraries directories, definitions, etc. so 0 码力 | 545 页 | 4.34 MB | 1 年前3
共 121 条
- 1
- 2
- 3
- 4
- 5
- 6
- 13
相关搜索词
 MACROFREETESTINGWITHC++20DataIsAllYouNeedforFusionBridgingtheGapWritingPortableProgramsCPUandGPUExpressiveCompiletimeParsersVectorizingCFDCodeWithstdsimdSupplementedbyTransparentLoadingStoringModulesGettingStartedTodayPluginBasedSoftwareArchitectureRoboticsMakeSuccessorBuildSystemsWorldTourofContractsConan1.16Documentation














