
Co-dfns: Roadmap and Updates 2024
Explore the Co-dfns roadmap and updates for 2024, including insights on what Co-dfns is, target use cases, and tools for scaling APL domains. Dive into topics like GPUs, scalar hot spots, and static analysis, unveiling the potential of Co-dfns in APL programming.
Download Presentation

Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.
E N D
Presentation Transcript
Glasgow 2024 Co-dfns: Roadmap and Update Aaron W. Hsu aaron@dyalog.com
Who am I? Co-dfns: Roadmap and Update 2024 1
Who are any of us? For now we see but dimly, as in a mirror . Co-dfns: Roadmap and Update 2024 2
Introduction to Co-dfns Co-dfns: Roadmap and Update 2024 3
What is Co-dfns? A compiled implementation of APL Multiple hardware platforms Static analysis of APL Multiple workloads Flexible backend design Low overhead, high productivity APL Flexible integration Co-dfns: Roadmap and Update 2024 4
What is Co-dfns? A guide to APL programming techniques Tree wrangling and manipulation Architecture design APL optimization techniques Parallel techniques Coding style Low abstraction coding techniques Co-dfns: Roadmap and Update 2024 5
What is Co-dfns? A tool for scaling APL Domains Performance Platforms Integrations Experiments/design Co-dfns: Roadmap and Update 2024 6
Target Use Cases Co-dfns: Roadmap and Update 2024 7
Use Case #1: GPUs Leverage the GPU for APL computation Best with primitives over large arrays Heavy data-crunching Computationally expensive algorithms Hot spots and Kernels Simulation, LLMs, Time Series, Graphs, Co-dfns: Roadmap and Update 2024 8
Use Case #2: Scalar Hot Spots Inherently scalar code Small utility functions Called extremely often Incur excessive interpreter overhead Memory churn Execution churn Jay Foad s Compiler Co-dfns: Roadmap and Update 2024 9
Use Case #3: Static Analysis Co-dfns has a static, offline parser Linting Traditional static analysis Migrations Older versions Different vendors Refactoring Co-dfns: Roadmap and Update 2024 10
Use Case #4: Integration Low overhead packaging/deployment Environments lacking interpreter support Embedded environments Hostile deployment environments Different language platforms JavaScript/WASM, Rust, Java, C#, etc. Co-dfns: Roadmap and Update 2024 11
Traditional APL Co-dfns: Roadmap and Update 2024 12
Traditional APL Features Improve integration with existing code Support wider range of domains Leverage some dynamic features Static analysis/migration Parser support vs. Executable support Co-dfns: Roadmap and Update 2024 13
Traditional APL: Parse vs. Exec Parser-only support: :Class, OOP .NET, Win32 HTMLRenderer Interpreter Quad functions Non-Dyalog dialects Executable support: Trad-fns Structured statements Nested Namespaces Execute Generic Quad functions Co-dfns: Roadmap and Update 2024 14
Parser-only Supported Features Produce a viable static AST Aware of the semantics of these features Type inference Name resolution Control flow No executability Co-dfns: Roadmap and Update 2024 15
Trad-fns Co-dfns: Roadmap and Update 2024 16
Trad-fns: Scoping concerns Dynamic scoping Can be inherently broken Dynamic nameclasses for variables Functions that are name builders Functions called only internally (shadowed) Functions called at the root-level Co-dfns: Roadmap and Update 2024 17
Trad-fns: Scoping Approach Lexically compatible Don t shadow nameclasses of free variables Don t change effective nameclass Statically computable call graph Lexical/global scope Shadowed variables can close free vars Co-dfns: Roadmap and Update 2024 18
Lending a helping hand Parser can be parameterized with additional nameclass information Resolves ambiguous situations Allows for trust me behaviors Supports a wider range of otherwise unparseable programs Co-dfns: Roadmap and Update 2024 19
Current Progress Co-dfns: Roadmap and Update 2024 20
Current Efforts Static Parser Runtime memory overheads GPU parallel algorithms Code generation Compiler optimizations Benchmarking Co-dfns: Roadmap and Update 2024 21
Progress: Parser Partial trad-fns support Tokenization: Structured statements OOP Non-dyalog quad funcs (parameterization) Dyalog Quad functions Co-dfns: Roadmap and Update 2024 22
Progress: Memory Overheads A major limitation on performance Hurts scalar APL and utility functions Creates excessive constant overheads Goal: Reduce or eliminate Co-dfns: Roadmap and Update 2024 23
Benchmarking Co-dfns: Roadmap and Update 2024 24
Benchmarking Black Scholes Mystika (Crypto, Bignum) N-body LLM Transformers MultiGrid (NAS Parallel) U-net Volatility / Time series Graphs / Tree (Compiler) QuickHull Small funct. Sampler FlashAttention QuAPL Co-dfns: Roadmap and Update 2024 25
Benchmarking Typical: 10 Low end: 2 4 High end: 40 100 Co-dfns: Roadmap and Update 2024 26
Recommendations Co-dfns: Roadmap and Update 2024 27
Recommendations/Limits Current versions have issues on Mac V4 is still the best to use for GPU: Flat arrays Primitives applied to large arrays Co-dfns: Roadmap and Update 2024 28
Recommendations/Limits V5+: Most language features for dfns No error guards No selective assignment CPU + GPU Extra features and APIs Co-dfns: Roadmap and Update 2024 29
Some Unique Features Co-dfns: Roadmap and Update 2024 30
Unique Features Self-contained EXEs for all platforms High degree of integration with backends Platform agnostic Foreign Functions Extensible runtime for operators/funcs. Dual-licensed (Dyalog + AGPL) Co-dfns: Roadmap and Update 2024 31
Thank you. Co-dfns: Roadmap and Update 2024 32