Mark SetMeshOutputCounts as noduplicate#8438
Conversation
The SetMeshOutputCounts function can only appear once in generated DXIL, so it should not be legal for the compiler to duplicate the function through any optimization pass. In the reproduction case attached to the issue, the JumpThreading pass duplicates calls to SetMeshOutputCounts, this can be prevented by marking the HL and DXIL operations with noduplicate, which is a trivial change. Fixes microsoft#8104
|
@tex3d, can you confirm my understanding that the |
Yes, it's a valid attribute, however it will change the function signature for existing DXIL consumers, which would be a problem I think. We could potentially mitigate that by stripping the attribute at the end during the But this might run into further internal conflicts (when loaded by a different version), since the DxilOperation system isn't designed to handle ops that may be defined in two different ways like this. Is the attribute on the HL op sufficient to prevent DXC from introducing the problem? Or is it required on the DXIL op as well? I see that we run the JumpThreading pass on HL code, not DXIL, so it seems like it should be, however your JumpThreading test is run on the DXIL op instead. My recommended fix is to only add it to the HL op, test the HL op instead of the DXIL op for the JumpThreading pass, and we can note this limitation (that the DXIL op lacks the attribute) for our output. We could probably rev the OP to add the attribute somehow in the future, but I think that will require some more careful changes and testing work. |
The SetMeshOutputCounts function can only appear once in generated DXIL, so it should not be legal for the compiler to duplicate the function through any optimization pass.
In the reproduction case attached to the issue, the JumpThreading pass duplicates calls to SetMeshOutputCounts, this can be prevented by marking the HL and DXIL operations with noduplicate, which is a trivial change.
Fixes #8104