Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
d55d34f
add: Gather
IgorErin Mar 12, 2023
a136bd3
add: Expand module
IgorErin Mar 13, 2023
f77b4d2
add: requiredRawsLengths test
IgorErin Mar 13, 2023
d22621e
wip: module Expand test
IgorErin Mar 13, 2023
9d25601
refactor: globalMap
IgorErin Mar 13, 2023
5479816
add: Expand stage
IgorErin Mar 13, 2023
be13d6e
add: Expand test
IgorErin Mar 16, 2023
890bdd1
merge: dev
IgorErin Mar 26, 2023
6da457b
add: reduceByKey2D
IgorErin Mar 27, 2023
66c2711
refactor: wip
IgorErin Apr 1, 2023
91a72e2
add: Gather tests
IgorErin Apr 3, 2023
b679650
wip: segments computing tests
IgorErin Apr 4, 2023
7e09219
wip: expand tests passed
IgorErin Apr 4, 2023
84fb950
wip: getUniqueBitmap{first/last} occurrence
IgorErin Apr 5, 2023
8ec7fd7
add: Scatter.firstOccurrence
IgorErin Apr 5, 2023
63037b6
spgemm: left filtering
IgorErin Apr 6, 2023
03e7e95
add: init gather
IgorErin Apr 6, 2023
6f02570
add: init scatter
IgorErin Apr 6, 2023
29c564c
add: scatter init value
IgorErin Apr 6, 2023
972b392
refactor: init in spgemm
IgorErin Apr 6, 2023
73d755f
refactor: deforestation in ClArray.choose
IgorErin Apr 6, 2023
f34e590
add: ClArray.choose2
IgorErin Apr 6, 2023
751ee68
add: filter after multiplication
IgorErin Apr 6, 2023
69be680
add: reduce by key option
IgorErin Apr 6, 2023
3f7c0bf
add: spgemm
IgorErin Apr 7, 2023
96c0c08
refactor: spgemm
IgorErin Apr 7, 2023
95fea31
refactor: duplication, allTests in Reduce
IgorErin Apr 7, 2023
c5fa0d0
refactor: ClArray.Free and *.FreeAndWait
IgorErin Apr 7, 2023
6ff1971
refactor: remove use in test
IgorErin Apr 7, 2023
048477d
refactor: formatting
IgorErin Apr 7, 2023
3703609
merge: dev
IgorErin Apr 7, 2023
4d26023
refactor: formatting
IgorErin Apr 7, 2023
cf7cc1d
refactor: expand endSize
IgorErin Apr 8, 2023
fdb9041
refactor: Scatter.test memory release
IgorErin Apr 8, 2023
a6ebc30
refactor: tests, names
IgorErin Apr 8, 2023
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor: init in spgemm
  • Loading branch information
IgorErin committed Apr 6, 2023
commit 972b3924c99d55bf7e5914edc19b19d3a23f380d
4 changes: 2 additions & 2 deletions src/GraphBLAS-sharp.Backend/Common/Scatter.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ namespace GraphBLAS.FSharp.Backend.Common
open Brahma.FSharp

module internal Scatter =
let firstOccurencePredicate () =
let private firstOccurencePredicate () =
<@ fun gid _ (positions: ClArray<int>) ->
// first occurrence condition
(gid = 0 || positions.[gid - 1] <> positions.[gid]) @>

let lastOccurrencePredicate () =
let private lastOccurrencePredicate () =
<@ fun gid positionsLength (positions: ClArray<int>) ->
// last occurrence condition
(gid = positionsLength - 1 || positions.[gid] <> positions.[gid + 1]) @>
Expand Down
21 changes: 6 additions & 15 deletions src/GraphBLAS-sharp.Backend/Matrix/CSRMatrix/SpGEMM/Expand.fs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ module Expand =

let init = ClArray.init clContext workGroupSize Map.id

let idScatter = Scatter.initLastOccurrence Map.id clContext workGroupSize

let scatter = Scatter.lastOccurrence clContext workGroupSize

let zeroCreate = ClArray.zeroCreate clContext workGroupSize
Expand All @@ -94,18 +96,14 @@ module Expand =
fun (processor: MailboxProcessor<_>) lengths (segmentsPointers: Indices) (leftMatrix: ClMatrix.CSR<'a>) (rightMatrix: ClMatrix.CSR<'b>) ->

// Compute A positions
let sequence = init processor DeviceOnly segmentsPointers.Length // TODO(fuse)

let APositions = zeroCreate processor DeviceOnly lengths
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

leftMatrixPositions? Same for other names below.


scatter processor segmentsPointers sequence APositions

sequence.Free processor
idScatter processor segmentsPointers APositions

(maxPrefixSum processor APositions 0).Free processor

// Compute B positions
let BPositions = create processor DeviceOnly lengths 1 // TODO(fuse)
let BPositions = create processor DeviceOnly lengths 1

let requiredBPointers = zeroCreate processor DeviceOnly leftMatrix.Columns.Length

Expand Down Expand Up @@ -200,9 +198,7 @@ module Expand =

let prefixSum = PrefixSum.standardExcludeInplace clContext workGroupSize

let init = ClArray.init clContext workGroupSize Map.id // TODO(fuse)

let scatter = Scatter.firstOccurrence clContext workGroupSize
let idScatter = Scatter.initFirsOccurrence Map.id clContext workGroupSize

fun (processor: MailboxProcessor<_>) allocationMode (values: ClArray<'a>) (columns: Indices) (rows: Indices) ->

Expand All @@ -214,18 +210,13 @@ module Expand =

printfn $"key bitmap after prefix sum: %A{bitmap.ToHost processor}"

let positions = init processor DeviceOnly bitmap.Length

printfn $"positions: %A{positions.ToHost processor}"

let offsets = clContext.CreateClArrayWithSpecificAllocationMode(DeviceOnly, uniqueKeysCount)

scatter processor bitmap positions offsets
idScatter processor bitmap offsets

printfn $"offsets: %A{offsets.ToHost processor}"

bitmap.Free processor
positions.Free processor

let reducedColumns, reducedRows, reducedValues = // by size variance TODO()
reduce processor allocationMode uniqueKeysCount offsets columns rows values
Expand Down
5 changes: 3 additions & 2 deletions tests/GraphBLAS-sharp.Tests/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,10 @@ open GraphBLAS.FSharp.Tests.Matrix
let allTests =
testList
"All tests"
[ // SpGeMM.getSegmentsTests
[ SpGeMM.generalTests
// Common.Gather.initTests
Common.Scatter.allTests ]
//Common.Scatter.allTests ]
]

|> testSequenced

Expand Down