Skip to content

[Feat] support composite type based on DslType#504

Open
sjfeng1999 wants to merge 4 commits intomainfrom
pr/feat-dsl-composite
Open

[Feat] support composite type based on DslType#504
sjfeng1999 wants to merge 4 commits intomainfrom
pr/feat-dsl-composite

Conversation

@sjfeng1999
Copy link
Copy Markdown
Collaborator

Motivation

Technical Details

Test Plan

Test Result

Submission Checklist

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a unified “composite type” layer for FlyDSL (struct/union/align/array/storage) built on top of existing DSL type protocols, and updates the compiler’s constexpr handling to work with the new Constexpr type model.

Changes:

  • Adds a new composite schema system (@struct, @union, inline schema syntax), plus Align[...] and Storage[...] for layout-aware memory views.
  • Reworks Constexpr from a typing-only generic into a runtime-specializable type, and updates JIT/kernel pipelines to detect constexpr annotations via Constexpr.is_constexpr_annotation.
  • Introduces an Array[dtype, size, (align)] composite/storable type and expands numeric types to implement the Storable protocol where applicable.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/unit/test_struct.py New unit coverage for struct/union/constexpr/layout/align/storage and Array behavior.
python/flydsl/expr/typing.py Implements runtime Constexpr, adds Array, and adds Pointer.view(...).
python/flydsl/expr/struct.py New composite schema implementation, layout computation, Align, and Storage.
python/flydsl/expr/numeric.py Adds Storable protocol support (size/align/peek/poke) for storable numerics and adds Numeric.__coerce__.
python/flydsl/expr/init.py Re-exports the new struct module symbols.
python/flydsl/compiler/protocol.py Adds Storable protocol + dsl_size_of/dsl_align_of/peek_from_ptr/poke_into_ptr helpers.
python/flydsl/compiler/kernel_function.py Switches constexpr detection to Constexpr.is_constexpr_annotation.
python/flydsl/compiler/jit_function.py Switches constexpr detection to Constexpr.is_constexpr_annotation and imports is_type_param_annotation.
python/flydsl/compiler/jit_argument.py Removes old constexpr helper and renames _is_type_param_annotation to is_type_param_annotation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread python/flydsl/expr/typing.py
Comment thread python/flydsl/expr/typing.py
Comment thread tests/unit/test_struct.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants