Skip to content

REFACTOR: tiler reads VariableBuffer.alias_of instead of legacy _alias - #203

Open
mert-ogul wants to merge 1 commit into
pulp-platform:develfrom
mert-ogul:refactor/tiler-alias-of-201
Open

REFACTOR: tiler reads VariableBuffer.alias_of instead of legacy _alias#203
mert-ogul wants to merge 1 commit into
pulp-platform:develfrom
mert-ogul:refactor/tiler-alias-of-201

Conversation

@mert-ogul

Copy link
Copy Markdown

Wire TilerExtension, MemoryScheduler, and dealiasBuffer to directed alias_of so Reshape no longer needs the _alias workaround. Fixes #201 (duplicate of #130).

Describe the intent of your PR here.

Added

  • VariableBuffer.alias_of: Set[str] for directed storage-parent edges used by tiling.
  • Regression test testDealiasBufferUsesAliasOf in DeeployTest/testTypes.py.

Changed

  • NetworkContext.dealiasBuffer, TilerExtension, and MemoryScheduler read alias_of instead of legacy _alias.
  • Generic ReshapeTemplate sets bufferOut.alias_of (keeps bidirectional aliases for liveness).
  • Scheduling collision check in testSchedulingExtension.py uses alias_of.
  • CHANGELOG.md updated under Unreleased.

Fixed

  • Tiler no longer depends on the ad-hoc _alias attribute that templates had to set as a workaround.

Removed

  • Legacy _alias workaround from Generic/PULPOpen ReshapeTemplate.

PR Merge Checklist

  1. The PR is rebased on the latest devel commit and pointing to devel.
  2. Your PR reviewed and approved.
  3. All checks are passing.
  4. The CHANGELOG.md file has been updated.
  5. If the docker was modified, change back its link after review.

Wire TilerExtension, MemoryScheduler, and dealiasBuffer to directed
alias_of so Reshape no longer needs the _alias workaround. Fixes pulp-platform#201.
@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes

    • Improved buffer alias tracking across reshaping, tiling, scheduling, and memory allocation.
    • Added support for buffers with multiple parent aliases and multi-level alias chains.
    • Made alias resolution deterministic, improving consistency in memory planning and de-aliasing.
  • Tests

    • Added regression coverage for directed and multi-level buffer alias relationships.
  • Documentation

    • Updated the changelog to reflect the improved alias handling.

Walkthrough

The change replaces legacy _alias handling with directed, multi-valued alias_of relationships. Buffer dealiasing, reshape templates, tiling, memory scheduling, collision checks, and regression tests now use the new relationship.

Changes

Directed alias ancestry

