Skip to content

[Type] Can rename py dataclass structs when calling sub functions - #333

Closed
hughperkins wants to merge 90 commits into
mainfrom
hp/renaming-dataclass-args-v2
Closed

hughperkins wants to merge 90 commits into
mainfrom
hp/renaming-dataclass-args-v2

Conversation

@hughperkins

@hughperkins hughperkins commented Dec 23, 2025

Copy link
Copy Markdown
Collaborator

Issue: #

Brief Summary

Key concept is that we need to store, during compilation:

  • the used parameters per func, not just globally
  • the relationship between parameters in one func, and in each func that it is calling

We do this in the new pruning.py file, with each dict indexed first by func_id, which is unique per function.

We assume that the parameters used for a func are consistent across all calls to that func within the same compiled kernel. However, different calls to the same kernel can have different used parameters for each func in that kernel call, compared to other calls into the same kernel.

We only need to store the used parameters during the compilation of the kernel. Once the kernel is compiled, we throw away the function-specific lists of parameters - by discarding the ASTTransformer*Context objects - and store only the parametesr needed on entry to the top level kernel. We store these parameters in the Kernel object, indexed by calling key.

Old arch:

Screenshot 2025-12-23 at 13 53 35

New arch:

Screenshot 2025-12-23 at 13 53 40

copilot:summary

Walkthrough

copilot:walkthrough

Comment thread python/gstaichi/lang/_func_base.py Outdated
Comment thread python/gstaichi/lang/_pruning.py Outdated
@duburcqa

duburcqa commented Jan 2, 2026

Copy link
Copy Markdown
Contributor
  • Make sure we do not call the same func with different template parameters in the same high-level taichi kernel, because this is not supported
  • Add proper exception with clean guideline instead of assert for *arg being required to be the last input argument

@hughperkins

Copy link
Copy Markdown
Collaborator Author
  • Make sure we do not call the same func with different template parameters in the same high-level taichi kernel, because this is not supported
  • Add proper exception with clean guideline instead of assert for *arg being required to be the last input argument

Addressed both these points.

@hughperkins
hughperkins enabled auto-merge (squash) January 5, 2026 13:46
@hughperkins
hughperkins disabled auto-merge January 5, 2026 13:46
@hughperkins
hughperkins deleted the hp/renaming-dataclass-args-v2 branch February 21, 2026 12:14
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