[Feat] support composite type based on DslType#504
Open
sjfeng1999 wants to merge 4 commits intomainfrom
Open
Conversation
Contributor
There was a problem hiding this comment.
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), plusAlign[...]andStorage[...]for layout-aware memory views. - Reworks
Constexprfrom a typing-only generic into a runtime-specializable type, and updates JIT/kernel pipelines to detect constexpr annotations viaConstexpr.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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Technical Details
Test Plan
Test Result
Submission Checklist