-
Notifications
You must be signed in to change notification settings - Fork 116
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
Conversation
Test summary for commit da88fdcCTS tests (Failed: 0/138184)
Ubuntu navi3x, SrdcvkUbuntu navi2x, Srdcvk |
|
||
// ===================================================================================================================== | ||
// Lower GroupMemcpyOp - Copy memory using threads in a workgroup (scope=2) or subgroup (scope=3). | ||
void PatchEntryPointMutate::lowerGroupMemcpy(GroupMemcpyOp &groupMemcpyOp) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
No description provided.