ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
AddMMSYCL.cpp
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #include <Logging.h>
9 
10 #include <sycl/sycl.hpp>
11 
15 #include "oneapi/mkl.hpp"
16 
17 namespace cloudViewer {
18 namespace core {
19 
20 void AddMMSYCL(void* A_data,
21  void* B_data,
22  void* C_data,
23  int64_t m,
24  int64_t k,
25  int64_t n,
26  double alpha,
27  double beta,
28  bool gemmTrA,
29  bool gemmTrB,
30  int lda,
31  int ldb,
32  int ldc,
33  Dtype dtype,
34  const Device& device) {
35  using namespace oneapi::mkl;
36  sycl::queue queue = sy::SYCLContext::GetInstance().GetDefaultQueue(device);
38  blas::column_major::gemm(queue, gemmTrA ? transpose::T : transpose::N,
39  gemmTrB ? transpose::T : transpose::N, m, n, k,
40  static_cast<scalar_t>(alpha),
41  static_cast<const scalar_t*>(A_data), lda,
42  static_cast<const scalar_t*>(B_data), ldb,
43  static_cast<scalar_t>(beta),
44  static_cast<scalar_t*>(C_data), ldc)
45  .wait_and_throw();
46  });
47 }
48 
49 } // namespace core
50 } // namespace cloudViewer
#define DISPATCH_LINALG_DTYPE_TO_TEMPLATE(DTYPE,...)
Definition: LinalgUtils.h:23
SYCL queue manager.
static SYCLContext & GetInstance()
Get singleton instance.
Definition: SYCLContext.cpp:25
sycl::queue GetDefaultQueue(const Device &device)
Get the default SYCL queue given an CloudViewer device.
Definition: SYCLContext.cpp:43
void AddMMSYCL(void *A_data, void *B_data, void *C_data, int64_t m, int64_t k, int64_t n, double alpha, double beta, bool gemmTrA, bool gemmTrB, int lda, int ldb, int ldc, Dtype dtype, const Device &device)
Definition: AddMMSYCL.cpp:20
Generic file read and write utility for python interface.