Layer / File(s) Summary
Alias contract and reshape wiring
Deeploy/DeeployTypes.py, Deeploy/Targets/*/Templates/ReshapeTemplate.py, DeeployTest/testTypes.py, CHANGELOG.md
VariableBuffer stores alias_of parents. NetworkContext.dealiasBuffer follows sorted parent relationships. Generic reshape alignment records directed ancestry, while the PULPOpen override is removed. Tests cover direct and chained dealiasing.
Tiling and scheduling alias handling
Deeploy/TilingExtension/MemoryScheduler.py, Deeploy/TilingExtension/TilerExtension.py, DeeployTest/testSchedulingExtension.py
Memory scheduling, static conversion, and collision checks process all alias_of relationships. Parent selection is deterministic when multiple parents are present.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related issues

Possibly related PRs

  • pulp-platform/Deeploy#125: Both changes modify alias tracking and reshape alias relationships, with this change adding directed ancestry.

Suggested reviewers: xeratec

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR replaces _alias with alias_of, but issue #201 explicitly requires TilerExtension and MemoryScheduler to consume buffer.aliases. Confirm whether #201 should target alias_of; otherwise update TilerExtension and MemoryScheduler to consume buffer.aliases as specified by the issue.
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main refactor from legacy _alias to VariableBuffer.alias_of.
Description check ✅ Passed The description directly explains the alias refactor, affected components, removed workaround, regression test, and changelog update.
Out of Scope Changes check ✅ Passed The changes remain within the issue scope: alias handling, reshape workaround removal, scheduling updates, tests, and changelog documentation.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@Deeploy/DeeployTypes.py`:
- Around line 570-576: Define a canonical storage-root resolution rule across
all alias consumers: in Deeploy/DeeployTypes.py lines 570-576, update the
alias-resolution logic to traverse all parent paths and accept only one
canonical root or reject conflicting roots; in
Deeploy/TilingExtension/MemoryScheduler.py lines 658-661, use that canonical
parent or verify all eligible parents share its address; in
Deeploy/TilingExtension/TilerExtension.py lines 337-345, resolve the parent
selected by the current pattern rather than choosing an unrelated lexicographic
parent; and in DeeployTest/testTypes.py lines 227-252, add coverage where the
in-pattern parent is not lexicographically first.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a4e067bc-d689-49fe-8eb4-ad2fda7b0fce

📥 Commits

Reviewing files that changed from the base of the PR and between bf64cfa and 7b1b741.

📒 Files selected for processing (8)
  • CHANGELOG.md
  • Deeploy/DeeployTypes.py
  • Deeploy/Targets/Generic/Templates/ReshapeTemplate.py
  • Deeploy/Targets/PULPOpen/Templates/ReshapeTemplate.py
  • Deeploy/TilingExtension/MemoryScheduler.py
  • Deeploy/TilingExtension/TilerExtension.py
  • DeeployTest/testSchedulingExtension.py
  • DeeployTest/testTypes.py
💤 Files with no reviewable changes (1)
  • Deeploy/Targets/PULPOpen/Templates/ReshapeTemplate.py

Comment thread Deeploy/DeeployTypes.py
Comment on lines +570 to +576
while alias.alias_of:
seenAliases.add(alias.name)
alias = self.lookup(alias._alias)
# Reshape and other current aliasers have a single storage parent.
# Pick a deterministic parent if multiple are ever present.
parentName = sorted(alias.alias_of)[0]
alias = self.lookup(parentName)
assert isinstance(alias, VariableBuffer)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Define one valid storage resolution rule for multi-parent aliases.

alias_of now permits multiple parents, but these consumers select a parent by name order. This can assign an arbitrary address. In Deeploy/TilingExtension/TilerExtension.py, an in-pattern parent can satisfy line 340 while dealiasBuffer() selects another root that is absent from nodeList; line 345 then fails.

  • Deeploy/DeeployTypes.py#L570-L576: resolve all parent paths and require one canonical storage root, or reject conflicting roots.
  • Deeploy/TilingExtension/MemoryScheduler.py#L658-L661: use the canonical storage parent or verify that all eligible parents have the same address.
  • Deeploy/TilingExtension/TilerExtension.py#L337-L345: resolve the parent selected from the current pattern instead of an unrelated lexicographic parent.
  • DeeployTest/testTypes.py#L227-L252: add a multi-parent case where the in-pattern parent is not the lexicographically first parent.
📍 Affects 4 files
  • Deeploy/DeeployTypes.py#L570-L576 (this comment)
  • Deeploy/TilingExtension/MemoryScheduler.py#L658-L661
  • Deeploy/TilingExtension/TilerExtension.py#L337-L345
  • DeeployTest/testTypes.py#L227-L252
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Deeploy/DeeployTypes.py` around lines 570 - 576, Define a canonical
storage-root resolution rule across all alias consumers: in
Deeploy/DeeployTypes.py lines 570-576, update the alias-resolution logic to
traverse all parent paths and accept only one canonical root or reject
conflicting roots; in Deeploy/TilingExtension/MemoryScheduler.py lines 658-661,
use that canonical parent or verify all eligible parents share its address; in
Deeploy/TilingExtension/TilerExtension.py lines 337-345, resolve the parent
selected by the current pattern rather than choosing an unrelated lexicographic
parent; and in DeeployTest/testTypes.py lines 227-252, add coverage where the
in-pattern parent is not lexicographically first.

@Victor-Jung Victor-Jung added the Refactor Changes or improvements to existing features label Aug 14, 2026
@Victor-Jung Victor-Jung added this to the Release 0.2.2 milestone Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Refactor Changes or improvements to existing features

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

[Refactor] Tiler: read the multi-valued aliases set instead of the legacy _alias

2 participants