Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lgc: add dialect GroupMemcpyOp #2802

Merged
merged 1 commit into from
Nov 8, 2023
Merged

lgc: add dialect GroupMemcpyOp #2802

merged 1 commit into from
Nov 8, 2023

Conversation

xazhangAMD
Copy link
Contributor

No description provided.

@xazhangAMD xazhangAMD requested a review from a team as a code owner November 7, 2023 21:18
@amdvlk-admin
Copy link

Test summary for commit da88fdc

CTS tests (Failed: 0/138184)
  • Built with version 1.3.5.2
  • Ubuntu navi3x, Srdcvk
    • Passed: 35162/69058 (50.9%)
    • Failed: 0/69058 (0.0%)
    • Not Supported: 33896/69058 (49.1%)
    • Warnings: 0/69058 (0.0%)
    Ubuntu navi2x, Srdcvk
    • Passed: 35242/69126 (51.0%)
    • Failed: 0/69126 (0.0%)
    • Not Supported: 33884/69126 (49.0%)
    • Warnings: 0/69126 (0.0%)

@xazhangAMD xazhangAMD merged commit 8e7a79b into dev Nov 8, 2023
lgc/patch/PatchEntryPointMutate.cpp Show resolved Hide resolved
lgc/patch/PatchEntryPointMutate.cpp Show resolved Hide resolved
lgc/patch/PatchEntryPointMutate.cpp Show resolved Hide resolved

// =====================================================================================================================
// Lower GroupMemcpyOp - Copy memory using threads in a workgroup (scope=2) or subgroup (scope=3).
void PatchEntryPointMutate::lowerGroupMemcpy(GroupMemcpyOp &groupMemcpyOp) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think it is a good idea to place the handling of group memcpy here because the pass is aimed to handle entry-point mutation. Other responsibilities should be moved to other passes or even creating a new pass according to LLVM design philosophy.

The handling of task/mesh shader could be put in MeshTaskShader.cpp. For CS, many operations are straightforward, if possible, maybe we can place it on InOutBuilder since readCsBuiltIn() can read back any CS built-in so you can do anything you want. This is true for task shader as well and share the handling. If that is impossible, we can move the handling of CS to PatchInOutImportExport.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had a similar thought in the internal review - split the op into 2: one for task/mesh and another for compute.

Copy link
Contributor

Choose a reason for hiding this comment

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

You can check shader stage when lowering this op so we can differentiate its usages in task/mesh shader or in compute shader. If you decide to make two dedicated ops, that is fine as well.

I discussed this with Ruiling, we both believe the lowering of this op is better to be moved to other appropriate passes other than this pass. Also, if you can share us with a LGC file (.lgc generated by frontend with the option --emit-lgc) showing the usage of this op we can better evaluate your future refactoring change in the review.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is natural to handle task/mesh shader in MeshTaskShader.cpp but for CS, it is also weird to place the code in InOutBuilder or PatchInOutImportExport. Actually my only intent is to use this for task shader only. The llpcfe standalone tool doesn't seem to support -emit-lgc but the dump should have all the information you need.

I modified code in a commit here.

And a pipeline dump attached.
PipelineTaskMesh_0xB812ED624A368A8F.txt

Copy link
Contributor

@amdrexu amdrexu Nov 10, 2023

Choose a reason for hiding this comment

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

Thank you. I see the usage. Your requirement is similar to the usage of PatchInitializeWorkgroupMemory::initializeWithZero. We add a new pass to handle this. Anyway, it is fine to keep CS handling in entry-point mutation as a temporary solution and move the handling of task/mesh shader to MeshTaskShader class. I plan to rework the pass PatchInitializeWorkgroupMemory and try to enable the usage for your case in the near future.

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.

4 participants