2024 10 09 - wgsl-tooling-wg/wesl-spec GitHub Wiki

MEETING AGENDA

Intros - 5 min

Walkthroughs (10 min each)

Mathis:

  • Compiler:
    • imports, the version currently in the spec
    • conditional compilation,
    • eval() (unfinished),
    • exec() (unfinished),
    • some lowering (because naga doesn't support all wgsl, for example alias T = u32; vec<T> is not supported).

Natalie Cuthbert:

  • Compiler
    • Usages
      • Inline usages
      • Use Statement
      • How usages work in the compiler
    • Generalised Aliasing
    • Extends
    • Untyped Templates
      • With

Mighdoll - WGSL World Tour:

Mighdoll & Mathis - Unconed: Discussions

Compiler that ships features not in specification? (5-10 min) - TO BE DISCUSSED LATER

Currently both Mathis and Natalie Cuthbert’s experimental compilers include features that are not adopted or finalised in the WESL spec. What to do when you're beyond the specification and would like to ship these features?

Context: Natalie Cuthbert wants to ship a particle simulation framework that leverages her compiler.

MVP (10-15 min) - TO BE DISCUSSED LATER

What do we ship to production first?

WebGPU committee deliverables (10 min) - TO BE DISCUSSED LATER

MEETING NOTES

WGPU meet

  • Exposing TranslationUnit in Naga
  • Investigate “@link” attribute as an alternative to source maps

Natalie Presentation

  • Bundling step aka “Get all the code”
    • Starts with wesl.toml and imports
    • All code goes into the same translation unit (parsed syntax trees)
    • Produces a tree of parsed modules
  • Resolution step
    • Fully resolve each relative path to its fully qualified name
    • Imports are now done
  • Multiple steps happen after this to get from WESL to WGSL
    • A single tree that gets repeatedly modified. At the end, it can safely be printed to WGSL.
  • extend foo means for(item in foo) alias item = foo.item;
  • GenericModule with { ... } is a shorter and cleaner syntax for GenericModule<param = ..., param = ..., param = ...>

Syntax highlighting

  • We should get that to work pretty soon

Mathis Presentation

  • WESL Playground
  • MVP could get away with imports and conditional compilation
  • Constants in one file, at runtime it generates a new version of the file and recompiles it
    • Pipeline-overridable constants were limited for arrays. Seems to no longer be an issue.
  • Conditional compilation
    • Host provides boolean values. Extremely basic expression evaluation (&& || !)
  • Imports
    • Works with virtual filesystems
    • Can be combined with conditional compilation
  • Eval feature
    • Run WGSL code on the CPU
    • Future: Shader debugger running on the CPU
    • const_assert can be executed in the IDE, check as soon as possible
  • ChatGPT test generation
    • Generates JSON file of tests
    • Parsing tests
    • Eval tests
  • gpuweb has an extensive test suite
    • We should look into using it
  • Name mangling: We should reconsider the strategies of
    • Linker says “don’t mangle these items”
    • Linker says “give me the mangled names for these items”

WGSL world tour

  • (Almost) no need for “inserting code”
  • Lots of WGSL code out there!
  • Current projects are not big
  • 3 things that people do a lot
    • Modules system (imports please)
    • Preprocessor (~conditional compilation)
    • Same code keeps getting implemented (random, color space conversions, prefix sum, ...)
  • Fancy stuff that people keep looking for
    • Debugging
    • Performance
    • Integrate with the host language
      • How can we make this easier?
    • Testing shaders
      • e.g. How does one do a “print()” in a shader?