@@ -203,30 +203,29 @@ let makeGeneralTest zero isEqual opMul opAdd testFun (leftArray: 'a [,], rightAr
203203
204204 if leftMatrix.NNZ > 0
205205 && rightMatrix.NNZ > 0 then
206+ try
207+ let clLeftMatrix = leftMatrix.ToDevice context
208+ let clRightMatrix = rightMatrix.ToDevice context
206209
207- let clLeftMatrix = leftMatrix.ToDevice context
208- let clRightMatrix = rightMatrix.ToDevice context
210+ let ( clActualValues : ClArray < 'a >), ( clActualColumns : ClArray < int >), ( clActualRows : ClArray < int >) =
211+ testFun processor HostInterop clLeftMatrix clRightMatrix
209212
210- let ( clActualValues : ClArray < 'a >), ( clActualColumns : ClArray < int >), ( clActualRows : ClArray < int >) =
211- testFun processor HostInterop clLeftMatrix clRightMatrix
213+ let actualValues = clActualValues.ToHostAndFree processor
214+ let actualColumns = clActualColumns.ToHostAndFree processor
215+ let actualRows = clActualRows.ToHostAndFree processor
212216
213- clLeftMatrix.Dispose processor
214- clRightMatrix.Dispose processor
215-
216- let actualValues = clActualValues.ToHostAndFree processor
217- let actualColumns = clActualColumns.ToHostAndFree processor
218- let actualRows = clActualRows.ToHostAndFree processor
219-
220- checkGeneralResult zero isEqual actualValues actualColumns actualRows opMul opAdd leftArray rightArray
217+ checkGeneralResult zero isEqual actualValues actualColumns actualRows opMul opAdd leftArray rightArray
218+ with
219+ | ex when ex.Message = " InvalidBufferSize" -> ()
220+ | ex -> raise ex
221221
222222let createGeneralTest ( zero : 'a ) isEqual opAdd opAddQ opMul opMulQ testFun =
223223
224224 let testFun = testFun context Utils.defaultWorkGroupSize opAddQ opMulQ
225225
226226 makeGeneralTest zero isEqual opMul opAdd testFun
227- |> testPropertyWithConfig { config with endSize = 10 } $" test on %A {typeof<'a>}"
227+ |> testPropertyWithConfig { config with endSize = 10 ; maxTest = 1000 } $" test on %A {typeof<'a>}"
228228
229229let generalTests =
230230 [ createGeneralTest 0 (=) (+) <@ (+) @> (*) <@ (*) @> Expand.run ]
231231 |> testList " general"
232-
0 commit comments