Skip to content

Migrate LayoutTensor to TileTensor#238

Merged
dunnoconnor merged 10 commits intomainfrom
mdoc/tiletensor
Apr 14, 2026
Merged

Migrate LayoutTensor to TileTensor#238
dunnoconnor merged 10 commits intomainfrom
mdoc/tiletensor

Conversation

@dunnoconnor
Copy link
Copy Markdown
Member

@dunnoconnor dunnoconnor commented Apr 8, 2026

Migrate from LayoutTensor to TileTensor

This PR replaces all uses of the deprecated LayoutTensor API with TileTensor across problems, solutions, and documentation.

Code changes

  • All problem files (p05–p34) and solution files: Replaced LayoutTensor with TileTensor throughout. Updated imports, type annotations, stack_allocation calls, and copy_dram_to_sram_async usages.
  • Deleted separate _layout_tensor.mojo files for p05, p07, p08, p11, p12 (in both problems/ and solutions/). Their content has been consolidated into the single p.mojo file for each puzzle (two-approach format: UnsafePointer + TileTensor).
  • Renamed p04_layout_tensor.mojo → p04_tile_tensor.mojo in both problems/p04/ and solutions/p04/.

Tests

  • Added tests/canary_tile_tensor.mojo (266 lines): validates the full TileTensor API surface needed for the migration — basic indexing, shared memory via stack_allocation, async DRAM→SRAM copy, 2D indexing, and MutAnyOrigin/ImmutAnyOrigin origins.
  • Added tests/test_origin_fix.mojo (26 lines): targeted test for origin tracking correctness.

Documentation (English + Korean)

  • Renamed introduction_layout_tensor.md → introduction_tile_tensor.md and layout_tensor_preview.md → tile_tensor_preview.md in puzzle_04 docs.
  • Renamed layout_tensor.md → tile_tensor.md in puzzle_04.
  • For puzzles 05, 07, 08, 11, 12: merged content from separate layout_tensor.md and raw.md files into the main puzzle_XX.md, then deleted the now-redundant files.
  • Updated all remaining doc files to reference TileTensor instead of LayoutTensor.
  • Updated SUMMARY.md (English + Korean) to reflect renamed doc files.

pixi.toml

  • Renamed p04_layout_tensor task → p04_tile_tensor; layout_tensor_intro → tile_tensor_intro.
  • Removed p05_layout_tensor, p07_layout_tensor, p08_layout_tensor, p11_layout_tensor, p12_layout_tensor tasks (files deleted).

@dunnoconnor dunnoconnor marked this pull request as ready for review April 8, 2026 20:45
@GzuPark
Copy link
Copy Markdown
Contributor

GzuPark commented Apr 9, 2026

I didn't build the docs locally to check the Korean files. I only read the diff on GitHub, and the expressions looked fine to me.

I will also check how the original content has changed and review it again later. If I find anything that needs to be fixed, I will open a new PR.

Thank you for updating the Korean version together! 😄


Implement a kernel that broadcast adds vector `a` and vector `b` and stores it in 2D matrix `output`.

**Broadcasting** in parallel programming refers to the operation where lower-dimensional arrays are automatically expanded to match the shape of higher-dimensional arrays during element-wise operations. Instead of physically replicating data in memory, values are logically repeated across the additional dimensions. For example, adding a 1D vector to each row (or column) of a 2D matrix applies the same vector elements repeatedly without creating multiple copies.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In switching to the TileTensor-primary file here, this drops the intro and broadcasting definition that we had in the previous non-TileTensor document. Should those be re-added into the TileTensor one to provide the intro content here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good catch! Pushed a few commits to resolve this and your other comments.

BradLarson
BradLarson previously approved these changes Apr 14, 2026
@dunnoconnor dunnoconnor requested review from BradLarson and removed request for ehsanmok April 14, 2026 19:57
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sorry, this might also be another file left over from debugging during migration.

BradLarson
BradLarson previously approved these changes Apr 14, 2026
@dunnoconnor dunnoconnor merged commit 19dfa37 into main Apr 14, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants