Skip to content

[BACKEND] Convert layout illegal mem access fix#2287

Merged
ptillet merged 8 commits intomainfrom
zahi/convert-layout-bug
Sep 13, 2023
Merged

[BACKEND] Convert layout illegal mem access fix#2287
ptillet merged 8 commits intomainfrom
zahi/convert-layout-bug

Conversation

@zahimoud
Copy link
Copy Markdown
Contributor

No description provided.

@github-actions
Copy link
Copy Markdown

⚠️ This PR does not produce bitwise identical kernels as the branch it's merged against. Please check artifacts for details. Download the output file here.

@github-actions
Copy link
Copy Markdown

⚠️ This PR does not produce bitwise identical kernels as the branch it's merged against. Please check artifacts for details. Download the output file here.

@zahimoud zahimoud marked this pull request as ready for review September 13, 2023 00:44
@github-actions
Copy link
Copy Markdown

⚠️ This PR does not produce bitwise identical kernels as the branch it's merged against. Please check artifacts for details. Download the output file here.

// Order
auto inOrder = triton::gpu::getOrder(srcEncoding);
auto outOrder = triton::gpu::getOrder(resSharedLayout);
assert(outVec * (maxPhase - 1) <= srcShape[outOrder[0]] &&
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.

How this formula is derived?

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.

Seems to me outVec * maxPhase makes more sense? Just curious

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

There's only phases 0, 1, ... maxPhase - 1, if each one increments by vec, then the largest address is vec * (maxPhase - 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.

The largest address would be vec * maxPhase - 1 ? I meant the largest starting addresses is vec * (maxPhase - 1) , but we actually have accessed addresses until vec * maxPhase

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That's right, I was trying to get away from cases where we have outVec > 1, maxPhase = 1 and srcShape[outOrder[0]] = 1. In that case, we only use address range [0, 1], regardless of what outVec is, since we don't really swizzle. Maybe that case should also be illegal, even though in practice the code just works since we don't swizzle.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

So the condition should be maxPhase == 1 || vec * maxPhase <= srcShape[outOrder[0]], what do you think ?

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.

I see. LGTM

@ptillet ptillet merged commit e95e1f1 into main Sep 13, 2023
@ptillet ptillet deleted the zahi/convert-layout-bug branch September 13, 2023 17:02
Stonepia added a commit to intel/intel-xpu-backend-for-triton that referenced this pull request Sep 18, 2023
Stonepia added a commit to intel/intel-xpu-backend-for-triton that referenced this pull request Sep 20, 2023
* Unify slow/fast reduce codegen
This aligns with the upstream changes in triton-lang/triton#2220

* Rebase from upstream #2287

triton-lang/triton#2287

* Port from (#2292)
triton-lang/triton#2292

* Fix the JIT error when the signature is empty

* Fix the issue where threadsPerWarp Logic changed

* Delete unused code

* Update expected failure case

* Update Triton Commit
alexander-zinoviev pushed a commit to alexander-zinoviev/triton that referenced this pull request Sep 21, 2023
pingzhuu pushed a commit to siliconflow/triton that referenced this pull request Apr 2, 2024
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