@@ -168,13 +168,15 @@ module ClArray =
168168 let getUniqueBitmapFirstOccurrence clContext =
169169 getUniqueBitmapGeneral
170170 <| <@ fun ( gid : int ) ( _ : int ) ( inputArray : ClArray < 'a >) ->
171- gid = 0 || inputArray.[ gid - 1 ] <> inputArray.[ gid] @>
171+ gid = 0
172+ || inputArray.[ gid - 1 ] <> inputArray.[ gid] @>
172173 <| clContext
173174
174175 let getUniqueBitmapLastOccurrence clContext =
175176 getUniqueBitmapGeneral
176177 <| <@ fun ( gid : int ) ( length : int ) ( inputArray : ClArray < 'a >) ->
177- gid = length - 1 || inputArray.[ gid] <> inputArray.[ gid + 1 ] @>
178+ gid = length - 1
179+ || inputArray.[ gid] <> inputArray.[ gid + 1 ] @>
178180 <| clContext
179181
180182 ///<description >Remove duplicates form the given array.</description >
@@ -186,7 +188,8 @@ module ClArray =
186188 let scatter =
187189 Scatter.lastOccurrence clContext workGroupSize
188190
189- let getUniqueBitmap = getUniqueBitmapLastOccurrence clContext workGroupSize
191+ let getUniqueBitmap =
192+ getUniqueBitmapLastOccurrence clContext workGroupSize
190193
191194 let prefixSumExclude =
192195 PrefixSum.runExcludeInplace <@ (+) @> clContext workGroupSize
@@ -308,16 +311,20 @@ module ClArray =
308311
309312 let getUniqueBitmap2General < 'a when 'a : equality > getUniqueBitmap ( clContext : ClContext ) workGroupSize =
310313
311- let map = map2 clContext workGroupSize <@ fun x y -> x ||| y @>
314+ let map =
315+ map2 clContext workGroupSize <@ fun x y -> x ||| y @>
312316
313317 let firstGetBitmap = getUniqueBitmap clContext workGroupSize
314318
315319 fun ( processor : MailboxProcessor < _ >) allocationMode ( firstArray : ClArray < 'a >) ( secondArray : ClArray < 'a >) ->
316- let firstBitmap = firstGetBitmap processor DeviceOnly firstArray
320+ let firstBitmap =
321+ firstGetBitmap processor DeviceOnly firstArray
317322
318- let secondBitmap = firstGetBitmap processor DeviceOnly secondArray
323+ let secondBitmap =
324+ firstGetBitmap processor DeviceOnly secondArray
319325
320- let result = map processor allocationMode firstBitmap secondBitmap
326+ let result =
327+ map processor allocationMode firstBitmap secondBitmap
321328
322329 firstBitmap.Free processor
323330 secondBitmap.Free processor
@@ -344,15 +351,15 @@ module ClArray =
344351 // seems like scatter (option scatter) ???
345352 if 0 <= position && position < resultLength then
346353 match (% op) value with
347- | Some value ->
348- result.[ position] <- value
354+ | Some value -> result.[ position] <- value
349355 | None -> () @>
350356
351357 let kernel = clContext.Compile assign
352358
353359 fun ( processor : MailboxProcessor < _ >) ( values : ClArray < 'a >) ( positions : ClArray < int >) ( result : ClArray < 'b >) ->
354360
355- if values.Length <> positions.Length then failwith " lengths must be the same"
361+ if values.Length <> positions.Length then
362+ failwith " lengths must be the same"
356363
357364 let ndRange =
358365 Range1D.CreateValid( values.Length, workGroupSize)
@@ -371,19 +378,23 @@ module ClArray =
371378 map< 'a, int> clContext workGroupSize
372379 <| Map.chooseBitmap predicate
373380
374- let prefixSum = PrefixSum.standardExcludeInplace clContext workGroupSize
381+ let prefixSum =
382+ PrefixSum.standardExcludeInplace clContext workGroupSize
375383
376- let assignValues = assignOption clContext workGroupSize predicate
384+ let assignValues =
385+ assignOption clContext workGroupSize predicate
377386
378387 fun ( processor : MailboxProcessor < _ >) allocationMode ( sourceValues : ClArray < 'a >) ->
379388
380- let positions = getBitmap processor DeviceOnly sourceValues
389+ let positions =
390+ getBitmap processor DeviceOnly sourceValues
381391
382392 let resultLength =
383393 ( prefixSum processor positions)
384394 .ToHostAndFree( processor)
385395
386- let result = clContext.CreateClArrayWithSpecificAllocationMode( allocationMode, resultLength)
396+ let result =
397+ clContext.CreateClArrayWithSpecificAllocationMode( allocationMode, resultLength)
387398
388399 assignValues processor sourceValues positions result
389400
@@ -405,17 +416,16 @@ module ClArray =
405416 // seems like scatter2 (option scatter2) ???
406417 if 0 <= position && position < resultLength then
407418 match (% op) leftValue rightValue with
408- | Some value ->
409- result.[ position] <- value
419+ | Some value -> result.[ position] <- value
410420 | None -> () @>
411421
412422 let kernel = clContext.Compile assign
413423
414424 fun ( processor : MailboxProcessor < _ >) ( firstValues : ClArray < 'a >) ( secondValues : ClArray < 'b >) ( positions : ClArray < int >) ( result : ClArray < 'c >) ->
415425
416426 if firstValues.Length <> secondValues.Length
417- || secondValues.Length <> positions.Length then
418- failwith " lengths must be the same"
427+ || secondValues.Length <> positions.Length then
428+ failwith " lengths must be the same"
419429
420430 let ndRange =
421431 Range1D.CreateValid( firstValues.Length, workGroupSize)
@@ -424,7 +434,15 @@ module ClArray =
424434
425435 processor.Post(
426436 Msg.MsgSetArguments
427- ( fun () -> kernel.KernelFunc ndRange firstValues.Length firstValues secondValues positions result result.Length)
437+ ( fun () ->
438+ kernel.KernelFunc
439+ ndRange
440+ firstValues.Length
441+ firstValues
442+ secondValues
443+ positions
444+ result
445+ result.Length)
428446 )
429447
430448 processor.Post( Msg.CreateRunMsg<_, _>( kernel))
@@ -434,19 +452,23 @@ module ClArray =
434452 map2< 'a, 'b, int> clContext workGroupSize
435453 <| Map.chooseBitmap2 predicate
436454
437- let prefixSum = PrefixSum.standardExcludeInplace clContext workGroupSize
455+ let prefixSum =
456+ PrefixSum.standardExcludeInplace clContext workGroupSize
438457
439- let assignValues = assignOption2 clContext workGroupSize predicate
458+ let assignValues =
459+ assignOption2 clContext workGroupSize predicate
440460
441461 fun ( processor : MailboxProcessor < _ >) allocationMode ( firstValues : ClArray < 'a >) ( secondValues : ClArray < 'b >) ->
442462
443- let positions = getBitmap processor DeviceOnly firstValues secondValues
463+ let positions =
464+ getBitmap processor DeviceOnly firstValues secondValues
444465
445466 let resultLength =
446467 ( prefixSum processor positions)
447468 .ToHostAndFree( processor)
448469
449- let result = clContext.CreateClArrayWithSpecificAllocationMode( allocationMode, resultLength)
470+ let result =
471+ clContext.CreateClArrayWithSpecificAllocationMode( allocationMode, resultLength)
450472
451473 assignValues processor firstValues secondValues positions result
452474
0 commit comments