[Mlir-commits] [mlir] [mlir][amdgpu] Promote gpu.shuffle to amdgpu.dpp (PR #155158)

Tim Gymnich llvmlistbot at llvm.org
Tue Nov 11 06:55:40 PST 2025


tgymnich wrote:

As of now this is not ready to merge yet. I'll still need to figure the `isValid` field out.
Currently something like this would return:
```mlir
module attributes {gpu.container_module} {
gpu.module @gpu_butterfly_shuffle {
  gpu.func @gpu_butterfly_shuffle(%input: memref<64xf32>, %output: memref<64xf32>) kernel {
    %tid = gpu.thread_id x
    %c1 = arith.constant 1 : i32
    %c2 = arith.constant 16: i32
    %c3 = arith.constant -1.0 : f32
    %arg0 = memref.load %input[%tid] : memref<64xf32>
    %shfl, %pred = gpu.shuffle up %arg0, %c1, %c2 : f32
    %sel = arith.select %pred, %shfl, %c3 : f32
    memref.store %sel, %output[%tid] : memref<64xf32>
    gpu.return
  }
}
}
```

```python
# in:
arange(64)
# out:
[63.  0.  1.  2.  3.  4.  5.  6.  7.  8.  9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49. 50. 51. 52. 53. 54. 55. 56. 57. 58. 59. 60. 61. 62.]
```

While I would expect this to return `[-1, 0, 1, 2, ... ,16, -1, ..., -1]`

https://github.com/llvm/llvm-project/pull/155158


More information about the Mlir-commits mailing list