~/talk

Developing the Wolfram Language Compiler

links:none on file
slides:none on file

A compiler converts Wolfram Language ASTs to an SSA IR, runs a constraint-based type inference with parametric types and type classes, then emits native code via LLVM JIT; compiled functions unbox/box between interpreter expressions and typed arguments and can be emitted as dynamic libraries. It enforces semantics (overflow checks, abort handling) but allows unchecked blocks for C-like speed, provides packed arrays and array-backed tensors, and already supports automatic differentiation plus targets like WebAssembly and CUDA; compilation is slow but generated code rivals hand-tuned C.

AI-written summary · about

  1. 0:00Intro
  2. 0:28Developing The Wolfram Compiler This talk will cover The Wolfram Language The Wolfram Compiler Embedding in an existing language Compiler Type System Compiler trade-offs and their resolution Interesting and notable features Program transformation, Automatic Differentiation
  3. 1:37The Wolfram Language: Programming Functional programming style Execution via AST rewriting Pattem matching on AST Function definition using patterns Various specialized optimizations
  4. 3:33Expression Structure: Code Code is really the same as Data
  5. 7:50Compilation Challenges Infinite evaluation Immutability semantics Holding / Quoting Adhere to semantics (e.g. arithmetic) Cross platform compatibility performance & functionality Variadic functions and overloading Sequences
  6. 8:25Version 1 Compiler (1990) Supports a language subsct Fixed to numerical types and operations Translates operations to Wolfram bytecode Bytecode can be either interpreted or exported to C Very popular with users to achieve performance Quite successful in its time
  7. 9:07The Wolfram Compiler A compiler for the Wolfram Language Long term project from 2015 Built in the Wolfram language Leverage Latest Compiler knowledge and technology Initial Mathematica release
  8. 9:58Compiler Operations Convert Wolfram Language into native machine code uses LLVM as backend in-memory JIT compilation dynamic library generation static type annotations with inferencing alternative execution model for Wolfram Language integrates with Wolfram Language interpreter easy linkage to dynamic libraries can run standalone
  9. 10:43Compiling an existing language sets expectations constrains semantics constrains syntax
  10. 16:48Type System Borrows from Haskell and Scala's type system Ad-hoc and parametric polymorphism Type classes Qualified types Type defaults Overloading with ambiguity resolution Dependent types and type evaluation no sub-typing Independent of the compiler Work with other groups at Wolfram for theorem proving
  11. 18:35Type Inferencing Constraints
  12. 20:42Library of Functions and Types Wolfram Language support needs function implementations types that support Wolfram Language Polymorphic type system is a great assistance much less code to write Built-in: Types Functions
  13. 26:20Functions Provided Need to support functions from interpreted code Compiled code has many more types interpreter has expression compiled code has Integer, UnsignedInteger etc... Need to be fast but need to maintain semantics
  14. 27:54Validation is a runtime error, uses exception mechanism With compiler intrinsics is quite fast, but branch loop optimization problems
  15. 32:12Disambiguation Based on a subsumption mechanism Given a choice pick the one that the others can be instantiated into
  16. 35:14Scripting Function Generation Use Wolfram Language for function preparation
  17. 36:09Create Data Tables Use Wolfram Language to prepare data at compilation time
  18. 37:43Development Workflow Create interpreted code Then compile
  19. 37:54Good example of program transformation Important for HPC, Machine Learning Suitable for multivariate problems generates a projection of the Jacobian
  20. 39:38GPU Integration Work with CUDA Generate PTX code, LLVM does this Integrate with CUDA Toolkit Generate host code for memory setup, launching, etc.
  21. 40:25Current Directions Compilation speed
  22. 40:55Summary Covered the following The Wolfram Language The Wolfram Compiler Embedding in an existing language The Type System Trade-offs and their resolution Interesting and notable features Program transformation, Automatic Differentiation Initial GPU integration also
  23. 41:10Embedding in an existing language The Type System Trade-offs and their resolution Interesting and notable features Program transformation, Automatic Differentiation Initial GPU integration also Many opportunities for developers/interns new technologies building out current features developing new compiler techniques
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.