Skip to content

Dedupe Dataset/Model/Tensor method+field blocks in tensorflow.xml #551

@khatchad

Description

@khatchad

Motivation

tensorflow.xml currently models per-instance method dispatch and field attachment by duplicating the entire method/putfield block at every allocation site. Examples:

  • Dataset method blocks (18 endpoints — from_tensor_slices.do, shuffle.do, batch.do, etc.) each repeat the full set of <putfield>s attaching method-name → callable bindings. Audit in Audit dataset-method field-duplication in tensorflow.xml — comment cites 1-CFA but engine uses 2-CFA #549 confirmed the duplication is structurally load-bearing: stripping shuffle.do's block caused 19 test failures.
  • Model allocations similarly repeat method-attachment blocks across multiple endpoints.
  • If a future migration moves set_shape recognition into tensorflow.xml (filed separately as wala/ML#NNN), it would either replicate the pattern or require a class-method <method> declaration that the WALA Python frontend dispatches via virtual lookup (works today, per empirical probe 2026-05-26).

Goal

Eliminate the duplication by declaring instance methods and instance fields ONCE on a base class, and propagating them to subclass allocations via WALA's class-hierarchy mechanism.

Pre-Conditions

Both are open. This issue is the natural consumer of those fixes.

Out of Scope

This issue is the cleanup counterpart of the underlying frontend fixes — not the frontend fixes themselves. #118 + #107 land in WALA / cast.python first; then this issue's dedup work follows.

Verification

Tests must still pass after dedup (mvn test from root). The audit recipe from #549 (strip one block, count failures) is a reasonable canary while migrating.

Related

Metadata

Metadata

Assignees

No one assigned

    Type

    No fields configured for Task.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions