Skip to content

Commit 779c8de

Browse files
committed
refactor: maxAllocSize: unit64
1 parent 51bb2b4 commit 779c8de

5 files changed

Lines changed: 20 additions & 6 deletions

File tree

src/GraphBLAS-sharp.Backend/Objects/ClContextExtensions.fs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,5 @@ module ClContextExtensions =
4848
Cl
4949
.GetDeviceInfo(this.ClDevice.Device, OpenCL.Net.DeviceInfo.MaxMemAllocSize, error)
5050
.CastTo<int>()
51-
* 1<Byte>
51+
|> uint64
52+
|> ((*) 1UL<Byte>)

src/GraphBLAS-sharp.Backend/Operations/Operations.fs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,10 +299,17 @@ module Operations =
299299
List.max [ sizeof<'a>
300300
sizeof<'c>
301301
sizeof<'b> ]
302-
* 1<Byte>
302+
|> uint64
303+
|> (*) 1UL<Byte>
303304

304305
let resultCapacity =
305-
(clContext.MaxMemAllocSize / allocCapacity) / 3
306+
(clContext.MaxMemAllocSize / allocCapacity) / 3UL
307+
308+
let resultCapacity =
309+
(max
310+
<| uint64 System.Int32.MaxValue
311+
<| resultCapacity)
312+
|> int
306313

307314
run processor allocationMode resultCapacity leftMatrix rightMatrix
308315
| _ -> failwith "Matrix formats are not matching"

tests/GraphBLAS-sharp.Tests/Backend/Common/Scan/ByKey.fs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,3 +109,6 @@ let sequentialSegmentsTests =
109109
|> testList "include"
110110

111111
testList "Sequential segments" [ excludeTests; includeTests ]
112+
113+
let tests =
114+
testList "ByKey" [ sequentialSegmentsTests ]

tests/GraphBLAS-sharp.Tests/Backend/Matrix/SpGeMM/Expand.fs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,4 +230,7 @@ let generalTests =
230230
ArithmeticOperations.float32Mul
231231
Operations.SpGeMM.expand
232232
createGeneralTest false (=) ArithmeticOperations.boolAdd ArithmeticOperations.boolMul Operations.SpGeMM.expand ]
233-
|> testList "general"
233+
|> testList "General"
234+
235+
let tests =
236+
testList "SpGeMM.Expand" [ generalTests ]

tests/GraphBLAS-sharp.Tests/Program.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ let matrixTests =
1717
Matrix.SubRows.tests
1818
Matrix.Kronecker.tests
1919

20-
Matrix.SpGeMM.Expand.generalTests
20+
Matrix.SpGeMM.Expand.tests
2121
Matrix.SpGeMM.Masked.tests ]
2222
|> testSequenced
2323

2424
let commonTests =
2525
let scanTests =
2626
testList
2727
"Scan"
28-
[ Common.Scan.ByKey.sequentialSegmentsTests
28+
[ Common.Scan.ByKey.tests
2929
Common.Scan.PrefixSum.tests ]
3030

3131
let reduceTests =

0 commit comments

Comments
 (0)