Skip to content

SpGeMM #77

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
May 5, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

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
add: maxAllocSize assert
  • Loading branch information
IgorErin committed May 2, 2023
commit 7e58687268b927e0c4ca14625255ce4b218add93
3 changes: 3 additions & 0 deletions src/GraphBLAS-sharp.Backend/Common/ClArray.fs
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,9 @@ module ClArray =
sourceArrays
|> Seq.sumBy (fun array -> array.Length)

if resultLength >= clContext.MaxMemAllocSize then
failwith "It is impossible to allocate more than MaxAllocSize"

let result =
clContext.CreateClArrayWithSpecificAllocationMode(allocationMode, resultLength)

Expand Down
3 changes: 3 additions & 0 deletions src/GraphBLAS-sharp.Backend/Matrix/SpGeMM/Expand.fs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ module Expand =

fun (processor: MailboxProcessor<_>) lengths (segmentsPointers: ClArray<int>) (leftMatrix: ClMatrix.COO<'a>) (rightMatrix: ClMatrix.CSR<'b>) ->

assert (lengths < clContext.MaxMemAllocSize)

// Compute left matrix positions
let leftMatrixPositions = zeroCreate processor DeviceOnly lengths

Expand Down Expand Up @@ -456,6 +458,7 @@ module Expand =

let rows = concat processor allocationMode rowsList

// TODO(overhead: compute result length 3 time)
// release resources
valuesList
|> List.iter (fun array -> array.Free processor)
Expand Down