Skip to content

fix(bindings): accept a default TileView offset - #2491

Draft
high-cloud wants to merge 1 commit into
hw-native-sys:mainfrom
high-cloud:fix-tile-view-default-constructor
Draft

fix(bindings): accept a default TileView offset#2491
high-cloud wants to merge 1 commit into
hw-native-sys:mainfrom
high-cloud:fix-tile-view-default-constructor

Conversation

@high-cloud

Copy link
Copy Markdown
Contributor

Summary

Make the nanobind TileView constructor handle its default/optional start offset without an ambiguous conversion.

Current PyPTO main exposes an ExprPtr constructor with None as the default argument. With the wheel build used by pypto-serving NPU CI, evaluating ir.TileView() fails in _implicit_tile_view_defaults with an incompatible-constructor TypeError. Model compilation then aborts and the Serving worker reports zero KV cache blocks.

  • Bind the true C++ default constructor explicitly.
  • Accept a Python object for start_offset, map None to a null ExprPtr, and otherwise cast it to ExprPtr before placement construction.
  • Preserve the existing integer-shape constructor and all public defaults.

Observed downstream failure: hw-native-sys/pypto-serving#180 unit-tests. This PR is independent of the full-rank dispatch work in #2490.

Verification

  • Rebuilt the PyPTO extension with this patch.
  • tests/ut/language/parser/test_type_resolver.py
  • tests/ut/ir/core/test_tile_view_equality.py
  • tests/ut/ir/test_tensor_view_semantics.py

Result: 243 passed.

@coderabbitai

coderabbitai Bot commented Aug 23, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a5d93119-21fa-4e96-bdac-cb7b81cbd439

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

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

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant