Skip to content

refactor(parser): migrate to unified function API - #111

Merged
zhen8838 merged 14 commits into
tile-ai:mainfrom
zhen8838:refactor/parser-migration
Aug 24, 2026
Merged

refactor(parser): migrate to unified function API#111
zhen8838 merged 14 commits into
tile-ai:mainfrom
zhen8838:refactor/parser-migration

Conversation

@zhen8838

@zhen8838 zhen8838 commented Aug 23, 2026

Copy link
Copy Markdown
Collaborator

Why

  • Replace the legacy parser with the unified Pattern/Rule parser without compatibility readers, retarget metadata, or hidden dtype promotion.

What

  • Defer in-module function parsing until child Modules are available, then resolve declarations in source order.
  • Keep explicit scalar casts on the ordinary CallPattern -> ConstantPattern -> Cast Call path.
  • Treat UMAT-only Call results as scalar expressions rather than GMEM placement values.
  • Move retained legacy parser coverage under tests/parser and update the parser spec.

Contract

  • parse_function(fn, context) remains the only parser entry point.
  • Binary dtype matching stays strict; authored mismatches use explicit casts.
  • Parser Rules do not inspect concrete Cast(Constant) combinations.

Risk

  • Source full verification: 887 passed, 4 skipped.
  • Installed full verification: 175 passed, 0 skipped.
  • JUnit, coverage, commands, and outputs are retained under test_results/parser-scalar-call-*-full-r1/.

@zhen8838
zhen8838 force-pushed the refactor/parser-migration branch from 2470390 to aae6cd0 Compare August 23, 2026 09:49
@zhen8838 zhen8838 changed the title refactor parser migration to unified function API refactor(parser): migrate to unified function API Aug 23, 2026
Comment thread src/tilefoundry/ir/core/module.py Outdated

from tilefoundry.ir.hir._call_binding import set_authoring_reader # noqa: E402

set_authoring_reader(_authored_child_call)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Why is this code? In this way, it will be executed when it becomes import.

Comment thread src/tilefoundry/parser/ast_pattern.py Outdated


@lru_cache(maxsize=1)
def _runtime() -> SimpleNamespace:

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Isn’t this paragraph the compatible code used for development? Why don‘t you delete it?

Comment thread tests/ir/types/test_mesh.py Outdated
)
from tilefoundry.ir.types.shard.shard_layout import ShardLayout
from tilefoundry.parser.sugar import parse_sugar
from tilefoundry.ir.types.shard.sugar import parse_sugar

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Why is Parser Sugar imported from there? Shouldn’t it be a part of Parser? Then I don‘t think the position of this test is reasonable.

@zhen8838

Copy link
Copy Markdown
Collaborator Author

CI run 32637567894 completed. Pre-commit passed; the test job reproduced the same five baseline failures as the clean-main verification (879 passed, 5 failed, 4 skipped), with no new M11-specific failures. The run stopped before wheel/install checks because the repository CI treats baseline failures as job failure.

Local fresh evidence for commit 86de9ce: test_results/parser-migration-m11-20260823e/ (JUnit junit.xml, coverage XML, command/output artifacts). M11-focused blast-radius tests passed: 27 passed.

@zhen8838

Copy link
Copy Markdown
Collaborator Author

Follow-up CI run 32638014364 on docs commit 52e6023 also completed: pre-commit passed and the test job reproduced the same five baseline failures (no new parser/M11 failure). The wheel/install stages were skipped by the workflow after the repository test job failed. PR remains open for human review; no merge was performed.

@zhen8838
zhen8838 merged commit 81af1b4 into tile-ai:main Aug 24, 2026
1 check passed
@zhen8838
zhen8838 deleted the refactor/parser-migration branch August 24, 2026 03:16
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.

1 participant