refactor(ir): Rename block to tile across entire codebase#386
refactor(ir): Rename block to tile across entire codebase#386Hzfengsy merged 5 commits intohw-native-sys:mainfrom
Conversation
…sys#377) BREAKING CHANGE: All `block.*` IR op names are now `tile.*`. The `pl.block` DSL namespace is removed. Use `pl.tile.*` instead. - Rename all REGISTER_OP/REGISTER_BACKEND_OP from "block.*" to "tile.*" - Rename C++ identifiers: DeduceBlock* -> DeduceTile*, MakeBlock* -> MakeTile*, BlockOp -> TileOp, IncoreBlockOps -> IncoreTileOps, ConvertTensorToBlockOps -> ConvertTensorToTileOps - Rename Python files: block_ops.py -> tile_ops.py - Rename C++ files/dirs: block_ops/ -> tile_ops/, convert_tensor_to_block_ops_pass -> convert_tensor_to_tile_ops_pass - Update Python create_op_call strings, pass names, type stubs, bindings - Remove deprecated pl.block alias (breaking change) - Remove printer block->tile translation (no longer needed) - Update all tests, docs (en + zh-cn), and examples
There was a problem hiding this comment.
Pull request overview
Renames the IR/operator namespace from block.* to tile.* across C++ IR, Python DSL, passes, codegen, tests, and docs to align naming with TileType/TileExpr, and removes the pl.block DSL namespace in favor of pl.tile.
Changes:
- Replaces
block.*op registrations/usages withtile.*and updates related pass/property names (ConvertTensorToTileOps,IncoreTileOps). - Updates Python DSL surface area (
pl.tile.*, unified dispatch, parser routing) and Python bindings/type stubs. - Updates tests and documentation (en + zh-cn) to the new naming.
Reviewed changes
Copilot reviewed 107 out of 107 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/ut/language/parser/test_type_resolver.py | Update DSL parsing/type-resolver tests to use pl.tile.*. |
| tests/ut/language/parser/test_printer_integration.py | Update printer/parser round-trip expectations from pl.block to pl.tile. |
| tests/ut/language/parser/test_decorator.py | Rename test referencing tile ops; still contains a block_* helper name (see comments). |
| tests/ut/language/parser/test_closure_var_resolution.py | Update closure variable resolution tests to pl.tile.load/store. |
| tests/ut/ir/transforms/test_pass_manager.py | Update pass manager expected pass name to ConvertTensorToTileOps. |
| tests/ut/ir/transforms/test_outline_incore_scopes.py | Update scope outlining tests and docstrings for tile.*. |
| tests/ut/ir/transforms/test_init_memref.py | Update InitMemRef tests to detect tile.alloc and tile.* ops. |
| tests/ut/ir/transforms/test_flatten_call_expr_pass.py | Update flattening tests to use pl.tile.get_block_idx/load/store. |
| tests/ut/ir/transforms/test_convert_tensor_to_tile_ops.py | Rename and update conversion pass tests to tile ops and new pass entrypoint. |
| tests/ut/ir/transforms/test_basic_memory_reuse.py | Update memory reuse tests to tile.alloc and tile.* ops terminology. |
| tests/ut/ir/transforms/test_allocate_memory_addr_pass.py | Update address allocation tests to count tile.alloc. |
| tests/ut/ir/printing/test_python_printer.py | Update printer tests for tile.load/store (one stale “block” label remains; see comments). |
| tests/ut/ir/operators/test_operation_span_capture.py | Update op span capture tests from block module to tile module. |
| tests/ut/ir/memory/test_memref.py | Update MemRef parsing/printing tests to pl.tile.load. |
| tests/ut/codegen/test_pto_codegen_paged_attn.py | Update codegen tests to lower tile.matmul instead of block.matmul. |
| tests/ut/codegen/test_pto_codegen.py | Update PTO codegen tests and imports from block to tile. |
| tests/ut/codegen/test_cce_codegen.py | Update CCE codegen tests and IRBuilder usage from block to tile. |
| tests/st/harness/core/harness.py | Update system test harness kernels to use pl.tile.*. |
| tests/st/fuzz/src/kernel_generator.py | Update fuzz kernel generator to strip tile. and detect tile.matmul. |
| tests/st/fuzz/src/golden_generator.py | Update golden reference mapping keys from block.* to tile.*. |
| tests/st/fuzz/README.md | Update fuzz docs from block-level to tile-level terminology. |
| tests/st/examples/01_beginner/basic/test_basic_ops.py | Update system example docs to reference pl.tile. |
| tests/st/README.md | Update system test README code snippets to pl.tile.*. |
| src/ir/verifier/property_verifier_registry.cpp | Rename verifier property registration to IncoreTileOps. |
| src/ir/transforms/python_printer.cpp | Update printer comments and special-casing from block.alloc to tile.alloc. |
| src/ir/transforms/outline_incore_scopes_pass.cpp | Update outlining logic to detect tile.store instead of block.store. |
| src/ir/transforms/op_conversion_registry.cpp | Update default tensor→tile op conversion mappings. |
| src/ir/transforms/ir_property.cpp | Rename property stringification to IncoreTileOps. |
| src/ir/transforms/insert_sync_pass.cpp | Update store special-case to tile.store. |
| src/ir/transforms/init_memref.cpp | Rename memory rules table and alloc insertion to tile.*; update op prefix checks. |
| src/ir/transforms/convert_tensor_to_tile_ops_pass.cpp | Rename conversion pass and property verifier to tile nomenclature and ops. |
| src/ir/transforms/basic_memory_reuse_pass.cpp | Update cast/no-reuse and alloc cleanup to tile.cast / tile.alloc. |
| src/ir/transforms/allocate_memory_addr_pass.cpp | Update alloc-address rewriting to match tile.alloc. |
| src/ir/op/tile_ops/unary.cpp | Register unary ops under tile.* and update type deduction helpers/messages. |
| src/ir/op/tile_ops/transform.cpp | Register transform ops under tile.* and update op category to TileOp. |
| src/ir/op/tile_ops/reduction.cpp | Register reduction ops under tile.* and rename deduction helpers. |
| src/ir/op/tile_ops/memory.cpp | Register memory ops under tile.* and update deduction helper names/messages. |
| src/ir/op/tile_ops/matmul.cpp | Register matmul-family ops under tile.* and rename deduction helpers. |
| src/ir/op/tile_ops/broadcast.cpp | Register broadcast/expand ops under tile.* and rename deduction helpers. |
| src/ir/op/tile_ops/batch_matmul.cpp | Register batch matmul under tile.* and rename deduction helpers. |
| src/ir/op/README.md | Update operator module docs from block_ops to tile_ops (contains outdated get_block_idx details; see comments). |
| src/codegen/orchestration/orchestration_codegen.cpp | Treat tile.* as built-in ops for orchestration codegen dispatch. |
| src/codegen/cce/cce_codegen.cpp | Update tensor access shape collector logic to tile.load/store. |
| reference/README.md | Rename reference examples directory from block-level to tile-level. |
| python/pypto/pypto_core/passes.pyi | Update pass/property enums and exported pass factory to tile naming. |
| python/pypto/pypto_core/ir.pyi | Update op conversion docstrings from tensor→block to tensor→tile. |
| python/pypto/language/typing/tile.py | Update Tile typing docs to “tile-level programming” terminology. |
| python/pypto/language/typing/init.py | Update typing module docs to tile-level terminology. |
| python/pypto/language/parser/ast_parser.py | Route pl.tile.* and unified ops dispatch to tile ops; remove pl.block.* path. |
| python/pypto/language/op/unified_ops.py | Update unified dispatch to call tile ops rather than block ops. |
| python/pypto/language/op/tile_ops.py | Rename DSL wrapper module from block ops to tile ops and adjust docs/imports (see comments on get_block_idx). |
| python/pypto/language/op/init.py | Expose pl.tile namespace; promote tile-only ops from tile_ops. |
| python/pypto/language/init.py | Expose pl.tile and promoted tile ops; remove pl.block exposure. |
| python/pypto/ir/pass_manager.py | Update default pass pipeline to include ConvertTensorToTileOps. |
| python/pypto/ir/op_conversion.py | Rename conversion utilities/docs from tensor→block to tensor→tile; update examples. |
| python/pypto/ir/op/init.py | Expose IR tile ops module instead of block. |
| python/bindings/modules/passes.cpp | Bind renamed pass/property names and update InitMemRef docstring references. |
| python/bindings/modules/ir.cpp | Update binding docstring for op conversion registry to tensor→tile. |
| include/pypto/ir/verifier/verifier.h | Rename verifier factory to CreateIncoreTileOpsPropertyVerifier. |
| include/pypto/ir/transforms/passes.h | Rename pass API to ConvertTensorToTileOps and update docs accordingly. |
| include/pypto/ir/transforms/pass_properties.h | Update pass property dependencies/outputs from IncoreBlockOps to IncoreTileOps. |
| include/pypto/ir/transforms/op_conversion_registry.h | Update registry docs and examples from tensor→block to tensor→tile. |
| include/pypto/ir/transforms/ir_property.h | Rename property enum value to IncoreTileOps. |
| include/pypto/ir/op_registry.h | Update op category docs/examples to reference TileOp / tile.*. |
| include/pypto/codegen/codegen_base.h | Update documentation examples to tile.* op names. |
| include/pypto/codegen/cce/code_context.h | Update comment references to tile load/store. |
| include/pypto/codegen/cce/cce_codegen.h | Update comments from block ops to tile ops terminology. |
| examples/ir_parser/paged_attention_with_incore.py | Update example kernels to use pl.tile.full etc. |
| examples/ir_parser/paged_attention_example.py | Update example kernels to use pl.tile.full etc. |
| docs/zh-cn/user/02-operation_reference.md | Update op reference to pl.tile.* (see comments on get_block_idx wording). |
| docs/zh-cn/user/01-language_guide.md | Update language guide from pl.block to pl.tile. |
| docs/zh-cn/dev/passes/07-allocate_memory_addr.md | Update pass docs to tile.alloc terminology and examples. |
| docs/zh-cn/dev/passes/05-basic_memory_reuse.md | Update pass docs to tile.alloc terminology and examples. |
| docs/zh-cn/dev/passes/04-init_memref.md | Update pass docs to tile.* memory rules and examples. |
| docs/zh-cn/dev/passes/01-verifier.md | Rename verifier property doc to IncoreTileOps. |
| docs/zh-cn/dev/passes/00-pass_manager.md | Update pass manager docs to new pass/property names. |
| docs/zh-cn/dev/language/00-python_syntax.md | Update syntax docs and examples to pl.tile.*. |
| docs/zh-cn/dev/ir/05-operators.md | Update operator system docs to TileOp / tile_ops (see comments on get_block_idx). |
| docs/zh-cn/dev/ir/02-types.md | Update type docs example to pl.tile.load. |
| docs/zh-cn/dev/codegen/01-cce_codegen.md | Update codegen docs to show tile.* ops. |
| docs/zh-cn/dev/codegen/00-pto_codegen.md | Update PTO codegen docs to show tile.* ops. |
| docs/en/user/02-operation_reference.md | Update op reference to pl.tile.* (see comments on get_block_idx wording). |
| docs/en/user/01-language_guide.md | Update language guide from pl.block to pl.tile. |
| docs/en/dev/passes/07-allocate_memory_addr.md | Update pass docs to tile.alloc terminology and examples. |
| docs/en/dev/passes/05-basic_memory_reuse.md | Update pass docs to tile.alloc terminology and examples. |
| docs/en/dev/passes/04-init_memref.md | Update pass docs to tile.* memory rules and examples. |
| docs/en/dev/passes/01-verifier.md | Rename verifier property doc to IncoreTileOps. |
| docs/en/dev/passes/00-pass_manager.md | Update pass manager docs to new pass/property names. |
| docs/en/dev/language/00-python_syntax.md | Update syntax docs and examples to pl.tile.*. |
| docs/en/dev/ir/05-operators.md | Update operator system docs to TileOp / tile_ops (see comments on get_block_idx). |
| docs/en/dev/ir/02-types.md | Update type docs example to pl.tile.load. |
| docs/en/dev/codegen/01-cce_codegen.md | Update codegen docs to show tile.* ops. |
| docs/en/dev/codegen/00-pto_codegen.md | Update PTO codegen docs to show tile.* ops. |
| README.zh-CN.md | Update top-level README to reference tile ops example script name. |
| README.md | Update top-level README to reference tile ops example script name. |
| CMakeLists.txt | Update build sources from block_ops/* to tile_ops/* and pass filename rename. |
| .claude/rules/testing-and-examples.md | Update examples directory naming from block-level to tile-level. |
Comments suppressed due to low confidence (1)
python/pypto/language/op/tile_ops.py:257
- The
get_block_idxdocstring now says it returns the index of the current "compute tile", but the op name is intentionally kept as a hardware block index term. To avoid ambiguity for users, consider describing it as the current hardware block index (and keep examples consistent with that terminology).
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request refactors the codebase by systematically renaming all instances of 'block' to 'tile' within the Intermediate Representation (IR) operations, DSL namespace, and internal identifiers. This change ensures consistency with the Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This is a comprehensive and well-executed refactoring to rename block to tile throughout the codebase. The changes are consistent across C++, Python, and documentation. I've identified a few minor areas, primarily in examples and test files, where the old block naming convention persists. Addressing these will ensure complete consistency.
Note: Security Review did not run due to the size of the PR.
- Fix get_block_idx descriptions to use "hardware block index" terminology - Fix get_block_idx return type from INT32 to UINT64 in src/ir/op/README.md - Rename build_block_* functions to build_tile_* in tile_ops_example.py - Update print labels from "Block" to "Tile" in examples and tests - Rename TestBlock* test classes to TestTile* in test_tile_ops.py - Rename TestBlockOperationSpanCapture to TestTileOperationSpanCapture - Rename block_add_scalar to tile_add_scalar in test_decorator.py - Update debug print from "block.load" to "tile.load" in test_python_printer.py
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThis PR systematically renames the "block" abstraction to "tile" across the codebase: IR ops and registrations, Python API exports, language parser and DSL, passes/properties/verifiers, codegen backends, transforms, examples, tests, and docs — updating registrations, pass names, enums, and related docstrings/signatures where applicable. Changes
Sequence Diagram(s)(omitted) Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
|
There was a problem hiding this comment.
Actionable comments posted: 11
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (8)
docs/zh-cn/dev/language/00-python_syntax.md (1)
323-341:⚠️ Potential issue | 🟡 MinorRename example identifier to avoid mixed terminology.
Line 323 switches the section to Tile terminology, but Line 329 still uses
BlockExample. Please rename it (for example,TileExample) to avoid migration confusion in docs.✏️ Suggested doc fix
-@pl.program -class BlockExample: +@pl.program +class TileExample:🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/zh-cn/dev/language/00-python_syntax.md` around lines 323 - 341, The class name BlockExample should be renamed to TileExample to match the Tile terminology used in this section; update the program class identifier in the snippet (change BlockExample to TileExample) and ensure any internal references to that class (e.g., decorators or external mentions) and the function tile_add remain consistent so the example uses TileExample throughout.docs/en/dev/language/00-python_syntax.md (2)
328-342:⚠️ Potential issue | 🟡 MinorInconsistent class name
BlockExampleshould beTileExample.The class name
BlockExampleis inconsistent with the tile-based terminology used elsewhere. Since this is documentation demonstrating tile operations, consider renaming the class toTileExampleto maintain consistency with the PR's objective.📝 Suggested fix
`@pl.program` -class BlockExample: +class TileExample: `@pl.function` def tile_add(🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/en/dev/language/00-python_syntax.md` around lines 328 - 342, Rename the documentation class BlockExample to TileExample to match tile-based terminology: locate the class declaration "class BlockExample" and change it to "class TileExample" (retain the `@pl.program` decorator and the tile_add method and its signature/contents unchanged) so all references and examples use TileExample consistently.
149-151:⚠️ Potential issue | 🟡 MinorStale comment references "block" instead of "tile".
The comment
# Promoted from blockshould be updated to reflect the new terminology.📝 Suggested fix
-pl.load(t, [0, 0], [64, 64]) # Promoted from block +pl.load(t, [0, 0], [64, 64]) # Promoted from tile🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/en/dev/language/00-python_syntax.md` around lines 149 - 151, Update the stale inline comment for the promoted op example: change the comment next to pl.load(...) from “# Promoted from block” to “# Promoted from tile” (keep pl.load and pl.create_tensor lines unchanged); ensure any other occurrences in the same snippet that mention "block" are similarly updated to "tile" for consistent terminology.src/backend/910B_CCE/backend_910b_cce_ops.cpp (1)
257-262:⚠️ Potential issue | 🟡 MinorAdd arity validation in
MakeTileFullCodegenCCE.This helper dereferences
op->args_[1]without a size check, unlike surrounding helpers.🔧 Proposed fix
static std::string MakeTileFullCodegenCCE(const ir::CallPtr& op, codegen::CodegenBase& codegen_base) { auto& codegen = dynamic_cast<codegen::CCECodegen&>(codegen_base); + CHECK(op->args_.size() == 2) << "tile.full requires 2 arguments: target, scalar"; std::string dst = codegen.GetCurrentResultTarget(); std::string scalar = codegen.GetExprAsCode(op->args_[1]); codegen.Emit("TEXPANDS(" + dst + ", " + scalar + ");"); return ""; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/backend/910B_CCE/backend_910b_cce_ops.cpp` around lines 257 - 262, MakeTileFullCodegenCCE currently dereferences op->args_[1] without verifying the argument count; add an arity check at the start of MakeTileFullCodegenCCE to ensure op->args_.size() > 1 and handle the error path (e.g., emit a diagnostic via codegen_base or codegen.GetLogger()/throw a clear std::runtime_error) before accessing op->args_[1], then proceed to compute scalar and emit TEXPANDS as before; reference the function MakeTileFullCodegenCCE and the op->args_ usage to locate where to add the check.src/ir/op/tile_ops/broadcast.cpp (1)
94-117:⚠️ Potential issue | 🟠 MajorEnforce the
tile.col_expand*shape contract during type deduction.
DeduceTileColExpandTypecurrently skips shape validation forcol_tile([1, cols]) and target-column compatibility, so invalid inputs can type-check and leak downstream.🔧 Proposed fix
TypePtr DeduceTileColExpandType(const std::vector<ExprPtr>& args, const std::vector<std::pair<std::string, std::any>>& kwargs, const std::string& op_name) { CHECK(args.size() == 2) << "The operator " << op_name << " requires exactly 2 arguments, but got " << args.size(); // First argument is the target tile (shape to expand to) auto target_type = As<TileType>(args[0]->GetType()); CHECK(target_type) << "The operator " << op_name << " requires first argument to be a TileType, but got " << args[0]->GetType()->TypeName(); // Second argument is the column tile to expand (shape [1, cols]) auto col_type = As<TileType>(args[1]->GetType()); CHECK(col_type) << "The operator " << op_name << " requires second argument to be a TileType, but got " << args[1]->GetType()->TypeName(); + + const auto& target_shape = target_type->shape_; + const auto& col_shape = col_type->shape_; + CHECK(target_shape.size() >= 2) << "The operator " << op_name + << " requires target to have at least 2 dimensions, but got " + << target_shape.size() << " dimensions"; + CHECK(col_shape.size() >= 2) << "The operator " << op_name + << " requires col_tile to have at least 2 dimensions, but got " + << col_shape.size() << " dimensions"; + + auto col_rows_const = As<ConstInt>(col_shape[col_shape.size() - 2]); + CHECK(col_rows_const && col_rows_const->value_ == 1) + << "The operator " << op_name << " requires col_tile rows to be 1, but got " + << (col_rows_const ? std::to_string(col_rows_const->value_) : "?"); + + auto target_cols_const = As<ConstInt>(target_shape[target_shape.size() - 1]); + auto col_cols_const = As<ConstInt>(col_shape[col_shape.size() - 1]); + if (target_cols_const && col_cols_const) { + CHECK(target_cols_const->value_ == col_cols_const->value_) + << "The operator " << op_name << " requires matching column dimensions, but got target cols=" + << target_cols_const->value_ << " and col_tile cols=" << col_cols_const->value_; + } // Result has same shape as target, with promoted dtype auto result_dtype = PromoteDataTypes(target_type->dtype_, col_type->dtype_); CHECK(result_dtype) << "The operator " << op_name << " requires compatible data types"; TileView tile_view; - tile_view.valid_shape = target_type->shape_; - return std::make_shared<TileType>(target_type->shape_, *result_dtype, std::nullopt, tile_view); + tile_view.valid_shape = target_shape; + return std::make_shared<TileType>(target_shape, *result_dtype, std::nullopt, tile_view); }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/ir/op/tile_ops/broadcast.cpp` around lines 94 - 117, DeduceTileColExpandType must validate shapes: check target_type and col_type are 2-D (shape_.size() == 2), ensure col_type->shape_[0] == 1, and ensure col_type->shape_[1] matches target_type->shape_[1] (same number of columns); if any check fails, CHECK with a clear message including op_name and the offending shapes; after these checks continue to promote dtypes and return the TileType with tile_view.valid_shape set to target_type->shape_. Reference symbols: DeduceTileColExpandType, target_type, col_type, result_dtype, and tile_view.src/ir/op/tile_ops/elementwise.cpp (1)
47-85:⚠️ Potential issue | 🟠 MajorBroadcasted outputs should derive
valid_shapefrom both operands.
DeduceTileOpElementwiseBinaryTypebroadcastsshape_but copiesvalid_shapefrom lhs only. In real broadcast cases this can mark large valid regions as invalid. The same pattern appears in other broadcasted deducers in this file.🔧 Proposed fix (pattern to reuse in other deducers)
auto broadcast_result = BroadcastShapes(tile_type1->shape_, tile_type2->shape_); CHECK(broadcast_result.success) << "The operator " << op_name << " requires compatible shapes, but got " << FormatShape(tile_type1->shape_) << " and " << FormatShape(tile_type2->shape_); - // TODO(YunjiQin): assumes both src tiles have the same valid_shape; may need refinement - // for cases where lhs and rhs have different valid_shapes (e.g. after broadcasting). + auto lhs_valid_shape = GetValidShape(tile_type1); + auto rhs_valid_shape = GetValidShape(tile_type2); + auto valid_shape_result = BroadcastShapes(lhs_valid_shape, rhs_valid_shape); + CHECK(valid_shape_result.success) << "The operator " << op_name + << " requires compatible valid_shapes, but got " + << FormatShape(lhs_valid_shape) << " and " + << FormatShape(rhs_valid_shape); + TileView tile_view; - tile_view.valid_shape = GetValidShape(tile_type1); + tile_view.valid_shape = valid_shape_result.shape; return std::make_shared<TileType>(broadcast_result.shape, *result_dtype, std::nullopt, tile_view); }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/ir/op/tile_ops/elementwise.cpp` around lines 47 - 85, DeduceTileOpElementwiseBinaryType currently copies valid_shape only from the LHS, which is wrong for broadcasts; fix by computing valid shapes for both operands (call GetValidShape on tile_type1 and tile_type2), broadcast/align those two valid_shape vectors to the broadcast_result.shape (e.g. align trailing dimensions and take the elementwise minimum/combined valid extents per-dimension), and set tile_view.valid_shape to that broadcasted valid shape before constructing the resulting TileType; apply the same pattern to other elementwise/broadcast deducers in this file (use symbols DeduceTileOpElementwiseBinaryType, GetValidShape, TileView, BroadcastShapes, TileType to locate and update the code).docs/en/dev/passes/04-init_memref.md (1)
22-29:⚠️ Potential issue | 🟡 MinorAlign remaining “block-op conversion” wording with tile naming.
Line 28 still says “block-op conversion”, which conflicts with the rest of this page (
tile.*,IncoreTileOps).Proposed doc fix
-**When to use**: Run after SSA conversion, outlining, and block-op conversion. Required before BasicMemoryReuse, InsertSync, and AllocateMemoryAddr. +**When to use**: Run after SSA conversion, outlining, and tile-op conversion. Required before BasicMemoryReuse, InsertSync, and AllocateMemoryAddr.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/en/dev/passes/04-init_memref.md` around lines 22 - 29, Update the wording that currently reads "block-op conversion" to use tile-based terminology to match the rest of the page (e.g., use "tile-op conversion" or "tile conversion") so it aligns with tile.* naming and the IncoreTileOps pass; ensure the sentence in the requirements/when-to-use section references the tile conversion pass consistently with TypeChecked, SSAForm, SplitIncoreOrch, and IncoreTileOps.docs/zh-cn/dev/passes/04-init_memref.md (1)
22-29:⚠️ Potential issue | 🟡 Minor“使用时机”段落仍使用旧命名。
Line 28 的“块操作转换之后运行”建议改为“tile 操作转换之后运行”,避免与
IncoreTileOps命名冲突。🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/zh-cn/dev/passes/04-init_memref.md` around lines 22 - 29, “使用时机”段落仍使用旧命名:把“在静态单赋值 (SSA) 转换、提取和块操作转换之后运行”中的“块操作转换”替换为“tile 操作转换”,并明确指向现用符号 IncoreTileOps(例如改为“在静态单赋值 (SSA) 转换、提取和 IncoreTileOps(tile 操作转换)之后运行”),保持与 SSAForm、BasicMemoryReuse、InsertSync 和 AllocateMemoryAddr 的先后关系不变。
🧹 Nitpick comments (9)
docs/zh-cn/dev/ir/05-operators.md (1)
257-257: Update example function name for consistency.The example function name
"block_computation"should be updated to"tile_computation"to align with the block→tile rename throughout this PR. While this is a string literal (not an IR operation reference), maintaining consistent terminology in documentation examples helps avoid confusion for readers learning the tile API.📝 Suggested update
-with ib.function("block_computation") as f: +with ib.function("tile_computation") as f:🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/zh-cn/dev/ir/05-operators.md` at line 257, Update the example function name string literal from "block_computation" to "tile_computation" so the docs match the block→tile rename; specifically change the call ib.function("block_computation") (and any other occurrences of that exact string literal in this document) to ib.function("tile_computation") to keep terminology consistent in the examples.python/pypto/language/parser/ast_parser.py (1)
1474-1482: Add an explicit migration error forpl.block.*.Line 1474 currently sends legacy
pl.block.*calls into unified dispatch, which can produce a confusing “unknown operation: block” error. A dedicated branch would provide a clearer upgrade path.Suggested patch
# pl.{operation} (2-segment, unified dispatch or promoted ops) + if len(attrs) >= 3 and attrs[0] == "pl" and attrs[1] == "block": + raise UnsupportedFeatureError( + f"'pl.block.*' is no longer supported: {ast.unparse(call)}", + span=self.span_tracker.get_span(call), + hint="Use 'pl.tile.*' instead", + ) if len(attrs) >= 2 and attrs[0] == "pl" and attrs[1] not in ("tensor", "tile", "system"): op_name = attrs[1] return self._parse_unified_op(op_name, call)🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@python/pypto/language/parser/ast_parser.py` around lines 1474 - 1482, The current dispatch sends legacy pl.block.* calls into _parse_unified_op causing an unclear "unknown operation: block" error; add an explicit branch before calling _parse_unified_op to detect when attrs[0] == "pl" and attrs[1] == "block" and raise UnsupportedFeatureError with span=self.span_tracker.get_span(call), a clear message using ast.unparse(call), and a hint directing users to the migration path for pl.block.* (i.e., tell them pl.block.* is legacy and how to migrate); keep the existing branch for other pl.* ops and still call _parse_unified_op(op_name, call) for non-block cases.tests/ut/codegen/test_pto_codegen_paged_attn.py (1)
183-184: Add verbose flag to pytest invocation for consistency.Per repository conventions, pytest should be invoked with the verbose flag for consistent test output.
📝 Suggested fix
if __name__ == "__main__": - pytest.main([__file__]) + pytest.main([__file__, "-v"])Based on learnings: "In Python test files, prefer invoking pytest programmatically via pytest.main([file, "-v"]) inside the if name == "main" guard."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/ut/codegen/test_pto_codegen_paged_attn.py` around lines 183 - 184, The pytest invocation in the __main__ guard (the pytest.main call) is missing the verbose flag; update the pytest.main([__file__]) call in test_pto_codegen_paged_attn.py inside the if __name__ == "__main__": block to include the "-v" option (e.g., pytest.main([__file__, "-v"])) so tests run with verbose output per repository convention.src/backend/910B_PTO/backend_910b_pto_ops.cpp (1)
235-236: Keep the load-codegen comment aligned with emitted IR.The comment says
pto.subview, but this function emitspto.partition_view.📝 Suggested doc fix
-// tile.load: emit pto.subview + pto.tload (same format as original IR layer codegen) +// tile.load: emit pto.partition_view + pto.tload (same format as original IR layer codegen)🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/backend/910B_PTO/backend_910b_pto_ops.cpp` around lines 235 - 236, The comment above MakeTileLoadCodegenPTO is inaccurate: it says "pto.subview" but the function emits "pto.partition_view"; update the comment to match emitted IR (e.g., mention pto.partition_view and pto.tload) so the doc aligns with the generated code and avoid confusion when reading MakeTileLoadCodegenPTO.tests/ut/language/test_unified_ops.py (1)
174-175: Rename the test class to match tile terminology.
TestUnifiedBlockDispatchstill uses the old domain term while its docstring and body now test Tile dispatch.♻️ Suggested rename
-class TestUnifiedBlockDispatch: +class TestUnifiedTileDispatch:🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/ut/language/test_unified_ops.py` around lines 174 - 175, The test class name TestUnifiedBlockDispatch uses outdated "Unified" terminology but the docstring and tests target Tile dispatch; rename the class to TestTileBlockDispatch (or another Tile-prefixed name) to match the docstring and test intent, update the class declaration in tests/ut/language/test_unified_ops.py from class TestUnifiedBlockDispatch: to class TestTileBlockDispatch: and adjust any references/usages in the test module or other tests that import or parametrize this class so test discovery and references remain correct.tests/st/fuzz/src/fuzzer.py (1)
310-324: Convert mutable class-level operator pool lists to immutable tuples.These
TILE_*_OPSdefinitions are mutable class-level lists that should be immutable to follow best practices and prevent accidental mutations. While the current code concatenates these lists at instance initialization (creating instance copies and maintaining test isolation), converting them to tuples withClassVartype hints provides stronger guarantees against future mutations.♻️ Suggested pattern (apply to all `TILE_*_OPS` constants)
-from typing import Any +from typing import Any, ClassVar ... - TILE_BINARY_OPS = [ + TILE_BINARY_OPS: ClassVar[tuple[OpSpec, ...]] = ( ... - ] + )Also applies to: 327 (TILE_UNARY_OPS), 349 (TILE_ROW_EXPAND_OPS), 380 (TILE_REDUCTION_OPS), 411 (TILE_COL_REDUCTION_OPS), 447 (TILE_COL_EXPAND_OPS), 477 (TILE_MATRIX_OPS)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/st/fuzz/src/fuzzer.py` around lines 310 - 324, Convert the mutable class-level operator pool lists (e.g., TILE_BINARY_OPS, TILE_UNARY_OPS, TILE_ROW_EXPAND_OPS, TILE_REDUCTION_OPS, TILE_COL_REDUCTION_OPS, TILE_COL_EXPAND_OPS, TILE_MATRIX_OPS) to immutable tuples and add ClassVar type hints so they are not accidentally mutated; locate each OpSpec list definition (such as the TILE_BINARY_OPS definition shown) and replace the surrounding list literal [] with a tuple literal () and annotate the names with typing.ClassVar[Tuple[OpSpec, ...]] (or the existing type alias) so the constants are immutable at the class level while keeping instance concatenation logic unchanged.include/pypto/ir/verifier/verifier.h (1)
123-127: Consider a deprecated alias for the old factory name.This header keeps compatibility aliases for other verifier factories; adding one for
CreateIncoreBlockOpsPropertyVerifierwould make C++ migration smoother.♻️ Suggested compatibility shim
PropertyVerifierPtr CreateIncoreTileOpsPropertyVerifier(); + +[[deprecated("Use CreateIncoreTileOpsPropertyVerifier()")]] +inline VerifyRulePtr CreateIncoreBlockOpsPropertyVerifier() { + return CreateIncoreTileOpsPropertyVerifier(); +}🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@include/pypto/ir/verifier/verifier.h` around lines 123 - 127, Add a deprecated compatibility alias for the old factory name so callers of CreateIncoreBlockOpsPropertyVerifier still compile: declare an inline function or forwarder named CreateIncoreBlockOpsPropertyVerifier() that simply calls and returns CreateIncoreTileOpsPropertyVerifier(), mark it deprecated (e.g., [[deprecated]] or a macro used elsewhere) and place it alongside the existing CreateIncoreTileOpsPropertyVerifier() declaration in the header so migration is smooth for C++ users.tests/ut/codegen/test_pto_codegen_ops.py (1)
12-13: Complete the naming migration by removing remainingBlockidentifiers.The runtime behavior is fine, but test/program identifiers still mix old terminology (
BlockOperationsTest,Test910BBlockOpsCodegen) with tile semantics, which makes the rename feel partial.♻️ Suggested consistency rename
-@pl.program -class BlockOperationsTest: +@pl.program +class TileOperationsTest: @@ -def build_tile_ops_test_program(dtype: DataType = DataType.FP32): +def build_tile_ops_test_program(dtype: DataType = DataType.FP32): @@ - return BlockOperationsTest + return TileOperationsTest @@ -class Test910BBlockOpsCodegen: +class Test910BTileOpsCodegen:Also applies to: 181-181, 475-476, 486-490
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/ut/codegen/test_pto_codegen_ops.py` around lines 12 - 13, Rename remaining test identifiers that use "Block" to use "Tile" to complete the migration: update the class name BlockOperationsTest to TileOperationsTest and Test910BBlockOpsCodegen to Test910BTileOpsCodegen (and any other occurrences of "Block" in test names, variables, or identifiers within this file and the noted locations) so all test/program identifiers consistently use "Tile"; ensure references (imports, test discovery names, and any assertions referencing these identifiers) are updated accordingly to avoid breaking tests.examples/ir_builder/tile_ops_example.py (1)
148-149: Rename the generated IR function name to match tile terminology.
build_complex_tile_computation()still emits"complex_block_computation"as the function name, which is inconsistent with the rest of the migration.♻️ Suggested rename
- with ib.function("complex_block_computation") as f: + with ib.function("complex_tile_computation") as f:🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@examples/ir_builder/tile_ops_example.py` around lines 148 - 149, The emitted IR function name inside build_complex_tile_computation() is still "complex_block_computation" and should be renamed to use tile terminology (e.g., "complex_tile_computation"); update the code that constructs or returns the IR function name within build_complex_tile_computation to use the new tile-based name so it matches the rest of the migration and any references to the generated function.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@docs/en/dev/ir/05-operators.md`:
- Line 380: Update the mislabeled section title that currently reads "Block
operator implementations" to accurately say "Tile operator implementations"
wherever it references the directory `src/ir/op/tile_ops/` in this document;
find the heading or reference string "Block operator implementations" and
replace it with "Tile operator implementations" so the title matches the
`src/ir/op/tile_ops/` path and migration changes.
In `@docs/en/user/02-operation_reference.md`:
- Line 26: The signatures for create/create_tile and their pl.tile.* equivalents
are inconsistent: update the signature shown at `create` / `create_tile` so the
target_memory parameter shows the same default as documented later
(MemorySpace.Vec), or alternately remove the default at Line 61 — pick one
approach and apply it consistently across both `create` / `create_tile` and
`pl.tile.create` / `pl.tile.create_tile` entries so `target_memory` either
always has `= MemorySpace.Vec` or never does; edit the symbol signatures
(target_memory, MemorySpace.Vec, create/create_tile,
pl.tile.create/pl.tile.create_tile) to match the chosen consistent form.
In `@docs/zh-cn/dev/passes/00-pass_manager.md`:
- Line 38: 表格中 IncoreTileOps 的描述与名称不一致:将当前“使用块操作”的说明改为“使用 tile 操作”,即在文档中找到包含符号
IncoreTileOps(当前表格行)并把右侧描述替换为“使用 tile 操作”以保持名称与说明一致。
In `@docs/zh-cn/dev/passes/01-verifier.md`:
- Line 88: The rule description uses inconsistent terminology: the property is
named IncoreTileOps but the text says “块操作”; update the description to use “tile
操作” (or “tile-level 操作”) throughout so it matches the property name
IncoreTileOps and maintain consistency in the docs.
In `@docs/zh-cn/dev/passes/04-init_memref.md`:
- Around line 16-20: 将文档中不统一的术语修正为“tile” 前缀格式:把原文中的“其他块操作 -> Vec”更改为“其他 tile 操作
-> Vec”,以与同一段落中其它条目(tile.load/tile.move、tile.store、tile.matmul/tile.matmul_acc
以及其它 tile.* 描述)保持一致,并确保全文中所有类似表述均使用“tile .*”格式统一术语。
In `@docs/zh-cn/user/02-operation_reference.md`:
- Line 26: The docs show inconsistent signatures for create/create_tile: update
the first signature (the one listing | `create` / `create_tile` ...
`target_memory: MemorySpace` |) to indicate the default
`target_memory=MemorySpace.Vec` (or conversely remove the default on the later
signature) so both descriptions match; specifically ensure the parameter
`target_memory` in the `create` / `create_tile` signature explicitly documents
the default `MemorySpace.Vec` (or delete that default mention at the later
signature), referencing the `create`/`create_tile` symbols and the
`target_memory` and `MemorySpace.Vec` names so both lines read consistently.
In `@src/ir/op/tile_ops/reduction.cpp`:
- Around line 160-170: The registration for REGISTER_OP("tile.sum") declares two
positional arguments ("tile" and "tmp_tile") but DeduceTileReductionType expects
exactly one positional arg; fix by aligning them: either remove the extra
.add_argument("tmp_tile", ...) from the REGISTER_OP("tile.sum") registration so
only "tile" is declared, or update DeduceTileReductionType (and its callers) to
accept and handle a second positional argument (args[1]) and adjust its contract
accordingly; look for the symbols REGISTER_OP("tile.sum"),
.add_argument("tmp_tile"), and DeduceTileReductionType to make the change.
In `@src/ir/transforms/init_memref.cpp`:
- Around line 252-253: Update the stale comment for the tile.store handling in
init_memref.cpp to match the implementation: change the phrase "4th argument
(output_tensor)" to "3rd argument (args_[2], output_tensor)" (or otherwise
reference args_[2]) so the comment aligns with the code path in the tile.store
branch that reads args_[2].
In `@src/ir/transforms/outline_incore_scopes_pass.cpp`:
- Around line 142-147: The StoreTargetCollector currently reads the tile.store
target from args_[2], but StoreEvalToAssignMutator and the comment expect the
target as the 4th argument (args_[3]), causing a mismatch; update
StoreTargetCollector::VisitExpr_(const CallPtr& op) to check args_.size() >= 4
and use As<Var>(op->args_[3]) when extracting the target, and also update the
related check(s) at lines referenced (the other occurrence around 178-180) so
both collector and mutator treat the same argument index for the tile.store
target.
In `@tests/st/README.md`:
- Line 338: The example call to pl.tile.store is passing an unsupported shapes
parameter which will raise a TypeError; update the example to call pl.tile.store
with only the supported arguments (tile, offsets, output_tensor) by removing
shapes=[64, 64] so the example becomes pl.tile.store(tile_c, offsets=[0, 0],
output_tensor=c), keeping the same variables (tile_c, offsets, output_tensor)
used in the snippet.
In `@tests/ut/ir/transforms/test_flatten_call_expr_pass.py`:
- Around line 382-384: The test contains duplicated type-ignore directives and
an unused loop variable `i`; in the loop that iterates `for i in
pl.range(pl.tile.get_block_idx()): # type: ignore[attr-defined,arg-type] #
type: ignore[attr-defined,arg-type]` and the matching loop later, remove the
redundant duplicate `# type: ignore[attr-defined,arg-type]` and rename the loop
variable `i` to `_i` in both the `pl.range(pl.tile.get_block_idx())` loop and
its matching counterpart so the `Before`/`Expected` cases stay aligned and Ruff
B007 is resolved; keep all other code (e.g., `tile: pl.Tile[[32, 32], pl.FP32] =
pl.tile.load(...)` and `pl.tile.store(...)`) unchanged.
---
Outside diff comments:
In `@docs/en/dev/language/00-python_syntax.md`:
- Around line 328-342: Rename the documentation class BlockExample to
TileExample to match tile-based terminology: locate the class declaration "class
BlockExample" and change it to "class TileExample" (retain the `@pl.program`
decorator and the tile_add method and its signature/contents unchanged) so all
references and examples use TileExample consistently.
- Around line 149-151: Update the stale inline comment for the promoted op
example: change the comment next to pl.load(...) from “# Promoted from block” to
“# Promoted from tile” (keep pl.load and pl.create_tensor lines unchanged);
ensure any other occurrences in the same snippet that mention "block" are
similarly updated to "tile" for consistent terminology.
In `@docs/en/dev/passes/04-init_memref.md`:
- Around line 22-29: Update the wording that currently reads "block-op
conversion" to use tile-based terminology to match the rest of the page (e.g.,
use "tile-op conversion" or "tile conversion") so it aligns with tile.* naming
and the IncoreTileOps pass; ensure the sentence in the requirements/when-to-use
section references the tile conversion pass consistently with TypeChecked,
SSAForm, SplitIncoreOrch, and IncoreTileOps.
In `@docs/zh-cn/dev/language/00-python_syntax.md`:
- Around line 323-341: The class name BlockExample should be renamed to
TileExample to match the Tile terminology used in this section; update the
program class identifier in the snippet (change BlockExample to TileExample) and
ensure any internal references to that class (e.g., decorators or external
mentions) and the function tile_add remain consistent so the example uses
TileExample throughout.
In `@docs/zh-cn/dev/passes/04-init_memref.md`:
- Around line 22-29: “使用时机”段落仍使用旧命名:把“在静态单赋值 (SSA)
转换、提取和块操作转换之后运行”中的“块操作转换”替换为“tile 操作转换”,并明确指向现用符号 IncoreTileOps(例如改为“在静态单赋值
(SSA) 转换、提取和 IncoreTileOps(tile 操作转换)之后运行”),保持与
SSAForm、BasicMemoryReuse、InsertSync 和 AllocateMemoryAddr 的先后关系不变。
In `@src/backend/910B_CCE/backend_910b_cce_ops.cpp`:
- Around line 257-262: MakeTileFullCodegenCCE currently dereferences
op->args_[1] without verifying the argument count; add an arity check at the
start of MakeTileFullCodegenCCE to ensure op->args_.size() > 1 and handle the
error path (e.g., emit a diagnostic via codegen_base or
codegen.GetLogger()/throw a clear std::runtime_error) before accessing
op->args_[1], then proceed to compute scalar and emit TEXPANDS as before;
reference the function MakeTileFullCodegenCCE and the op->args_ usage to locate
where to add the check.
In `@src/ir/op/tile_ops/broadcast.cpp`:
- Around line 94-117: DeduceTileColExpandType must validate shapes: check
target_type and col_type are 2-D (shape_.size() == 2), ensure
col_type->shape_[0] == 1, and ensure col_type->shape_[1] matches
target_type->shape_[1] (same number of columns); if any check fails, CHECK with
a clear message including op_name and the offending shapes; after these checks
continue to promote dtypes and return the TileType with tile_view.valid_shape
set to target_type->shape_. Reference symbols: DeduceTileColExpandType,
target_type, col_type, result_dtype, and tile_view.
In `@src/ir/op/tile_ops/elementwise.cpp`:
- Around line 47-85: DeduceTileOpElementwiseBinaryType currently copies
valid_shape only from the LHS, which is wrong for broadcasts; fix by computing
valid shapes for both operands (call GetValidShape on tile_type1 and
tile_type2), broadcast/align those two valid_shape vectors to the
broadcast_result.shape (e.g. align trailing dimensions and take the elementwise
minimum/combined valid extents per-dimension), and set tile_view.valid_shape to
that broadcasted valid shape before constructing the resulting TileType; apply
the same pattern to other elementwise/broadcast deducers in this file (use
symbols DeduceTileOpElementwiseBinaryType, GetValidShape, TileView,
BroadcastShapes, TileType to locate and update the code).
---
Nitpick comments:
In `@docs/zh-cn/dev/ir/05-operators.md`:
- Line 257: Update the example function name string literal from
"block_computation" to "tile_computation" so the docs match the block→tile
rename; specifically change the call ib.function("block_computation") (and any
other occurrences of that exact string literal in this document) to
ib.function("tile_computation") to keep terminology consistent in the examples.
In `@examples/ir_builder/tile_ops_example.py`:
- Around line 148-149: The emitted IR function name inside
build_complex_tile_computation() is still "complex_block_computation" and should
be renamed to use tile terminology (e.g., "complex_tile_computation"); update
the code that constructs or returns the IR function name within
build_complex_tile_computation to use the new tile-based name so it matches the
rest of the migration and any references to the generated function.
In `@include/pypto/ir/verifier/verifier.h`:
- Around line 123-127: Add a deprecated compatibility alias for the old factory
name so callers of CreateIncoreBlockOpsPropertyVerifier still compile: declare
an inline function or forwarder named CreateIncoreBlockOpsPropertyVerifier()
that simply calls and returns CreateIncoreTileOpsPropertyVerifier(), mark it
deprecated (e.g., [[deprecated]] or a macro used elsewhere) and place it
alongside the existing CreateIncoreTileOpsPropertyVerifier() declaration in the
header so migration is smooth for C++ users.
In `@python/pypto/language/parser/ast_parser.py`:
- Around line 1474-1482: The current dispatch sends legacy pl.block.* calls into
_parse_unified_op causing an unclear "unknown operation: block" error; add an
explicit branch before calling _parse_unified_op to detect when attrs[0] == "pl"
and attrs[1] == "block" and raise UnsupportedFeatureError with
span=self.span_tracker.get_span(call), a clear message using ast.unparse(call),
and a hint directing users to the migration path for pl.block.* (i.e., tell them
pl.block.* is legacy and how to migrate); keep the existing branch for other
pl.* ops and still call _parse_unified_op(op_name, call) for non-block cases.
In `@src/backend/910B_PTO/backend_910b_pto_ops.cpp`:
- Around line 235-236: The comment above MakeTileLoadCodegenPTO is inaccurate:
it says "pto.subview" but the function emits "pto.partition_view"; update the
comment to match emitted IR (e.g., mention pto.partition_view and pto.tload) so
the doc aligns with the generated code and avoid confusion when reading
MakeTileLoadCodegenPTO.
In `@tests/st/fuzz/src/fuzzer.py`:
- Around line 310-324: Convert the mutable class-level operator pool lists
(e.g., TILE_BINARY_OPS, TILE_UNARY_OPS, TILE_ROW_EXPAND_OPS, TILE_REDUCTION_OPS,
TILE_COL_REDUCTION_OPS, TILE_COL_EXPAND_OPS, TILE_MATRIX_OPS) to immutable
tuples and add ClassVar type hints so they are not accidentally mutated; locate
each OpSpec list definition (such as the TILE_BINARY_OPS definition shown) and
replace the surrounding list literal [] with a tuple literal () and annotate the
names with typing.ClassVar[Tuple[OpSpec, ...]] (or the existing type alias) so
the constants are immutable at the class level while keeping instance
concatenation logic unchanged.
In `@tests/ut/codegen/test_pto_codegen_ops.py`:
- Around line 12-13: Rename remaining test identifiers that use "Block" to use
"Tile" to complete the migration: update the class name BlockOperationsTest to
TileOperationsTest and Test910BBlockOpsCodegen to Test910BTileOpsCodegen (and
any other occurrences of "Block" in test names, variables, or identifiers within
this file and the noted locations) so all test/program identifiers consistently
use "Tile"; ensure references (imports, test discovery names, and any assertions
referencing these identifiers) are updated accordingly to avoid breaking tests.
In `@tests/ut/codegen/test_pto_codegen_paged_attn.py`:
- Around line 183-184: The pytest invocation in the __main__ guard (the
pytest.main call) is missing the verbose flag; update the
pytest.main([__file__]) call in test_pto_codegen_paged_attn.py inside the if
__name__ == "__main__": block to include the "-v" option (e.g.,
pytest.main([__file__, "-v"])) so tests run with verbose output per repository
convention.
In `@tests/ut/language/test_unified_ops.py`:
- Around line 174-175: The test class name TestUnifiedBlockDispatch uses
outdated "Unified" terminology but the docstring and tests target Tile dispatch;
rename the class to TestTileBlockDispatch (or another Tile-prefixed name) to
match the docstring and test intent, update the class declaration in
tests/ut/language/test_unified_ops.py from class TestUnifiedBlockDispatch: to
class TestTileBlockDispatch: and adjust any references/usages in the test module
or other tests that import or parametrize this class so test discovery and
references remain correct.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: baaa39ea-dad4-42d4-9c0a-b9bf78807b3a
📒 Files selected for processing (107)
.claude/rules/testing-and-examples.mdCMakeLists.txtREADME.mdREADME.zh-CN.mddocs/en/dev/codegen/00-pto_codegen.mddocs/en/dev/codegen/01-cce_codegen.mddocs/en/dev/ir/02-types.mddocs/en/dev/ir/05-operators.mddocs/en/dev/language/00-python_syntax.mddocs/en/dev/passes/00-pass_manager.mddocs/en/dev/passes/01-verifier.mddocs/en/dev/passes/04-init_memref.mddocs/en/dev/passes/05-basic_memory_reuse.mddocs/en/dev/passes/07-allocate_memory_addr.mddocs/en/user/01-language_guide.mddocs/en/user/02-operation_reference.mddocs/zh-cn/dev/codegen/00-pto_codegen.mddocs/zh-cn/dev/codegen/01-cce_codegen.mddocs/zh-cn/dev/ir/02-types.mddocs/zh-cn/dev/ir/05-operators.mddocs/zh-cn/dev/language/00-python_syntax.mddocs/zh-cn/dev/passes/00-pass_manager.mddocs/zh-cn/dev/passes/01-verifier.mddocs/zh-cn/dev/passes/04-init_memref.mddocs/zh-cn/dev/passes/05-basic_memory_reuse.mddocs/zh-cn/dev/passes/07-allocate_memory_addr.mddocs/zh-cn/user/01-language_guide.mddocs/zh-cn/user/02-operation_reference.mdexamples/ir_builder/tile_ops_example.pyexamples/ir_parser/paged_attention_example.pyexamples/ir_parser/paged_attention_with_incore.pyinclude/pypto/codegen/cce/cce_codegen.hinclude/pypto/codegen/cce/code_context.hinclude/pypto/codegen/codegen_base.hinclude/pypto/ir/op_registry.hinclude/pypto/ir/transforms/ir_property.hinclude/pypto/ir/transforms/op_conversion_registry.hinclude/pypto/ir/transforms/pass_properties.hinclude/pypto/ir/transforms/passes.hinclude/pypto/ir/verifier/verifier.hpython/bindings/modules/ir.cpppython/bindings/modules/passes.cpppython/pypto/ir/op/__init__.pypython/pypto/ir/op/tile_ops.pypython/pypto/ir/op_conversion.pypython/pypto/ir/pass_manager.pypython/pypto/language/__init__.pypython/pypto/language/op/__init__.pypython/pypto/language/op/tile_ops.pypython/pypto/language/op/unified_ops.pypython/pypto/language/parser/ast_parser.pypython/pypto/language/typing/__init__.pypython/pypto/language/typing/tile.pypython/pypto/pypto_core/ir.pyipython/pypto/pypto_core/passes.pyireference/README.mdsrc/backend/910B_CCE/backend_910b_cce_ops.cppsrc/backend/910B_PTO/backend_910b_pto_ops.cppsrc/codegen/cce/cce_codegen.cppsrc/codegen/orchestration/orchestration_codegen.cppsrc/ir/op/README.mdsrc/ir/op/tile_ops/batch_matmul.cppsrc/ir/op/tile_ops/broadcast.cppsrc/ir/op/tile_ops/elementwise.cppsrc/ir/op/tile_ops/matmul.cppsrc/ir/op/tile_ops/memory.cppsrc/ir/op/tile_ops/reduction.cppsrc/ir/op/tile_ops/transform.cppsrc/ir/op/tile_ops/unary.cppsrc/ir/transforms/allocate_memory_addr_pass.cppsrc/ir/transforms/basic_memory_reuse_pass.cppsrc/ir/transforms/convert_tensor_to_tile_ops_pass.cppsrc/ir/transforms/init_memref.cppsrc/ir/transforms/insert_sync_pass.cppsrc/ir/transforms/ir_property.cppsrc/ir/transforms/op_conversion_registry.cppsrc/ir/transforms/outline_incore_scopes_pass.cppsrc/ir/transforms/python_printer.cppsrc/ir/verifier/property_verifier_registry.cpptests/st/README.mdtests/st/examples/01_beginner/basic/test_basic_ops.pytests/st/fuzz/README.mdtests/st/fuzz/src/fuzzer.pytests/st/fuzz/src/golden_generator.pytests/st/fuzz/src/kernel_generator.pytests/st/harness/core/harness.pytests/ut/codegen/test_cce_codegen.pytests/ut/codegen/test_pto_codegen.pytests/ut/codegen/test_pto_codegen_ops.pytests/ut/codegen/test_pto_codegen_paged_attn.pytests/ut/ir/memory/test_memref.pytests/ut/ir/operators/test_operation_span_capture.pytests/ut/ir/operators/test_tile_ops.pytests/ut/ir/printing/test_python_printer.pytests/ut/ir/transforms/test_allocate_memory_addr_pass.pytests/ut/ir/transforms/test_basic_memory_reuse.pytests/ut/ir/transforms/test_convert_tensor_to_tile_ops.pytests/ut/ir/transforms/test_flatten_call_expr_pass.pytests/ut/ir/transforms/test_init_memref.pytests/ut/ir/transforms/test_insert_sync.pytests/ut/ir/transforms/test_outline_incore_scopes.pytests/ut/ir/transforms/test_pass_manager.pytests/ut/language/parser/test_closure_var_resolution.pytests/ut/language/parser/test_decorator.pytests/ut/language/parser/test_printer_integration.pytests/ut/language/parser/test_type_resolver.pytests/ut/language/test_unified_ops.py
- Fix "Block operator implementations" → "Tile operator implementations" in docs - Fix "使用块操作" → "使用 tile 操作" in zh-cn pass docs (3 files) - Fix stale "4th argument" comment → "3rd argument" in init_memref.cpp - Remove unsupported `shapes` kwarg from pl.tile.store example in st/README.md - Fix duplicated type: ignore and rename unused loop var `i` → `_i`
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
docs/zh-cn/dev/passes/04-init_memref.md (1)
62-62:⚠️ Potential issue | 🟡 Minor术语仍有残留:请将“块操作转换”改为“tile 操作转换”。
Line 62 仍使用旧术语“块操作转换”,与本次
block→tile全局迁移目标不一致,建议统一为“tile 操作转换”。🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/zh-cn/dev/passes/04-init_memref.md` at line 62, Replace the remaining outdated term "块操作转换" with the new global term "tile 操作转换" in this document (specifically where the phrase appears in the sentence "**变换前**(经过 SSA/块操作转换后):"); update that instance so the line reads "**变换前**(经过 SSA/tile 操作转换后):", ensuring the terminology now matches the `block` → `tile` migration used elsewhere.
🧹 Nitpick comments (1)
docs/en/dev/ir/05-operators.md (1)
257-257: Consider renaming the example function for consistency.The function name
"block_computation"in this TileOp example is inconsistent with the rename. While this is a user-defined string (not an API name), updating it to"tile_computation"would avoid confusion and align the example with the section's focus on tile operations.📝 Optional documentation improvement
-with ib.function("block_computation") as f: +with ib.function("tile_computation") as f:🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/en/dev/ir/05-operators.md` at line 257, Rename the example function string to match the tile-focused section: change the user-defined function name used in the example from "block_computation" to "tile_computation" (the call using ib.function("block_computation") as f should be updated to ib.function("tile_computation") as f) so the example aligns with the TileOp naming and avoids confusion.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@docs/zh-cn/dev/passes/04-init_memref.md`:
- Line 62: Replace the remaining outdated term "块操作转换" with the new global term
"tile 操作转换" in this document (specifically where the phrase appears in the
sentence "**变换前**(经过 SSA/块操作转换后):"); update that instance so the line reads
"**变换前**(经过 SSA/tile 操作转换后):", ensuring the terminology now matches the `block`
→ `tile` migration used elsewhere.
---
Nitpick comments:
In `@docs/en/dev/ir/05-operators.md`:
- Line 257: Rename the example function string to match the tile-focused
section: change the user-defined function name used in the example from
"block_computation" to "tile_computation" (the call using
ib.function("block_computation") as f should be updated to
ib.function("tile_computation") as f) so the example aligns with the TileOp
naming and avoids confusion.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 1cf77a6c-45cb-4b44-b5b1-46f6cf9b2500
📒 Files selected for processing (7)
docs/en/dev/ir/05-operators.mddocs/zh-cn/dev/passes/00-pass_manager.mddocs/zh-cn/dev/passes/01-verifier.mddocs/zh-cn/dev/passes/04-init_memref.mdsrc/ir/transforms/init_memref.cpptests/st/README.mdtests/ut/ir/transforms/test_flatten_call_expr_pass.py
🚧 Files skipped from review as they are similar to previous changes (3)
- docs/zh-cn/dev/passes/01-verifier.md
- src/ir/transforms/init_memref.cpp
- tests/st/README.md
- Fix "块操作转换" → "tile 操作转换" in zh-cn init_memref docs - Rename "block_computation" → "tile_computation" in operator example (en + zh-cn)
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@docs/zh-cn/dev/ir/05-operators.md`:
- Line 380: Update the Chinese header text "块算子实现" to match the English "Tile
operator implementations" by replacing it with a consistent Chinese label such
as "Tile 算子实现" (or "Tile 操作符实现") in the docs/zh-cn/dev/ir/05-operators.md file;
ensure the label sits directly above the referenced path `src/ir/op/tile_ops/`
so the Chinese doc matches the English wording and the actual directory name.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 066df0a8-9515-43d6-8052-22e53887f987
📒 Files selected for processing (3)
docs/en/dev/ir/05-operators.mddocs/zh-cn/dev/ir/05-operators.mddocs/zh-cn/dev/passes/04-init_memref.md
- Fix "块算子实现" → "Tile 算子实现" to match src/ir/op/tile_ops/ path
Summary
Resolves #377. Renames
blocktotileacross the entire codebase to align the IR op names, DSL namespace, and internal identifiers with theTileType/TileExprtype system.BREAKING CHANGE: All
block.*IR op names are nowtile.*. Thepl.blockDSL namespace is removed — usepl.tile.*instead.Changes
REGISTER_OP("block.*")/REGISTER_BACKEND_OP("block.*")→"tile.*"(~90 registrations)DeduceBlock*→DeduceTile*,MakeBlock*→MakeTile*,BlockOp→TileOp,IncoreBlockOps→IncoreTileOps,ConvertTensorToBlockOps→ConvertTensorToTileOpscreate_op_call: All"block.*"→"tile.*"intile_ops.pyblock_ops.py→tile_ops.py,src/ir/op/block_ops/→tile_ops/,convert_tensor_to_block_ops_pass.cpp→convert_tensor_to_tile_ops_pass.cppConvertTensorToBlockOps→ConvertTensorToTileOps(C++ header, binding, type stub, pass manager)pl.blockremoved;pl.tileis the only namespaceblock.→tile.translationget_block_idx: Intentionally kept (domain term for hardware block index)Testing
Related Issues
Closes #377