@@ -195,60 +195,6 @@ type EWiseAddBenchmarksWithDataTransfer<'matrixT, 'elem when 'matrixT :> Backend
195195 this.Processor.PostAndReply Msg.MsgNotifyMe
196196
197197module M =
198- let inline buildCooMatrix ( context : ClContext ) matrix =
199- match matrix with
200- | MatrixCOO m ->
201- let rows =
202- context.CreateClArray ( m.Rows, hostAccessMode = HostAccessMode.ReadOnly, deviceAccessMode = DeviceAccessMode.ReadOnly, allocationMode = AllocationMode.CopyHostPtr)
203-
204- let cols =
205- context.CreateClArray ( m.Columns, hostAccessMode = HostAccessMode.ReadOnly, deviceAccessMode = DeviceAccessMode.ReadOnly, allocationMode = AllocationMode.CopyHostPtr)
206-
207- let vals =
208- context.CreateClArray ( m.Values, hostAccessMode = HostAccessMode.ReadOnly, deviceAccessMode = DeviceAccessMode.ReadOnly, allocationMode = AllocationMode.CopyHostPtr)
209-
210- { Backend.COOMatrix.Context = context
211- Backend.COOMatrix.RowCount = m.RowCount
212- Backend.COOMatrix.ColumnCount = m.ColumnCount
213- Backend.COOMatrix.Rows = rows
214- Backend.COOMatrix.Columns = cols
215- Backend.COOMatrix.Values = vals }
216-
217- | x -> failwith " Unsupported matrix format: %A "
218-
219- let inline buildCsrMatrix ( context : ClContext ) matrix =
220- match matrix with
221- | MatrixCOO m ->
222- let rowPointers =
223- context.CreateClArray(
224- Utils.rowIndices2rowPointers m.Rows m.RowCount
225- , hostAccessMode = HostAccessMode.ReadOnly
226- , deviceAccessMode = DeviceAccessMode.ReadOnly
227- , allocationMode = AllocationMode.CopyHostPtr)
228-
229- let cols =
230- context.CreateClArray (
231- m.Columns
232- , hostAccessMode = HostAccessMode.ReadOnly
233- , deviceAccessMode = DeviceAccessMode.ReadOnly
234- , allocationMode = AllocationMode.CopyHostPtr)
235-
236- let vals =
237- context.CreateClArray (
238- m.Values
239- , hostAccessMode = HostAccessMode.ReadOnly
240- , deviceAccessMode = DeviceAccessMode.ReadOnly
241- , allocationMode = AllocationMode.CopyHostPtr)
242-
243- { Backend.CSRMatrix.Context = context
244- Backend.CSRMatrix.RowCount = m.RowCount
245- Backend.CSRMatrix.ColumnCount = m.ColumnCount
246- Backend.CSRMatrix.RowPointers = rowPointers
247- Backend.CSRMatrix.Columns = cols
248- Backend.CSRMatrix.Values = vals }
249-
250- | x -> failwith " Unsupported matrix format: %A "
251-
252198 let resultToHostCOO ( resultMatrix : Backend.COOMatrix < 'a >) ( procesor : MailboxProcessor < _ >) =
253199 let cols =
254200 let a = Array.zeroCreate resultMatrix.ColumnCount
@@ -274,10 +220,10 @@ module M =
274220type EWiseAddBenchmarks4Float32COOWithoutDataTransfer () =
275221
276222 inherit EWiseAddBenchmarksWithoutDataTransfer< Backend.COOMatrix< float32>, float32>(
277- ( fun context wgSize -> Backend.COOMatrix.eWiseAdd context Backend.Common.StandardOperations.float32Sum wgSize),
223+ ( fun context wgSize -> Backend.COOMatrix.elementwise context Backend.Common.StandardOperations.float32Sum wgSize),
278224 float32,
279225 ( fun _ -> Utils.nextSingle ( System.Random())),
280- M.buildCooMatrix
226+ COOMatrix < float32 >. ToBackend
281227 )
282228
283229 static member InputMatricesProvider =
@@ -286,10 +232,10 @@ type EWiseAddBenchmarks4Float32COOWithoutDataTransfer() =
286232type EWiseAddBenchmarks4Float32COOWithDataTransfer () =
287233
288234 inherit EWiseAddBenchmarksWithDataTransfer< Backend.COOMatrix< float32>, float32>(
289- ( fun context wgSize -> Backend.COOMatrix.eWiseAdd context Backend.Common.StandardOperations.float32Sum wgSize),
235+ ( fun context wgSize -> Backend.COOMatrix.elementwise context Backend.Common.StandardOperations.float32Sum wgSize),
290236 float32,
291237 ( fun _ -> Utils.nextSingle ( System.Random())),
292- M.buildCooMatrix ,
238+ COOMatrix < float32 >. ToBackend ,
293239 M.resultToHostCOO
294240 )
295241
@@ -300,10 +246,10 @@ type EWiseAddBenchmarks4Float32COOWithDataTransfer() =
300246type EWiseAddBenchmarks4BoolCOOWithoutDataTransfer () =
301247
302248 inherit EWiseAddBenchmarksWithoutDataTransfer< Backend.COOMatrix< bool>, bool>(
303- ( fun context wgSize -> Backend.COOMatrix.eWiseAdd context Backend.Common.StandardOperations.boolSum wgSize),
249+ ( fun context wgSize -> Backend.COOMatrix.elementwise context Backend.Common.StandardOperations.boolSum wgSize),
304250 ( fun _ -> true ),
305251 ( fun _ -> true ),
306- M.buildCooMatrix
252+ COOMatrix < bool >. ToBackend
307253 )
308254
309255 static member InputMatricesProvider =
@@ -313,10 +259,10 @@ type EWiseAddBenchmarks4BoolCOOWithoutDataTransfer() =
313259type EWiseAddBenchmarks4Float32CSRWithoutDataTransfer () =
314260
315261 inherit EWiseAddBenchmarksWithoutDataTransfer< Backend.CSRMatrix< float32>, float32>(
316- ( fun context wgSize -> Backend.CSRMatrix.eWiseAdd context Backend.Common.StandardOperations.float32Sum wgSize),
262+ ( fun context wgSize -> Backend.CSRMatrix.elementwise context Backend.Common.StandardOperations.float32Sum wgSize),
317263 float32,
318264 ( fun _ -> Utils.nextSingle ( System.Random())),
319- M.buildCsrMatrix
265+ CSRMatrix < float32 >. ToBackend
320266 )
321267
322268 static member InputMatricesProvider =
@@ -326,10 +272,10 @@ type EWiseAddBenchmarks4Float32CSRWithoutDataTransfer() =
326272type EWiseAddBenchmarks4BoolCSRWithoutDataTransfer () =
327273
328274 inherit EWiseAddBenchmarksWithoutDataTransfer< Backend.CSRMatrix< bool>, bool>(
329- ( fun context wgSize -> Backend.CSRMatrix.eWiseAdd context Backend.Common.StandardOperations.boolSum wgSize),
275+ ( fun context wgSize -> Backend.CSRMatrix.elementwise context Backend.Common.StandardOperations.boolSum wgSize),
330276 ( fun _ -> true ),
331277 ( fun _ -> true ),
332- M.buildCsrMatrix
278+ CSRMatrix < bool >. ToBackend
333279 )
334280
335281 static member InputMatricesProvider =
@@ -340,10 +286,10 @@ type EWiseAddBenchmarks4BoolCSRWithoutDataTransfer() =
340286type EWiseAddAtLeastOneBenchmarks4BoolCOOWithoutDataTransfer () =
341287
342288 inherit EWiseAddBenchmarksWithoutDataTransfer< Backend.COOMatrix< bool>, bool>(
343- ( fun context wgSize -> Backend.COOMatrix.eWiseAddAtLeastOne context Backend.Common.StandardOperations.boolSumAtLeastOne wgSize),
289+ ( fun context wgSize -> Backend.COOMatrix.elementwiseAtLeastOne context Backend.Common.StandardOperations.boolSumAtLeastOne wgSize),
344290 ( fun _ -> true ),
345291 ( fun _ -> true ),
346- M.buildCooMatrix
292+ COOMatrix < bool >. ToBackend
347293 )
348294
349295 static member InputMatricesProvider =
@@ -352,10 +298,10 @@ type EWiseAddAtLeastOneBenchmarks4BoolCOOWithoutDataTransfer() =
352298type EWiseAddAtLeastOneBenchmarks4BoolCSRWithoutDataTransfer () =
353299
354300 inherit EWiseAddBenchmarksWithoutDataTransfer< Backend.CSRMatrix< bool>, bool>(
355- ( fun context wgSize -> Backend.CSRMatrix.eWiseAddAtLeastOne context Backend.Common.StandardOperations.boolSumAtLeastOne wgSize),
301+ ( fun context wgSize -> Backend.CSRMatrix.elementwiseAtLeastOne context Backend.Common.StandardOperations.boolSumAtLeastOne wgSize),
356302 ( fun _ -> true ),
357303 ( fun _ -> true ),
358- M.buildCsrMatrix
304+ CSRMatrix < bool >. ToBackend
359305 )
360306
361307 static member InputMatricesProvider =
@@ -364,10 +310,10 @@ type EWiseAddAtLeastOneBenchmarks4BoolCSRWithoutDataTransfer() =
364310type EWiseAddAtLeastOneBenchmarks4Float32COOWithoutDataTransfer () =
365311
366312 inherit EWiseAddBenchmarksWithoutDataTransfer< Backend.COOMatrix< float32>, float32>(
367- ( fun context wgSize -> Backend.COOMatrix.eWiseAddAtLeastOne context Backend.Common.StandardOperations.float32SumAtLeastOne wgSize),
313+ ( fun context wgSize -> Backend.COOMatrix.elementwiseAtLeastOne context Backend.Common.StandardOperations.float32SumAtLeastOne wgSize),
368314 float32,
369315 ( fun _ -> Utils.nextSingle ( System.Random())),
370- M.buildCooMatrix
316+ COOMatrix < float32 >. ToBackend
371317 )
372318
373319 static member InputMatricesProvider =
@@ -376,10 +322,10 @@ type EWiseAddAtLeastOneBenchmarks4Float32COOWithoutDataTransfer() =
376322type EWiseAddAtLeastOneBenchmarks4Float32CSRWithoutDataTransfer () =
377323
378324 inherit EWiseAddBenchmarksWithoutDataTransfer< Backend.CSRMatrix< float32>, float32>(
379- ( fun context wgSize -> Backend.CSRMatrix.eWiseAddAtLeastOne context Backend.Common.StandardOperations.float32SumAtLeastOne wgSize),
325+ ( fun context wgSize -> Backend.CSRMatrix.elementwiseAtLeastOne context Backend.Common.StandardOperations.float32SumAtLeastOne wgSize),
380326 float32,
381327 ( fun _ -> Utils.nextSingle ( System.Random())),
382- M.buildCsrMatrix
328+ CSRMatrix < float32 >. ToBackend
383329 )
384330
385331 static member InputMatricesProvider =
0 commit comments