Skip to content

[Pallas] Separate memory analysis from TensorCore lowering - #3252

Merged
thcmbs merged 1 commit into
mainfrom
gh/thcmbs/4/head
Aug 4, 2026
Merged

[Pallas] Separate memory analysis from TensorCore lowering#3252
thcmbs merged 1 commit into
mainfrom
gh/thcmbs/4/head

Conversation

@thcmbs

@thcmbs thcmbs commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

Stack from ghstack (oldest at bottom):


plan_tiling previously turned tensor-indexed operations directly into TensorCore gather/scatter patterns. This mixed shared indexing analysis with a target-specific implementation and makes the result difficult to reuse for other Pallas targets (sparsecore).

This PR separates the two:

  • MemoryAccess records the operation, tensor, subscript and indexing patterns.
  • TensorCore selects a separate TensorCorePlan after tiling analysis.
  • Codegen emits the selected plan instead of finding TensorCore objects inside indexing patterns.

Comment thread test/test_pallas_memory_access.py Outdated
assert isinstance(scatter, OneHotScatterPlan)
assert gather.plan is gather_fallback
assert scatter.plan is scatter_fallback
assert all(isinstance(pattern, TensorIndexPattern) for pattern in patterns[:1])

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.

This line is very convoluted. Suggested to simplify.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done.

stack-info: PR: #3252, branch: gh/thcmbs/4/head
@thcmbs
thcmbs force-pushed the gh/thcmbs/4/head branch from 6922477 to 0d9c7c7 Compare August 4, 2026 14:55
@thcmbs
thcmbs changed the base branch from gh/thcmbs/4/base to main August 4, 2026 14:55
@thcmbs
thcmbs merged commit 13e6d6a into main Aug 4, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants