Issue 174629
Summary [HLSL] Matrix need to update indexed elements individually to address data race potential
Labels HLSL
Assignees
Reporter farzonl
    Similar to vectors https://github.com/llvm/llvm-project/pull/169144 matrix types need to be handled as a store operation on that one matrix element.

Clang treats matrix the same as vectos ie as one unit, so a matrix element needs to be updated, the whole matrix is loaded as a flattened llvm vector, the element is modified, and then the whole matrix is stored as back to the flattened llvm vector. In HLSL matrix elements are handled individually. We need to avoid this load/modify/store sequence to prevent overwriting other vector elements that might be getting updated in parallel.

Follow on tickets to the offload test suites will also be needed that can be modeled after these tests:
- https://github.com/llvm/offload-test-suite/blob/main/test/WaveOps/ComponentDataRace.test
- https://github.com/llvm/offload-test-suite/blob/main/test/WaveOps/ComponentAccumulationDataRace.test

For more info on the data race see:
- https://github.com/llvm/llvm-project/issues/167729
- https://github.com/llvm/llvm-project/issues/160208
- https://hlsl.godbolt.org/z/1x4MevTrE
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to