ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
AddMM.h
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 #pragma once
9 
11 
12 namespace cloudViewer {
13 namespace core {
14 
20 void AddMM(
21  const Tensor& A, const Tensor& B, Tensor& C, double alpha, double beta);
22 
23 #ifdef BUILD_SYCL_MODULE
24 void AddMMSYCL(void* A_data,
25  void* B_data,
26  void* C_data,
27  int64_t m,
28  int64_t k,
29  int64_t n,
30  double alpha,
31  double beta,
32  bool gemmTrA,
33  bool gemmTrB,
34  int lda,
35  int ldb,
36  int ldc,
37  Dtype dtype,
38  const Device& device);
39 #endif
40 
41 #ifdef BUILD_CUDA_MODULE
42 void AddMMCUDA(void* A_data,
43  void* B_data,
44  void* C_data,
45  int64_t m,
46  int64_t k,
47  int64_t n,
48  double alpha,
49  double beta,
50  bool gemmTrA,
51  bool gemmTrB,
52  int lda,
53  int ldb,
54  int ldc,
55  Dtype dtype,
56  const Device& device);
57 #endif
58 
59 void AddMMCPU(void* A_data,
60  void* B_data,
61  void* C_data,
62  int64_t m,
63  int64_t k,
64  int64_t n,
65  double alpha,
66  double beta,
67  bool gemmTrA,
68  bool gemmTrB,
69  int lda,
70  int ldb,
71  int ldc,
72  Dtype dtype);
73 
74 } // namespace core
75 } // namespace cloudViewer
cloudViewer
Generic file read and write utility for python interface.
Definition: CloudViewerConfig.cpp:12
cloudViewer::core::Tensor::GetDtype
Dtype GetDtype() const
Definition: Tensor.h:1164
Indexer.h
CUDAUtils.h
Common CUDA utilities.
cloudViewer::core::kernel::UnaryEWOpCode::Ceil
@ Ceil
cloudViewer::core::kernel::UnaryEWOpCode::IsFinite
@ IsFinite
cloudViewer::core::Tensor::GetShape
SizeVector GetShape() const
Definition: Tensor.h:1127
cloudViewer::core::AddMMCUDA
void AddMMCUDA(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: AddMMCUDA.cpp:17
cloudViewer::core::kernel::CPUSinElementKernel
static void CPUSinElementKernel(const void *src, void *dst)
Definition: UnaryEWCPU.cpp:87
cloudViewer::core::kernel::UnaryEWOpCode
UnaryEWOpCode
Definition: UnaryEW.h:18
cloudViewer::core::kernel::UnaryEWSYCL
void UnaryEWSYCL(const Tensor &src, Tensor &dst, UnaryEWOpCode op_code)
Definition: UnaryEWSYCL.cpp:199
cloudViewer::core::kernel::CPUIsFiniteElementKernel
static void CPUIsFiniteElementKernel(const void *src, void *dst)
Definition: UnaryEWCPU.cpp:139
cloudViewer::core::kernel::CPUExpElementKernel
static void CPUExpElementKernel(const void *src, void *dst)
Definition: UnaryEWCPU.cpp:115
AssertTensorDevice
#define AssertTensorDevice(tensor,...)
Definition: TensorCheck.h:45
cloudViewer::core::Tensor::Contiguous
Tensor Contiguous() const
Definition: Tensor.cpp:772
cloudViewer::core::kernel::UnaryEWOpCode::Sin
@ Sin
cloudViewer::core::DtypePolicy::NONE
@ NONE
cloudViewer::core::Dtype::ByteSize
int64_t ByteSize() const
Definition: Dtype.h:59
cloudViewer::core::Tensor::IsContiguous
bool IsContiguous() const
Definition: Tensor.h:1036
cloudViewer::core::kernel::CPUCeilElementKernel
static void CPUCeilElementKernel(const void *src, void *dst)
Definition: UnaryEWCPU.cpp:151
cloudViewer::core::kernel::CPULogicalNotElementKernel
static void CPULogicalNotElementKernel(const void *src, void *dst)
Definition: UnaryEWCPU.cpp:169
cloudViewer::core::Tensor
Definition: Tensor.h:32
ParallelForSYCL.h
cloudViewer::core::AddMM
void AddMM(const Tensor &A, const Tensor &B, Tensor &output, double alpha, double beta)
Definition: AddMM.cpp:17
cloudViewer::core::Dtype
Definition: Dtype.h:21
cloudViewer::core::kernel::CPUCosElementKernel
static void CPUCosElementKernel(const void *src, void *dst)
Definition: UnaryEWCPU.cpp:93
cloudViewer::core::kernel::UnaryEWOpCode::Exp
@ Exp
cloudViewer::core::Device::ToString
std::string ToString() const
Returns string representation of device, e.g. "CPU:0", "CUDA:0".
Definition: Device.cpp:89
cloudViewer::core::AddMMCPU
void AddMMCPU(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)
Definition: AddMMCPU.cpp:17
cloudViewer::core::Device::IsCUDA
bool IsCUDA() const
Returns true iff device type is CUDA.
Definition: Device.h:49
cloudViewer::core::kernel::CopyCPU
void CopyCPU(const Tensor &src, Tensor &dst)
Definition: UnaryEWCPU.cpp:174
cloudViewer::core::kernel::CPUSqrtElementKernel
static void CPUSqrtElementKernel(const void *src, void *dst)
Definition: UnaryEWCPU.cpp:81
indexer
Indexer indexer
Definition: UnaryEWSYCL.cpp:34
cloudViewer::core::kernel::UnaryEWOpCode::Floor
@ Floor
ParallelFor.h
cloudViewer::core::kernel::UnaryEWOpCode::Round
@ Round
SizeVector.h
cloudViewer::core::Device::IsSYCL
bool IsSYCL() const
Returns true iff device type is SYCL GPU.
Definition: Device.h:52
UnaryEW.h
cloudViewer::core::DtypePolicy::INPUT_SAME_OUTPUT_BOOL
@ INPUT_SAME_OUTPUT_BOOL
cloudViewer::core::DtypePolicy::ALL_SAME
@ ALL_SAME
cloudViewer::core::kernel::CPUCopyObjectElementKernel
static void CPUCopyObjectElementKernel(const void *src, void *dst, int64_t object_byte_size)
Definition: IndexGetSetCPU.cpp:34
Dispatch.h
cloudViewer::core::Tensor::T
Tensor T() const
Expects input to be <= 2-D Tensor by swapping dimension 0 and 1.
Definition: Tensor.cpp:1079
cloudViewer::core::Device
Definition: Device.h:18
AddMM.h
core
cloudViewer::core::Bool
const Dtype Bool
Definition: Dtype.cpp:52
cloudViewer::core::Dtype::ToString
std::string ToString() const
Definition: Dtype.h:65
cloudViewer::core::Float64
const Dtype Float64
Definition: Dtype.cpp:43
cloudViewer::utility::floor
MiniVec< float, N > floor(const MiniVec< float, N > &a)
Definition: MiniVec.h:75
cloudViewer::core::Tensor::GetDevice
Device GetDevice() const override
Definition: Tensor.cpp:1435
cloudViewer::core::Tensor::CopyFrom
void CopyFrom(const Tensor &other)
Copy Tensor values to current tensor from the source tensor.
Definition: Tensor.cpp:770
DISPATCH_DTYPE_TO_TEMPLATE_WITH_BOOL
#define DISPATCH_DTYPE_TO_TEMPLATE_WITH_BOOL(DTYPE,...)
Definition: Dispatch.h:68
cloudViewer::core::CUDAScopedDevice
When CUDA is not enabled, this is a dummy class.
Definition: CUDAUtils.h:214
cloudViewer::core::kernel::UnaryEWOpCode::LogicalNot
@ LogicalNot
cloudViewer::core::Float32
const Dtype Float32
Definition: Dtype.cpp:42
cloudViewer::core::kernel::CPUIsNanElementKernel
static void CPUIsNanElementKernel(const void *src, void *dst)
Definition: UnaryEWCPU.cpp:127
cloudViewer::core::kernel::CPUFloorElementKernel
static void CPUFloorElementKernel(const void *src, void *dst)
Definition: UnaryEWCPU.cpp:145
cloudViewer::core::SizeVector::NumElements
int64_t NumElements() const
Definition: SizeVector.cpp:108
cloudViewer::core::SizeVector
Definition: SizeVector.h:70
indexer
Indexer indexer
Definition: BinaryEWSYCL.cpp:30
cloudViewer::core::kernel::UnaryEWCPU
void UnaryEWCPU(const Tensor &src, Tensor &dst, UnaryEWOpCode op_code)
Definition: UnaryEWCPU.cpp:217
cloudViewer::core::kernel::UnaryEWOpCode::Abs
@ Abs
LogError
#define LogError(...)
Definition: Logging.h:60
DISPATCH_DTYPE_TO_TEMPLATE
#define DISPATCH_DTYPE_TO_TEMPLATE(DTYPE,...)
Definition: Dispatch.h:31
cloudViewer::core::MemoryManager::Memcpy
static void Memcpy(void *dst_ptr, const Device &dst_device, const void *src_ptr, const Device &src_device, size_t num_bytes)
Definition: MemoryManager.cpp:36
cloudViewer::core::sy::SYCLContext::GetInstance
static SYCLContext & GetInstance()
Get singleton instance.
Definition: SYCLContext.cpp:25
cloudViewer::core::Device::IsCPU
bool IsCPU() const
Returns true iff device type is CPU.
Definition: Device.h:46
cloudViewer::core::kernel::UnaryEWOpCode::Sqrt
@ Sqrt
UNARY_ELEMENT_KERNEL
#define UNARY_ELEMENT_KERNEL(name, elem_op)
Definition: UnaryEWSYCL.cpp:95
AssertTensorDtype
#define AssertTensorDtype(tensor,...)
Definition: TensorCheck.h:21
CLOUDVIEWER_TEMPLATE_VECTORIZED
#define CLOUDVIEWER_TEMPLATE_VECTORIZED(T, ISPCKernel,...)
Definition: ParallelFor.h:246
cloudViewer::core::kernel::UnaryEWOpCode::Neg
@ Neg
cloudViewer::core::Tensor::NumElements
int64_t NumElements() const
Definition: Tensor.h:1170
Tensor.h
cloudViewer::core::kernel::CPUIsInfElementKernel
static void CPUIsInfElementKernel(const void *src, void *dst)
Definition: UnaryEWCPU.cpp:133
cloudViewer::core::kernel::UnaryEWOpCode::Trunc
@ Trunc
cloudViewer::core::IsDevice::IsSYCL
bool IsSYCL() const
Definition: Device.h:103
cloudViewer::core::Dtype::IsObject
bool IsObject() const
Definition: Dtype.h:63
cloudViewer::core::kernel::CPUNegElementKernel
static void CPUNegElementKernel(const void *src, void *dst)
Definition: UnaryEWCPU.cpp:101
cloudViewer::core::kernel::CPURoundElementKernel
static void CPURoundElementKernel(const void *src, void *dst)
Definition: UnaryEWCPU.cpp:157
cloudViewer::core::ParallelFor
void ParallelFor(const Device &device, int64_t n, const func_t &func)
Definition: ParallelFor.h:111
cloudViewer::core::Tensor::GetStride
int64_t GetStride(int64_t dim) const
Definition: Tensor.h:1139
cloudViewer::core::AddMMSYCL
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
cloudViewer::core::kernel::UnaryEWOpCode::Cos
@ Cos
cloudViewer::core::kernel::CopySYCL
void CopySYCL(const Tensor &src, Tensor &dst)
Definition: UnaryEWSYCL.cpp:131
cloudViewer::core::kernel::LaunchUnaryEWKernel
static void LaunchUnaryEWKernel(const Indexer &indexer, const element_func_t &element_func)
Definition: UnaryEWCPU.cpp:31
cloudViewer::core::kernel::CPUCopyElementKernel
static void CPUCopyElementKernel(const void *src, void *dst)
Definition: IndexGetSetCPU.cpp:30
cloudViewer::core::sy::SYCLContext::GetDefaultQueue
sycl::queue GetDefaultQueue(const Device &device)
Get the default SYCL queue given an CloudViewer device.
Definition: SYCLContext.cpp:43
cloudViewer::core::Indexer
Definition: Indexer.h:262
type
char type
Definition: FileIOFactory.cpp:131
cloudViewer::core::kernel::CPUAbsElementKernel
static void CPUAbsElementKernel(const void *src, void *dst)
Definition: UnaryEWCPU.cpp:121
MemoryManager.h
Dtype.h
cloudViewer::core::Tensor::To
Tensor To(Dtype dtype, bool copy=false) const
Definition: Tensor.cpp:739
cloudViewer::utility::ceil
MiniVec< float, N > ceil(const MiniVec< float, N > &a)
Definition: MiniVec.h:89
cloudViewer::core::kernel::UnaryEWOpCode::IsNan
@ IsNan
cloudViewer::core::kernel::CPUTruncElementKernel
static void CPUTruncElementKernel(const void *src, void *dst)
Definition: UnaryEWCPU.cpp:163
cloudViewer::core::Tensor::GetDataPtr
T * GetDataPtr()
Definition: Tensor.h:1144
cloudViewer::core::kernel::UnaryEWOpCode::IsInf
@ IsInf