@@ -56,55 +56,6 @@ module SubSum =
5656
5757 step <- step >>> 1 @>
5858
59- let upSweepByKey opAdd =
60- <@ fun wgSize lid ( localBuffer : 'a []) ( localKeys : 'b []) ->
61- let mutable step = 2
62-
63- while step <= wgSize do
64- let i = step * ( lid + 1 ) - 1
65-
66- let firstIndex = i - ( step >>> 1 ) // TODO(work ?)
67- let secondIndex = i
68-
69- let firstKey = localKeys.[ firstIndex]
70- let secondKey = localKeys.[ secondIndex]
71-
72- if lid < wgSize / step && firstKey = secondKey then
73-
74- let firstValue = localBuffer.[ firstIndex]
75- let secondValue = localBuffer.[ secondIndex]
76-
77- localBuffer.[ secondIndex] <- (% opAdd) firstValue secondValue
78-
79- step <- step <<< 1
80-
81- barrierLocal () @>
82-
83- let downSweepByKey opAdd =
84- <@ fun wgSize lid ( localBuffer : 'a []) ( localKeys : int []) ->
85- let mutable step = wgSize
86-
87- while step > 1 do
88- barrierLocal ()
89-
90- let rightIndex = step * ( lid + 1 ) - 1
91- let leftIndex = rightIndex - ( step >>> 1 )
92-
93- let rightKey = localKeys.[ rightIndex]
94- let leftKey = localKeys.[ leftIndex]
95-
96- if lid < wgSize / step && rightKey = leftKey then
97-
98- let tmp = localBuffer.[ rightIndex]
99-
100- let rightOperand = localBuffer.[ leftIndex] // Brahma error
101- let buff = (% opAdd) tmp rightOperand
102-
103- localBuffer.[ rightIndex] <- buff
104- localBuffer.[ leftIndex] <- tmp
105-
106- step <- step >>> 1 @>
107-
10859 let localPrefixSum opAdd =
10960 <@ fun ( lid : int ) ( workGroupSize : int ) ( array : 'a []) ->
11061 let mutable offset = 1
0 commit comments