MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / csrCalcOutNNZ

Function csrCalcOutNNZ

src/backend/oneapi/kernel/sparse_arith.hpp:418–453  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

416};
417
418static void csrCalcOutNNZ(Param<int> outRowIdx, unsigned &nnzC, const uint M,
419 const uint N, uint nnzA, const Param<int> lrowIdx,
420 const Param<int> lcolIdx, uint nnzB,
421 const Param<int> rrowIdx, const Param<int> rcolIdx) {
422 UNUSED(N);
423 UNUSED(nnzA);
424 UNUSED(nnzB);
425
426 auto local = sycl::range(256);
427 auto global = sycl::range(divup(M, local[0]) * local[0]);
428
429 Array<unsigned> out = createValueArray<unsigned>(1, 0);
430 auto out_get = out.get();
431
432 getQueue().submit([&](auto &h) {
433 sycl::accessor d_out{*out_get, h, sycl::write_only};
434 sycl::accessor d_outRowIdx{*outRowIdx.data, h, sycl::write_only};
435 sycl::accessor d_lRowIdx{*lrowIdx.data, h, sycl::read_only};
436 sycl::accessor d_lColIdx{*lcolIdx.data, h, sycl::read_only};
437 sycl::accessor d_rRowIdx{*rrowIdx.data, h, sycl::read_only};
438 sycl::accessor d_rColIdx{*rcolIdx.data, h, sycl::read_only};
439
440 auto blkNNZ = sycl::local_accessor<unsigned, 1>(local[0], h);
441 h.parallel_for(
442 sycl::nd_range{global, local},
443 csrCalcOutNNZKernel(d_out, d_outRowIdx, M, d_lRowIdx, d_lColIdx,
444 d_rRowIdx, d_rColIdx, blkNNZ));
445 });
446
447 {
448 sycl::host_accessor nnz_acc{*out.get(), sycl::read_only};
449 nnzC = nnz_acc[0];
450 }
451
452 ONEAPI_DEBUG_FINISH(getQueue());
453}
454
455template<typename T, af_op_t op>
456class ssarithCSRKernel {

Callers 1

arithOpFunction · 0.50

Calls 4

csrCalcOutNNZKernelClass · 0.85
rangeFunction · 0.70
getQueueFunction · 0.50
getMethod · 0.45

Tested by

no test coverage detected