Merged
feat(pypto_pro): Add pypto language module #4725
gravel1997Add on Jul 8
feat(pypto_pro): Add pypto language module #4725
Merged
gravel1997Add on Jul 8
gravel1997
gravel1997Collaborators
Jul 8
Introduce the pypto_pro.language module — a DSL parser subsystem that converts high-level Python DSL code into IR (Intermediate Representation) structures. It adds 17 new files under python/pypto_pro/language/:
- _api.py: Declares all user-facing pl.xxx API functions (load/store, binary/unary ops, reductions, matmul, quantization, VF namespace, control flow, etc.) as non-executable stubs for IDE support and type checking.
- parser/decorator.py: Entry-point decorators (@function, @inline, @program) that intercept DSL functions and parse their AST.
- parser/_ast_parser.py: Core AST traversal, parameter binding, and function parsing.
- parser/_call_parser.py: Translates pl.xxx() calls to IR op calls, handles return type inference and VF ops.
- parser/_type_resolver.py: Resolves Python type annotations to IR types, including tensor shapes and memory spaces.
- parser/_expression_parser.py: Parses Python expressions (binops, subscripts, constexpr, tuples) into IR.
- parser/_assignment_parser.py, _control_flow_parser.py, _buffer_parser.py, _scope_manager.py, _struct_parser.py, _op_pipeline.py, _expr_evaluator.py, _span_tracker.py, _utils.py, text_parser.py: Supporting parsers for assignments, loops, tile groups, scoping, structs, expression evaluation, and span tracking.
The module is consumed via import pypto_pro.language as pl and provides the decorator-based DSL parsing pipeline that turns annotated Python functions into IR builder programs.

likedislike
Pull Request has been successfully merged by CANN-robot.
(Thank you for gravel1997's contribution.)
gravel1997gravel1997Collaborators
Jul 8 Created pull request, commit 2685b915
atomgit-bot
atomgit-bot
Jul 8 Comments:

🤖 正在生成合并请求摘要,请稍候…

likedislike
Incorrect?
atomgit-bot
atomgit-bot
Jul 8 Comments:

🤖 AI 代码检视正在进行中,请稍候…

likedislike
Incorrect?
CANN-robot
CANN-robotCollaboratorsJul 8Start code review1
python/pypto_pro/language/parser/__init__.py
Outdated
@@ -0,0 +41,2 @@
41+from .decorator import function, inline, program
42+from .diagnostics import ParserError # noqa: F401
43+from .text_parser import loads, loads_program, parse, parse_program
CANN-robot
CANN-robotJul 8Comments:

This code comment section is from+41To+43

【openlibing.ci】识别到代码检查告警抑制注释,匹配工具:flake8,ruff,请Committer检视其合理性。

likedislike
CANN-robotCANN-robotCollaborators
Jul 8 Added label: cann-cla/yes
168 messages are collapsed here。 See more
lidongshenglidongshengCollaborators
Jul 14 Modify description of pull request
lidongsheng
lidongshengCollaborators
Jul 14 Comments:

/lgtm

likedislike
gaoxiang618
gaoxiang618Collaborators
Jul 14 Comments:

/lgtm
/approve

likedislike
CANN-robotCANN-robotCollaborators
Jul 14 Added label: lgtmapproved
CANN-robotCANN-robotCollaborators
Jul 14 Merged pull request