Skip to content

Refactor Field Modelling

Frederik Hennig requested to merge fhennig/field-buffers into v2.0-dev

This MR introduces a significant refactoring of the backend handling of fields. This comprises several parts:

Symbol Properties

  • Introduce a system of symbol properties used to add arbitrary information to symbols
  • Remove subclasses for field-associated symbols
  • Introduce properties for marking field shape, stride, and pointer symbols
  • Refactor kernel parameters to hold symbol properties; remove field-specific KernelParameter subclasses

Field Buffers

  • Rename PsLinearizedArray to PsBuffer
  • move PsBuffer and PsSymbol to module backend.memory
  • Adapt PsBuffer constructor to take all its pointer, shape and stride as PsSymbol or PsConstant

Buffers in the AST

  • Replace PsArrayAccess by PsBufferAcc; PsBufferAcc takes an nd index tuple instead of a linearized index
  • Adapt freeze and typification to the above
  • Introduce LowerToC transformation pass which lowers buffer accesses to raw memory accesses
  • Subsume EraseAnonymousStructs into LowerToC

Kernel Translation

  • Add LowerToC pass and late canonicalization and constant folding passes to the create_kernel pipeline

Bugfixes

A number of bugs revealed during development are being fixed:

  • clone() on expression nodes used to forget the nodes' data type; now keeps it
  • RHS expression in array declarations was not assigned a data type if the type was dictated by the LHS

Closes #101

Continues work from !408 (merged)

Merge request reports