ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
MatmulSYCL.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 void MatmulSYCL(void* A_data,
20  void* B_data,
21  void* C_data,
22  int64_t m,
23  int64_t k,
24  int64_t n,
25  Dtype dtype,
26  const Device& device) {
27  using namespace oneapi::mkl;
28  sycl::queue queue = sy::SYCLContext::GetInstance().GetDefaultQueue(device);
30  scalar_t alpha = 1, beta = 0;
31  blas::column_major::gemm(queue, transpose::N, transpose::N, m, n, k,
32  alpha, static_cast<const scalar_t*>(A_data), m,
33  static_cast<const scalar_t*>(B_data), k, beta,
34  static_cast<scalar_t*>(C_data), m)
35  .wait_and_throw();
36  });
37 }
38 
39 } // namespace core
40 } // 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 MatmulSYCL(void *A_data, void *B_data, void *C_data, int64_t m, int64_t k, int64_t n, Dtype dtype, const Device &device)
Definition: MatmulSYCL.cpp:19
Generic file read and write utility for python interface.