Skip to content

[Refact] Rename JitArgument & DslType interfaces, support SimpleNamespace as DslType#478

Merged
coderfeli merged 6 commits intomainfrom
pr/refact-renaming
May 9, 2026
Merged

[Refact] Rename JitArgument & DslType interfaces, support SimpleNamespace as DslType#478
coderfeli merged 6 commits intomainfrom
pr/refact-renaming

Conversation

@sjfeng1999
Copy link
Copy Markdown
Collaborator

…pace as DslType

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 refactors FlyDSL’s Python-side type/argument protocols by renaming the __fly_* dunder methods and the fly_* helper functions, and extends the protocol layer to treat types.SimpleNamespace as a composite DSL value (flattening/reconstruction of IR values/types/pointers).

Changes:

  • Renames DslType/JitArgument protocol methods to __extract_to_ir_values__ / __construct_from_ir_values__ and __get_ir_types__ / __get_c_pointers__, and updates core compiler call sites accordingly.
  • Adds SimpleNamespace support in compiler/protocol.py for flattening (get_ir_types, get_c_pointers, extract_to_ir_values) and reconstruction (construct_from_ir_values).
  • Updates/introduces tests and documentation to reflect the renamed protocol surface and validates SimpleNamespace built inside @flyc.jit.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/unit/test_vector.py Updates protocol roundtrip test to new __extract_to_ir_values__ / __construct_from_ir_values__ names.
tests/unit/test_simple_namespace.py Adds a GPU test validating SimpleNamespace created inside @flyc.jit can be passed to a kernel.
tests/kernels/test_flydsl_shmem.py Updates helper unwrapping to use __extract_to_ir_values__.
python/flydsl/expr/typing.py Renames DslType-related dunder methods on IR wrapper types; removes old construct hook.
python/flydsl/expr/numeric.py Renames protocol methods for Numeric types and updates wrapping/unwrapping helpers; adds log_width.
python/flydsl/expr/meta.py Updates primitive arg unwrapping to the new extraction dunder.
python/flydsl/expr/extern.py Updates FFI argument unwrapping to the new extraction dunder.
python/flydsl/compiler/protocol.py Introduces new helper names and adds SimpleNamespace flatten/rebuild support.
python/flydsl/compiler/kernel_function.py Switches kernel emission/launch plumbing to the renamed protocol helpers.
python/flydsl/compiler/jit_function.py Switches JIT argument typing/caching and DSL arg reconstruction to renamed protocol helpers.
python/flydsl/compiler/jit_executor.py Switches runtime pointer extraction helper; minor error message formatting cleanup.
python/flydsl/compiler/jit_argument.py Updates protocol detection to new dunder names; minor formatting/quoting tweaks.
docs/layout_system_guide.md Updates documentation references to the renamed extraction dunder.
docs/kernel_authoring_guide.md Updates custom adaptor documentation to the renamed JitArgument dunders.
docs/architecture_guide.md Updates protocol/API references and file map entry to the new names.

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

Comment thread python/flydsl/compiler/protocol.py
Comment thread python/flydsl/compiler/protocol.py
coderfeli
coderfeli previously approved these changes May 8, 2026
@sjfeng1999 sjfeng1999 force-pushed the pr/refact-renaming branch from 9a696e8 to 078ff3a Compare May 8, 2026 17:05
@coderfeli coderfeli merged commit d030d65 into main May 9, 2026
11 checks passed
@coderfeli coderfeli deleted the pr/refact-renaming branch May 9, 2026 06:12
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.

3 participants