Skip to content

fix(emitc): remove alloc_tile(addr) dynamic rewrap double TASSIGN#406

Open
TaoTao-real wants to merge 1 commit intohw-native-sys:mainfrom
TaoTao-real:codex/fix-alloc-tile-double-tassign
Open

fix(emitc): remove alloc_tile(addr) dynamic rewrap double TASSIGN#406
TaoTao-real wants to merge 1 commit intohw-native-sys:mainfrom
TaoTao-real:codex/fix-alloc-tile-double-tassign

Conversation

@TaoTao-real
Copy link
Copy Markdown
Contributor

Summary

  • fix redundant tile rewrap for alloc_tile addr=... with dynamic valid shape
  • lower this path directly to pto.pointer_cast instead of pointer_cast + bind_tile
  • add lit regression to prevent double TASSIGN / .data() bridge reappearing

Root cause

  • Stage 0.5 in PTOViewToMemref wrapped explicit-address alloc as pointer_cast + bind_tile.
  • In EmitC, dynamic valid-shape bind_tile uses constructor-based tile materialization and misses the existing no-rewrap fast path, producing a second tile plus TASSIGN(new, old.data()).

Fix

  • For explicit-address alloc_tile, keep only pto.pointer_cast (with __pto.force_dynamic_valid_shape preserved).
  • This removes the redundant bind_tile layer and avoids the extra rewrap chain.

Tests

  • build/tools/ptoas/ptoas --pto-level=level3 test/basic/alloc_tile_addr_dynamic_no_rebind.pto | FileCheck test/basic/alloc_tile_addr_dynamic_no_rebind.pto
  • build/tools/ptoas/ptoas test/basic/tprint_alloc_tile_no_rebind.pto | FileCheck test/basic/tprint_alloc_tile_no_rebind.pto
  • Repro kernel from pypto commit 9f72fef (build/kernel.pto): generated C++ no longer contains .data() / reinterpret_cast<uint64_t>(tile.data()) bridge and each logical tile has a single TASSIGN.

@reedhecre
Copy link
Copy Markdown

Codex Review

该评论由 review 机器人自动更新。

Summary

未检查到 PR #406 存在问题

Findings

No issues found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

3 participants