 Symbolic Calculus for High-Performance Computing: From Scratch Using C++23Substitution Construction Conclusion Typing equations What we would like to type 1 symbol a; 2 symbol w; 3 symbol t; 4 symbol phi; 5 6 formula f = a ∗ sin(w ∗ t + phi ); 7 8 double y = f(a = 5.0, w = 2 from the syntax 1 symbol a; 2 symbol w; 3 symbol t; 4 symbol phi; The idea a, ω, t, ϕ should all have a unique type The problem How to produce a different type everytime a new symbol is created? The as default template parameter 1 template Symbolic Calculus for High-Performance Computing: From Scratch Using C++23Substitution Construction Conclusion Typing equations What we would like to type 1 symbol a; 2 symbol w; 3 symbol t; 4 symbol phi; 5 6 formula f = a ∗ sin(w ∗ t + phi ); 7 8 double y = f(a = 5.0, w = 2 from the syntax 1 symbol a; 2 symbol w; 3 symbol t; 4 symbol phi; The idea a, ω, t, ϕ should all have a unique type The problem How to produce a different type everytime a new symbol is created? The as default template parameter 1 template- 2 struct symbol {}; The result 1 symbol x; 2 symbol y; 3 4 std :: cout << std :: is_same_v - << std :: endl; 0 码力 | 70 页 | 1.80 MB | 6 月前3
 Shared Libraries(DLL), Dynamic Shared Library • Binary: • Executable / Shared Library , Component, Module • Symbol: • Function / Global variable • “Linux”: • Unix-like systems • Mostly MacOS too (1 important distinction DLL Name • ImportLookupTable offset • ImportAddressTable offset • … Import Lookup Table* Imported symbol names/ordinals, for loader usage … … … Import Address Table (IAT) List of import addresses names and symbol names 13lib1, lib2 f1, f2, f3, g1,g2,g3 … code data .dynamic .dynsim … code data .idata lib1: f1, f2, f3 lib2: g1, g2, g3 14Interposition • Overriding a symbol in one binary0 码力 | 69 页 | 1.40 MB | 6 月前3 Shared Libraries(DLL), Dynamic Shared Library • Binary: • Executable / Shared Library , Component, Module • Symbol: • Function / Global variable • “Linux”: • Unix-like systems • Mostly MacOS too (1 important distinction DLL Name • ImportLookupTable offset • ImportAddressTable offset • … Import Lookup Table* Imported symbol names/ordinals, for loader usage … … … Import Address Table (IAT) List of import addresses names and symbol names 13lib1, lib2 f1, f2, f3, g1,g2,g3 … code data .dynamic .dynsim … code data .idata lib1: f1, f2, f3 lib2: g1, g2, g3 14Interposition • Overriding a symbol in one binary0 码力 | 69 页 | 1.40 MB | 6 月前3
 Implementing C++ Modules: Lessons Learned, Lessons AbandonedDaCamara; CppCon 2021 Independently developed libraries Linker happy: each reference to exported symbol ‘f()’, needed by ‘lib_m1()’ and ‘lib_m2()’ traced back its owner in the context of use. Compositional responsibility ▪ Before C++20: – For internal linkage names the process is simple: only search that symbol – The linker must build two sets: ▪ References to external linkage symbols ▪ Definitions of external & DaCamara; CppCon 2021ODR: linker responsibility app3.obj : error LNK2019: unresolved external symbol _WINRT_GetRestrictedErrorInfo@4 referenced in function "public: __thiscall winrt::hresult_error:0 码力 | 53 页 | 1.33 MB | 6 月前3 Implementing C++ Modules: Lessons Learned, Lessons AbandonedDaCamara; CppCon 2021 Independently developed libraries Linker happy: each reference to exported symbol ‘f()’, needed by ‘lib_m1()’ and ‘lib_m2()’ traced back its owner in the context of use. Compositional responsibility ▪ Before C++20: – For internal linkage names the process is simple: only search that symbol – The linker must build two sets: ▪ References to external linkage symbols ▪ Definitions of external & DaCamara; CppCon 2021ODR: linker responsibility app3.obj : error LNK2019: unresolved external symbol _WINRT_GetRestrictedErrorInfo@4 referenced in function "public: __thiscall winrt::hresult_error:0 码力 | 53 页 | 1.33 MB | 6 月前3
 A Physical Units Library for the Next C++dimension of either a base or derived quantity • base_dimension is instantiated with a unique symbol identifier and a base unit • derived_dimension is a list of exponents of either base or other derived dimension of either a base or derived quantity • base_dimension is instantiated with a unique symbol identifier and a base unit • derived_dimension is a list of exponents of either base or other derived dimension of either a base or derived quantity • base_dimension is instantiated with a unique symbol identifier and a base unit • derived_dimension is a list of exponents of either base or other derived0 码力 | 172 页 | 6.17 MB | 6 月前3 A Physical Units Library for the Next C++dimension of either a base or derived quantity • base_dimension is instantiated with a unique symbol identifier and a base unit • derived_dimension is a list of exponents of either base or other derived dimension of either a base or derived quantity • base_dimension is instantiated with a unique symbol identifier and a base unit • derived_dimension is a list of exponents of either base or other derived dimension of either a base or derived quantity • base_dimension is instantiated with a unique symbol identifier and a base unit • derived_dimension is a list of exponents of either base or other derived0 码力 | 172 页 | 6.17 MB | 6 月前3
 Back to Basics: The structure of a ProgramName Mangling • Name mangling refers to the way in which entity names in a TU are transformed into symbol names in object code • C++ deliberately maintains binary compatibility with C • C++ object files Given a C function whose declaration is void fubar(int), • The corresponding symbol name in object code is _fubar • The symbol name will be the same no matter the number of parameters or their types • names • Each overloaded use of a name is mapped into a unique symbol name • Extra information about the entity is encode into its symbol name CppCon 2020 - The Structure of a Program 61 // From GCC0 码力 | 64 页 | 390.34 KB | 6 月前3 Back to Basics: The structure of a ProgramName Mangling • Name mangling refers to the way in which entity names in a TU are transformed into symbol names in object code • C++ deliberately maintains binary compatibility with C • C++ object files Given a C function whose declaration is void fubar(int), • The corresponding symbol name in object code is _fubar • The symbol name will be the same no matter the number of parameters or their types • names • Each overloaded use of a name is mapped into a unique symbol name • Extra information about the entity is encode into its symbol name CppCon 2020 - The Structure of a Program 61 // From GCC0 码力 | 64 页 | 390.34 KB | 6 月前3
 Exceptional C++HANDLE hProcess = ::GetCurrentProcess(); HANDLE hThread = ::GetCurrentThread(); // create a symbol explorer SymbolUtil symMgr; if (!symMgr.Init(hProcess)) return; ...2021 Victor Ciura = sizeof(SYMBOL_INFO); // get symbol name (de-mangled function name) if (DynSymFromAddr(mProcess, aAddress, nullptr, pSymbol)) return pSymbol->Name; else return SW_NO_SYMBOL; } PF_SymFromAddr ::ZeroMemory(&line, sizeof(line)); line.SizeOfStruct = sizeof(line); // get location information for symbol "sourceFile:lineNo" if (::SymGetLineFromAddr(mProcess, aAddress, &displacement, &line)) {0 码力 | 113 页 | 24.39 MB | 6 月前3 Exceptional C++HANDLE hProcess = ::GetCurrentProcess(); HANDLE hThread = ::GetCurrentThread(); // create a symbol explorer SymbolUtil symMgr; if (!symMgr.Init(hProcess)) return; ...2021 Victor Ciura = sizeof(SYMBOL_INFO); // get symbol name (de-mangled function name) if (DynSymFromAddr(mProcess, aAddress, nullptr, pSymbol)) return pSymbol->Name; else return SW_NO_SYMBOL; } PF_SymFromAddr ::ZeroMemory(&line, sizeof(line)); line.SizeOfStruct = sizeof(line); // get location information for symbol "sourceFile:lineNo" if (::SymGetLineFromAddr(mProcess, aAddress, &displacement, &line)) {0 码力 | 113 页 | 24.39 MB | 6 月前3
 Sender Patterns to Wrangle Concurrency in Embedded Devicesblock: for symbol in block: name = symbol.name demangled_name = cxxfilt.demangle(name) if async_debug_re.search(demangled_name): debug_symbols.add((symbol, demangled_name)) demangled_name)) block = block.superblock handled_states = [] for (debug_symbol, demangled_name) in debug_symbols: from .gdb_wedge import get_symbols class DotColorMapper: """ Signals style="invis") return subpretty_name = stdx.prettify_ct_strings(demangled_name) add_symbol(debug_symbol) if start_detached_op_state_re.search(pretty_name) or start_detached_context_re.search(pretty_name):0 码力 | 106 页 | 26.36 MB | 6 月前3 Sender Patterns to Wrangle Concurrency in Embedded Devicesblock: for symbol in block: name = symbol.name demangled_name = cxxfilt.demangle(name) if async_debug_re.search(demangled_name): debug_symbols.add((symbol, demangled_name)) demangled_name)) block = block.superblock handled_states = [] for (debug_symbol, demangled_name) in debug_symbols: from .gdb_wedge import get_symbols class DotColorMapper: """ Signals style="invis") return subpretty_name = stdx.prettify_ct_strings(demangled_name) add_symbol(debug_symbol) if start_detached_op_state_re.search(pretty_name) or start_detached_context_re.search(pretty_name):0 码力 | 106 页 | 26.36 MB | 6 月前3
 Just-In-Time Compilation: The Next Big Thing_Z3dispatchi - Mangled symbol with no templates 6 . 12SAVE LIBRARY/BINARY SAVE LIBRARY/BINARY MAIN.CPP MAIN.CPP #include Just-In-Time Compilation: The Next Big Thing_Z3dispatchi - Mangled symbol with no templates 6 . 12SAVE LIBRARY/BINARY SAVE LIBRARY/BINARY MAIN.CPP MAIN.CPP #include- // std::stoi void dispatch(int); // _Z3dispatchi - Mangled symbol with no templates CPP LLC - LLC - #include - // std::stoi void dispatch(int); // _Z3dispatchi - Mangled symbol with no templates int main(int argc, const char** argv) { dispatch(std::stoi(argv[1])); } $LLC CPP LLC - LLC - #include - // std::stoi void dispatch(int); // _Z3dispatchi - Mangled symbol with no templates int main(int argc, const char** argv) { dispatch(std::stoi(argv[1])); } $LLC 0 码力 | 222 页 | 5.45 MB | 6 月前3
 Dynamically Loaded Libraries Outside the Standardso") – open and get a handle to the library • dlsym(handle, "symbol_name") – get addresses to entities • dlclose(handle) – close symbol table handle – may unload the library; varies across implementations Foreign linkage modules How dynamic is dynamic?33 CppCon 2021 | void *dlsym(void *handle, char const *symbol); Let’s take a closer look at the dynamic loading APIs34 CppCon 2021 | (ddot_t *)::dlsym(lib, %g\n", ddot(3, x, y)); } Foreign linkage (hypothetical)43 CppCon 2021 | • Declaration decides the symbol of the entity • The idea also presents in Plugins in C++ (wg21.link/n2015), 2006 Resolving dynamic0 码力 | 100 页 | 3.98 MB | 6 月前3 Dynamically Loaded Libraries Outside the Standardso") – open and get a handle to the library • dlsym(handle, "symbol_name") – get addresses to entities • dlclose(handle) – close symbol table handle – may unload the library; varies across implementations Foreign linkage modules How dynamic is dynamic?33 CppCon 2021 | void *dlsym(void *handle, char const *symbol); Let’s take a closer look at the dynamic loading APIs34 CppCon 2021 | (ddot_t *)::dlsym(lib, %g\n", ddot(3, x, y)); } Foreign linkage (hypothetical)43 CppCon 2021 | • Declaration decides the symbol of the entity • The idea also presents in Plugins in C++ (wg21.link/n2015), 2006 Resolving dynamic0 码力 | 100 页 | 3.98 MB | 6 月前3
 Back To Basics: Rvalues and Move Semanticsneed a language symbol for each... 19 Back to Basics: RValue and Move Semantics, Amir Kirsh @ CppCon, 2024Lvalue reference std::string str2 = str1; We already have a language symbol for this one: 20 language symbol for this one: & 21 Back to Basics: RValue and Move Semantics, Amir Kirsh @ CppCon, 2024Rvalue reference std::string str2 = str2 + str1; But what about this? Which symbol is “free” Kirsh @ CppCon, 2024Rvalue reference std::string str2 = str2 + str1; But what about this? Which symbol is “free” for use? && 23 Back to Basics: RValue and Move Semantics, Amir Kirsh @ CppCon, 2024OK0 码力 | 80 页 | 740.53 KB | 6 月前3 Back To Basics: Rvalues and Move Semanticsneed a language symbol for each... 19 Back to Basics: RValue and Move Semantics, Amir Kirsh @ CppCon, 2024Lvalue reference std::string str2 = str1; We already have a language symbol for this one: 20 language symbol for this one: & 21 Back to Basics: RValue and Move Semantics, Amir Kirsh @ CppCon, 2024Rvalue reference std::string str2 = str2 + str1; But what about this? Which symbol is “free” Kirsh @ CppCon, 2024Rvalue reference std::string str2 = str2 + str1; But what about this? Which symbol is “free” for use? && 23 Back to Basics: RValue and Move Semantics, Amir Kirsh @ CppCon, 2024OK0 码力 | 80 页 | 740.53 KB | 6 月前3
共 103 条
- 1
- 2
- 3
- 4
- 5
- 6
- 11
相关搜索词
 SymbolicCalculusforHighPerformanceComputingFromScratchUsingC++23SharedLibrariesImplementingModulesLessonsLearnedAbandonedPhysicalUnitsLibrarytheNextBacktoBasicsThestructureofProgramExceptionalSenderPatternsWrangleConcurrencyinEmbeddedDevicesJustInTimeCompilationBigThingDynamicallyLoadedOutsideStandardToRvaluesandMoveSemantics














