Open thumbe3 opened 2 months ago
I have created a WIP patch https://github.com/lijinpei/triton/commit/3fe20ba894bba0e142e2b9f4a24b75df5ddfd194 which solves the provided script.py and fail no case in python/test/unit/language/test_core.py
(except 'python/test/unit/language/test_core.py::test_dot[1-128-128-64-4-False-False-chain-dot-ieee-float8e5-float32-1]' already failed on main branch on my machine).
Can you try the patch on 'correctness issues with other kernels using similar combination tl.sum with tl.min', or help to provide it as a unit test? I think gate keepers won't accept the patch without a unit test.
We likely won't accept your solution even with a unit test. I don't see correctness issues.
But I have faced correctness issues with other kernels using similar combination tl.sum with tl.min
Since having data races in this specific case doesn't cause correctness problems for you IIUC, it might be better to provide your code with real issues.
Data races could be triggered by having the same location being accessed by multiple threads with the same value, which is fine in Triton.
Out of curiosity I profiled the repro before and after the change I do see a small (~1%) speedup that reproduces consistently.
Out of curiosity I profiled the repro before and after the change I do see a small (~1%) speedup that reproduces consistently.
I think we need to run internal regression benchmarks instead of external ones
In the above code, I try to find the distance between each element of input with 32 coordinates. And return the coordinate with minimum distance to each input(Might be more easier to understand from the numpy code below). When you run this code with race-check tool of compute-sanitizer using
(compute-sanitizer --tool=racecheck python script.py)
. The following output is shown========= Error: Race reported between Write access at compute_min_distance_coord+0x5ad20 in /usr/local/lib/python3.10/dist-packages/triton/language/standard.py:237 ========= and Write access at compute_min_distance_coord+0x5ad20 in /usr/local/lib/python3.10/dist-packages/triton/language/standard.py:237 [6136 hazards]
Error seems to be stemming standard.py which seems to be in the min function
I am not facing correctness issue with this code at the moment. But I have faced correctness issues with other kernels using similar combination tl.sum with tl.min