@@ -255,44 +255,13 @@ module ClArray =
255255
256256 bitmap
257257
258- let setPositions ( clContext : ClContext ) =
259-
260- let setPositions =
261- <@ fun ( ndRange : Range1D ) ( inputArray : ClArray < int >) inputLength ( positions : ClArray < int >) ( outputArray : ClArray < int >) ->
262-
263- let i = ndRange.GlobalID0
264-
265- if i < inputLength then
266- outputArray.[ positions.[ i]] <- inputArray.[ i] @>
267-
268- let kernel = clContext.Compile( setPositions)
269-
270- fun ( processor : MailboxProcessor < _ >) workGroupSize ( inputArray : ClArray < 'a >) ( positions : ClArray < int >) ( outputArraySize : int ) ->
271-
272- let ndRange =
273- Range1D.CreateValid( inputArray.Length, workGroupSize)
274-
275- let outputArray =
276- clContext.CreateClArrayWithGPUOnlyFlags outputArraySize
277-
278- let kernel = kernel.GetKernel()
279-
280- processor.Post(
281- Msg.MsgSetArguments
282- ( fun () -> kernel.KernelFunc ndRange inputArray inputArray.Length positions outputArray)
283- )
284-
285- processor.Post( Msg.CreateRunMsg<_, _> kernel)
286-
287- outputArray
288-
289258 ///<description >Remove duplicates form the given array.</description >
290259 ///<param name =" clContext " >Computational context</param >
291260 ///<param name =" workGroupSize " >Should be a power of 2 and greater than 1.</param >
292261 ///<param name =" inputArray " >Should be sorted.</param >
293262 let removeDuplications ( clContext : ClContext ) workGroupSize =
294263
295- let setPositions = setPositions clContext
264+ let scatter = Scatter.runInplace clContext workGroupSize
296265 let getUniqueBitmap = getUniqueBitmap clContext
297266
298267 let prefixSumExclude =
@@ -318,6 +287,8 @@ module ClArray =
318287 a.[ 0 ]
319288
320289 let outputArray =
321- setPositions processor workGroupSize inputArray positions resultLength
290+ clContext.CreateClArrayWithGPUOnlyFlags resultLength
291+
292+ scatter processor positions inputArray outputArray
322293
323294 outputArray
0 commit comments