Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
I think we need to add MemoryEffects DXIL canonicalization to translate from attribute values with more nuance to conservative versions for DXIL serialization - see comment on DXILPrepare.cpp. Otherwise, we could have duplicate attribute sets once these are translated in DXILBitcodeWriter, which would result in bitcode differences between equivalent DXIL IR. In other words, if you round-trip the DXIL output from here, the bitcode would change.
We could use some unit tests for how we sanitize and translate different MemoryEffects combinations as well.
llvm/lib/Target/DirectX/DXILPrepare.cpp | ||
---|---|---|
57 | I think merely allowing this through is insufficient. We should canonicalize the MemoryEffects attribute to a few conservative values for DXIL to avoid duplicate attribute sets once these are translated during serialization. | |
llvm/lib/Target/DirectX/DXILWriter/DXILBitcodeWriter.cpp | ||
942 | If function only reads from arg mem, won't ME.onlyReadsMemory() be true, leading to both attributes: readonly and argmemonly? I think in this case you only want argmemonly. I think instead, we need something like: if (ME.onlyAccessesArgPointees()) { ... } else if (ME.onlyReadsMemory()) { ... } | |
948 | Should we have unit tests to ensure proper translation of different/interesting MemoryEffects combinations? |
llvm/lib/Target/DirectX/DXILWriter/DXILBitcodeWriter.cpp | ||
---|---|---|
942 | Then again, I do see some other case with both these attributes, so maybe this behavior is desirable. |
llvm/lib/Target/DirectX/DXILPrepare.cpp | ||
---|---|---|
57 | Created https://github.com/llvm/llvm-project/issues/58950 to track this. | |
llvm/lib/Target/DirectX/DXILWriter/DXILBitcodeWriter.cpp | ||
942 | It is OK for a function has both readnone argmemonly attribute. | |
948 | We could always add tests. |
I think merely allowing this through is insufficient. We should canonicalize the MemoryEffects attribute to a few conservative values for DXIL to avoid duplicate attribute sets once these are translated during serialization.