Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jerrrrry
infinicore
Commits
95623d82
Unverified
Commit
95623d82
authored
Jul 14, 2025
by
PanZezhong1725
Committed by
GitHub
Jul 14, 2025
Browse files
Merge pull request #328 from YdrMaster/main
issue/158/refactor: 分离天数和英伟达的算子定义
parents
e3022fa8
d9de5133
Changes
25
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
216 additions
and
34 deletions
+216
-34
src/infiniccl/cuda/infiniccl_cuda.h
src/infiniccl/cuda/infiniccl_cuda.h
+1
-1
src/infiniop/devices/handle.cc
src/infiniop/devices/handle.cc
+7
-1
src/infiniop/devices/nvidia/nvidia_common.cu
src/infiniop/devices/nvidia/nvidia_common.cu
+21
-5
src/infiniop/devices/nvidia/nvidia_handle.h
src/infiniop/devices/nvidia/nvidia_handle.h
+20
-3
src/infiniop/devices/nvidia/nvidia_kernel_common.cuh
src/infiniop/devices/nvidia/nvidia_kernel_common.cuh
+1
-1
src/infiniop/ops/add/operator.cc
src/infiniop/ops/add/operator.cc
+13
-1
src/infiniop/ops/causal_softmax/operator.cc
src/infiniop/ops/causal_softmax/operator.cc
+13
-1
src/infiniop/ops/clip/cuda/kernel.cuh
src/infiniop/ops/clip/cuda/kernel.cuh
+1
-1
src/infiniop/ops/clip/operator.cc
src/infiniop/ops/clip/operator.cc
+13
-1
src/infiniop/ops/conv/nvidia/conv_nvidia.cu
src/infiniop/ops/conv/nvidia/conv_nvidia.cu
+4
-4
src/infiniop/ops/conv/operator.cc
src/infiniop/ops/conv/operator.cc
+16
-1
src/infiniop/ops/gemm/nvidia/gemm_nvidia.cu
src/infiniop/ops/gemm/nvidia/gemm_nvidia.cu
+4
-4
src/infiniop/ops/gemm/operator.cc
src/infiniop/ops/gemm/operator.cc
+13
-1
src/infiniop/ops/mul/operator.cc
src/infiniop/ops/mul/operator.cc
+14
-1
src/infiniop/ops/random_sample/operator.cc
src/infiniop/ops/random_sample/operator.cc
+13
-1
src/infiniop/ops/rearrange/operator.cc
src/infiniop/ops/rearrange/operator.cc
+10
-3
src/infiniop/ops/rms_norm/operator.cc
src/infiniop/ops/rms_norm/operator.cc
+13
-1
src/infiniop/ops/rope/operator.cc
src/infiniop/ops/rope/operator.cc
+13
-1
src/infiniop/ops/sub/operator.cc
src/infiniop/ops/sub/operator.cc
+13
-1
src/infiniop/ops/swiglu/operator.cc
src/infiniop/ops/swiglu/operator.cc
+13
-1
No files found.
src/infiniccl/cuda/infiniccl_cuda.h
View file @
95623d82
...
...
@@ -4,7 +4,7 @@
#include "../infiniccl_impl.h"
// Windows does not support CUDA
#if defined(ENABLE_NVIDIA_API) && defined(ENABLE_CCL) && !defined(_WIN32)
#if
(
defined(ENABLE_NVIDIA_API)
|| defined(ENABLE_ILUVATAR_API))
&& defined(ENABLE_CCL) && !defined(_WIN32)
INFINICCL_DEVICE_API_IMPL
(
cuda
)
#else
INFINICCL_DEVICE_API_NOOP
(
cuda
)
...
...
src/infiniop/devices/handle.cc
View file @
95623d82
...
...
@@ -5,7 +5,7 @@
#ifdef ENABLE_CPU_API
#include "cpu/cpu_handle.h"
#endif
#ifdef
ENABLE_NVIDIA_API
#if
def
ined(
ENABLE_NVIDIA_API
) || defined(ENABLE_ILUVATAR_API)
#include "nvidia/nvidia_handle.h"
#endif
#ifdef ENABLE_CAMBRICON_API
...
...
@@ -44,6 +44,9 @@ __C infiniStatus_t infiniopCreateHandle(infiniopHandle_t *handle_ptr) {
#ifdef ENABLE_NVIDIA_API
CREATE
(
INFINI_DEVICE_NVIDIA
,
nvidia
);
#endif
#ifdef ENABLE_ILUVATAR_API
CREATE
(
INFINI_DEVICE_ILUVATAR
,
nvidia
);
#endif
#ifdef ENABLE_CAMBRICON_API
CREATE
(
INFINI_DEVICE_CAMBRICON
,
bang
::
cambricon
);
#endif
...
...
@@ -81,6 +84,9 @@ __C infiniStatus_t infiniopDestroyHandle(infiniopHandle_t handle) {
#ifdef ENABLE_NVIDIA_API
DELETE
(
INFINI_DEVICE_NVIDIA
,
nvidia
);
#endif
#ifdef ENABLE_ILUVATAR_API
DELETE
(
INFINI_DEVICE_ILUVATAR
,
nvidia
);
#endif
#ifdef ENABLE_CAMBRICON_API
DELETE
(
INFINI_DEVICE_CAMBRICON
,
bang
::
cambricon
);
#endif
...
...
src/infiniop/devices/nvidia/nvidia_common.cu
View file @
95623d82
#include "nvidia_handle.cuh"
namespace
device
::
nvidia
{
namespace
device
{
Handle
::
Handle
(
int
device_id
)
:
InfiniopHandle
{
INFINI_DEVICE_NVIDIA
,
device_id
},
namespace
nvidia
{
Handle
::
Handle
(
infiniDevice_t
device
,
int
device_id
)
:
InfiniopHandle
{
device
,
device_id
},
_internal
(
std
::
make_shared
<
Handle
::
Internal
>
(
device_id
))
{}
auto
Handle
::
internal
()
const
->
const
std
::
shared_ptr
<
Internal
>
&
{
...
...
@@ -71,7 +73,7 @@ cudnnDataType_t getCudnnDtype(infiniDtype_t dt) {
return
CUDNN_DATA_INT8
;
case
INFINI_DTYPE_I32
:
return
CUDNN_DATA_INT32
;
#ifndef ENABLE_ILUVATAR_
CUDA_
API
#ifndef ENABLE_ILUVATAR_API
case
INFINI_DTYPE_I64
:
return
CUDNN_DATA_INT64
;
#endif
...
...
@@ -83,9 +85,23 @@ cudnnDataType_t getCudnnDtype(infiniDtype_t dt) {
}
#endif
infiniStatus_t
Handle
::
create
(
InfiniopHandle
**
handle_ptr
,
int
device_id
)
{
*
handle_ptr
=
new
Handle
(
INFINI_DEVICE_NVIDIA
,
device_id
);
return
INFINI_STATUS_SUCCESS
;
}
}
// namespace nvidia
namespace
iluvatar
{
Handle
::
Handle
(
int
device_id
)
:
nvidia
::
Handle
(
INFINI_DEVICE_ILUVATAR
,
device_id
)
{}
infiniStatus_t
Handle
::
create
(
InfiniopHandle
**
handle_ptr
,
int
device_id
)
{
*
handle_ptr
=
new
Handle
(
device_id
);
return
INFINI_STATUS_SUCCESS
;
}
}
// namespace device::nvidia
}
// namespace iluvatar
}
// namespace device
src/infiniop/devices/nvidia/nvidia_handle.h
View file @
95623d82
...
...
@@ -4,13 +4,17 @@
#include "../../handle.h"
#include <memory>
namespace
device
::
nvidia
{
namespace
device
{
namespace
nvidia
{
struct
Handle
:
public
InfiniopHandle
{
Handle
(
int
device_id
);
class
Internal
;
auto
internal
()
const
->
const
std
::
shared_ptr
<
Internal
>
&
;
protected:
Handle
(
infiniDevice_t
device
,
int
device_id
);
public:
static
infiniStatus_t
create
(
InfiniopHandle
**
handle_ptr
,
int
device_id
);
...
...
@@ -18,6 +22,19 @@ private:
std
::
shared_ptr
<
Internal
>
_internal
;
};
}
// namespace device::nvidia
}
// namespace nvidia
namespace
iluvatar
{
struct
Handle
:
public
nvidia
::
Handle
{
Handle
(
int
device_id
);
public:
static
infiniStatus_t
create
(
InfiniopHandle
**
handle_ptr
,
int
device_id
);
};
}
// namespace iluvatar
}
// namespace device
#endif // __INFINIOP_CUDA_HANDLE_H__
src/infiniop/devices/nvidia/nvidia_kernel_common.cuh
View file @
95623d82
...
...
@@ -55,7 +55,7 @@ exp_(const float val) {
return
expf
(
val
);
}
#ifndef ENABLE_ILUVATAR_
CUDA_
API
#ifndef ENABLE_ILUVATAR_API
__forceinline__
__device__
long
double
exp_
(
const
long
double
val
)
{
return
expl
(
val
);
...
...
src/infiniop/ops/add/operator.cc
View file @
95623d82
...
...
@@ -5,7 +5,7 @@
#ifdef ENABLE_CPU_API
#include "cpu/add_cpu.h"
#endif
#ifdef
ENABLE_NVIDIA_API
#if
def
ined(
ENABLE_NVIDIA_API
) || defined(ENABLE_ILUVATAR_API)
#include "nvidia/add_nvidia.cuh"
#endif
#ifdef ENABLE_METAX_API
...
...
@@ -36,6 +36,9 @@ __C infiniStatus_t infiniopCreateAddDescriptor(
#ifdef ENABLE_NVIDIA_API
CREATE
(
INFINI_DEVICE_NVIDIA
,
nvidia
);
#endif
#ifdef ENABLE_ILUVATAR_API
CREATE
(
INFINI_DEVICE_ILUVATAR
,
nvidia
);
#endif
#ifdef ENABLE_METAX_API
CREATE
(
INFINI_DEVICE_METAX
,
metax
);
#endif
...
...
@@ -61,6 +64,9 @@ __C infiniStatus_t infiniopGetAddWorkspaceSize(infiniopAddDescriptor_t desc, siz
#ifdef ENABLE_NVIDIA_API
GET
(
INFINI_DEVICE_NVIDIA
,
nvidia
);
#endif
#ifdef ENABLE_ILUVATAR_API
GET
(
INFINI_DEVICE_ILUVATAR
,
nvidia
);
#endif
#ifdef ENABLE_METAX_API
GET
(
INFINI_DEVICE_METAX
,
metax
);
#endif
...
...
@@ -94,6 +100,9 @@ __C infiniStatus_t infiniopAdd(
#ifdef ENABLE_NVIDIA_API
CALCULATE
(
INFINI_DEVICE_NVIDIA
,
nvidia
);
#endif
#ifdef ENABLE_ILUVATAR_API
CALCULATE
(
INFINI_DEVICE_ILUVATAR
,
nvidia
);
#endif
#ifdef ENABLE_METAX_API
CALCULATE
(
INFINI_DEVICE_METAX
,
metax
);
#endif
...
...
@@ -121,6 +130,9 @@ infiniopDestroyAddDescriptor(infiniopAddDescriptor_t desc) {
#ifdef ENABLE_NVIDIA_API
DELETE
(
INFINI_DEVICE_NVIDIA
,
nvidia
);
#endif
#ifdef ENABLE_ILUVATAR_API
DELETE
(
INFINI_DEVICE_ILUVATAR
,
nvidia
);
#endif
#ifdef ENABLE_METAX_API
DELETE
(
INFINI_DEVICE_METAX
,
metax
);
#endif
...
...
src/infiniop/ops/causal_softmax/operator.cc
View file @
95623d82
...
...
@@ -5,7 +5,7 @@
#ifdef ENABLE_CPU_API
#include "cpu/causal_softmax_cpu.h"
#endif
#ifdef
ENABLE_NVIDIA_API
#if
def
ined(
ENABLE_NVIDIA_API
) || defined(ENABLE_ILUVATAR_API)
#include "nvidia/causal_softmax_nvidia.cuh"
#endif
#ifdef ENABLE_METAX_API
...
...
@@ -36,6 +36,9 @@ __C infiniStatus_t infiniopCreateCausalSoftmaxDescriptor(
#ifdef ENABLE_NVIDIA_API
CREATE
(
INFINI_DEVICE_NVIDIA
,
nvidia
)
#endif
#ifdef ENABLE_ILUVATAR_API
CREATE
(
INFINI_DEVICE_ILUVATAR
,
nvidia
);
#endif
#ifdef ENABLE_METAX_API
CREATE
(
INFINI_DEVICE_METAX
,
metax
)
#endif
...
...
@@ -71,6 +74,9 @@ __C infiniStatus_t infiniopGetCausalSoftmaxWorkspaceSize(infiniopCausalSoftmaxDe
#ifdef ENABLE_NVIDIA_API
GET
(
INFINI_DEVICE_NVIDIA
,
nvidia
)
#endif
#ifdef ENABLE_ILUVATAR_API
GET
(
INFINI_DEVICE_ILUVATAR
,
nvidia
);
#endif
#ifdef ENABLE_METAX_API
GET
(
INFINI_DEVICE_METAX
,
metax
)
#endif
...
...
@@ -112,6 +118,9 @@ __C infiniStatus_t infiniopCausalSoftmax(
#ifdef ENABLE_NVIDIA_API
CALCULATE
(
INFINI_DEVICE_NVIDIA
,
nvidia
)
#endif
#ifdef ENABLE_ILUVATAR_API
CALCULATE
(
INFINI_DEVICE_ILUVATAR
,
nvidia
);
#endif
#ifdef ENABLE_METAX_API
CALCULATE
(
INFINI_DEVICE_METAX
,
metax
)
#endif
...
...
@@ -147,6 +156,9 @@ __C infiniStatus_t infiniopDestroyCausalSoftmaxDescriptor(infiniopCausalSoftmaxD
#ifdef ENABLE_NVIDIA_API
DESTROY
(
INFINI_DEVICE_NVIDIA
,
nvidia
)
#endif
#ifdef ENABLE_ILUVATAR_API
DESTROY
(
INFINI_DEVICE_ILUVATAR
,
nvidia
);
#endif
#ifdef ENABLE_METAX_API
DESTROY
(
INFINI_DEVICE_METAX
,
metax
)
#endif
...
...
src/infiniop/ops/clip/cuda/kernel.cuh
View file @
95623d82
...
...
@@ -10,7 +10,7 @@ public:
template
<
typename
T
>
__device__
__forceinline__
T
operator
()(
const
T
&
x
,
const
T
&
min_val
,
const
T
&
max_val
)
const
{
if
constexpr
(
std
::
is_same_v
<
T
,
half2
>
||
std
::
is_same_v
<
T
,
cuda_bfloat162
>
)
{
#ifndef ENABLE_ILUVATAR_
CUDA_
API
#ifndef ENABLE_ILUVATAR_API
return
__hmax2
(
__hmin2
(
x
,
max_val
),
min_val
);
#else
return
{
std
::
clamp
(
x
.
x
,
min_val
.
x
,
max_val
.
x
),
std
::
clamp
(
x
.
y
,
min_val
.
y
,
max_val
.
y
)};
...
...
src/infiniop/ops/clip/operator.cc
View file @
95623d82
...
...
@@ -5,7 +5,7 @@
#ifdef ENABLE_CPU_API
#include "cpu/clip_cpu.h"
#endif
#ifdef
ENABLE_NVIDIA_API
#if
def
ined(
ENABLE_NVIDIA_API
) || defined(ENABLE_ILUVATAR_API)
#include "nvidia/clip_nvidia.cuh"
#endif
#ifdef ENABLE_METAX_API
...
...
@@ -36,6 +36,9 @@ __C infiniStatus_t infiniopCreateClipDescriptor(
#ifdef ENABLE_NVIDIA_API
CREATE
(
INFINI_DEVICE_NVIDIA
,
nvidia
);
#endif
#ifdef ENABLE_ILUVATAR_API
CREATE
(
INFINI_DEVICE_ILUVATAR
,
nvidia
);
#endif
#ifdef ENABLE_METAX_API
CREATE
(
INFINI_DEVICE_METAX
,
metax
);
#endif
...
...
@@ -61,6 +64,9 @@ __C infiniStatus_t infiniopGetClipWorkspaceSize(infiniopClipDescriptor_t desc, s
#ifdef ENABLE_NVIDIA_API
GET
(
INFINI_DEVICE_NVIDIA
,
nvidia
)
#endif
#ifdef ENABLE_ILUVATAR_API
GET
(
INFINI_DEVICE_ILUVATAR
,
nvidia
);
#endif
#ifdef ENABLE_METAX_API
GET
(
INFINI_DEVICE_METAX
,
metax
)
#endif
...
...
@@ -94,6 +100,9 @@ __C infiniStatus_t infiniopClip(
#ifdef ENABLE_NVIDIA_API
CALCULATE
(
INFINI_DEVICE_NVIDIA
,
nvidia
);
#endif
#ifdef ENABLE_ILUVATAR_API
CALCULATE
(
INFINI_DEVICE_ILUVATAR
,
nvidia
);
#endif
#ifdef ENABLE_METAX_API
CALCULATE
(
INFINI_DEVICE_METAX
,
metax
);
#endif
...
...
@@ -121,6 +130,9 @@ infiniopDestroyClipDescriptor(infiniopClipDescriptor_t desc) {
#ifdef ENABLE_NVIDIA_API
DELETE
(
INFINI_DEVICE_NVIDIA
,
nvidia
);
#endif
#ifdef ENABLE_ILUVATAR_API
DELETE
(
INFINI_DEVICE_ILUVATAR
,
nvidia
);
#endif
#ifdef ENABLE_METAX_API
DELETE
(
INFINI_DEVICE_METAX
,
metax
);
#endif
...
...
src/infiniop/ops/conv/nvidia/conv_nvidia.cu
View file @
95623d82
...
...
@@ -345,7 +345,7 @@ public:
}
return
utils
::
Result
<
Opaque
>
(
std
::
move
(
opaque
));
#else
return
INFINI_STATUS_
SUCCESS
;
return
INFINI_STATUS_
NOT_IMPLEMENTED
;
#endif
}
};
...
...
@@ -380,7 +380,7 @@ infiniStatus_t Descriptor::create(
auto
conv_info
=
result
.
take
();
auto
opaque_result
=
Opaque
::
create
(
handle
->
internal
(),
conv_info
,
dtype
);
CHECK_RESULT
(
opaque_result
);
auto
opaque
=
new
Opaque
(
std
::
move
(
opaque_result
.
take
())
)
;
auto
opaque
=
new
Opaque
(
opaque_result
.
take
());
*
desc_ptr
=
new
Descriptor
(
dtype
,
...
...
@@ -391,7 +391,7 @@ infiniStatus_t Descriptor::create(
handle
->
device_id
);
return
INFINI_STATUS_SUCCESS
;
#else
return
INFINI_STATUS_
SUCCESS
;
return
INFINI_STATUS_
NOT_IMPLEMENTED
;
#endif
}
...
...
@@ -450,7 +450,7 @@ infiniStatus_t Descriptor::calculate(
return
INFINI_STATUS_SUCCESS
;
#else
return
INFINI_STATUS_
SUCCESS
;
return
INFINI_STATUS_
NOT_IMPLEMENTED
;
#endif
}
}
// namespace op::conv::nvidia
src/infiniop/ops/conv/operator.cc
View file @
95623d82
...
...
@@ -5,7 +5,7 @@
#ifdef ENABLE_CPU_API
#include "cpu/conv_cpu.h"
#endif
#ifdef
ENABLE_NVIDIA_API
#if
def
ined(
ENABLE_NVIDIA_API
) || defined(ENABLE_ILUVATAR_API)
#include "nvidia/conv_nvidia.cuh"
#endif
...
...
@@ -39,6 +39,10 @@ __C __export infiniStatus_t infiniopCreateConvDescriptor(infiniopHandle_t handle
#ifdef ENABLE_NVIDIA_API
CREATE
(
INFINI_DEVICE_NVIDIA
,
nvidia
);
#endif
#ifdef ENABLE_ILUVATAR_API
CREATE
(
INFINI_DEVICE_ILUVATAR
,
nvidia
);
#endif
default:
return
INFINI_STATUS_DEVICE_TYPE_NOT_SUPPORTED
;
}
...
...
@@ -63,6 +67,10 @@ infiniopGetConvWorkspaceSize(
#ifdef ENABLE_NVIDIA_API
GET
(
INFINI_DEVICE_NVIDIA
,
nvidia
);
#endif
#ifdef ENABLE_ILUVATAR_API
GET
(
INFINI_DEVICE_ILUVATAR
,
nvidia
);
#endif
default:
return
INFINI_STATUS_DEVICE_TYPE_NOT_SUPPORTED
;
}
...
...
@@ -95,6 +103,9 @@ __C infiniStatus_t infiniopConv(
#ifdef ENABLE_NVIDIA_API
CALCULATE
(
INFINI_DEVICE_NVIDIA
,
nvidia
);
#endif
#ifdef ENABLE_ILUVATAR_API
CALCULATE
(
INFINI_DEVICE_ILUVATAR
,
nvidia
);
#endif
default:
return
INFINI_STATUS_DEVICE_TYPE_NOT_SUPPORTED
;
...
...
@@ -116,6 +127,10 @@ infiniopDestroyConvDescriptor(infiniopConvDescriptor_t desc) {
#ifdef ENABLE_NVIDIA_API
DELETE
(
INFINI_DEVICE_NVIDIA
,
nvidia
);
#endif
#ifdef ENABLE_ILUVATAR_API
DELETE
(
INFINI_DEVICE_ILUVATAR
,
nvidia
);
#endif
default:
return
INFINI_STATUS_DEVICE_TYPE_NOT_SUPPORTED
;
}
...
...
src/infiniop/ops/gemm/nvidia/gemm_nvidia.cu
View file @
95623d82
...
...
@@ -43,7 +43,7 @@ infiniStatus_t Descriptor::calculate(
void
*
stream
)
const
{
cudaDataType
a_type
,
b_type
,
c_type
;
#ifdef ENABLE_ILUVATAR_
CUDA_
API
#ifdef ENABLE_ILUVATAR_API
cudaDataType
compute_type
;
#else
cublasComputeType_t
compute_type
;
...
...
@@ -52,7 +52,7 @@ infiniStatus_t Descriptor::calculate(
switch
(
_dtype
)
{
case
INFINI_DTYPE_F16
:
a_type
=
b_type
=
c_type
=
CUDA_R_16F
;
#ifdef ENABLE_ILUVATAR_
CUDA_
API
#ifdef ENABLE_ILUVATAR_API
compute_type
=
CUDA_R_32F
;
#else
compute_type
=
CUBLAS_COMPUTE_32F
;
...
...
@@ -60,7 +60,7 @@ infiniStatus_t Descriptor::calculate(
break
;
case
INFINI_DTYPE_BF16
:
a_type
=
b_type
=
c_type
=
CUDA_R_16BF
;
#ifdef ENABLE_ILUVATAR_
CUDA_
API
#ifdef ENABLE_ILUVATAR_API
compute_type
=
CUDA_R_32F
;
#else
compute_type
=
CUBLAS_COMPUTE_32F
;
...
...
@@ -68,7 +68,7 @@ infiniStatus_t Descriptor::calculate(
break
;
case
INFINI_DTYPE_F32
:
a_type
=
b_type
=
c_type
=
CUDA_R_32F
;
#if defined ENABLE_ILUVATAR_
CUDA_
API
#if defined ENABLE_ILUVATAR_API
compute_type
=
CUDA_R_32F
;
#elif defined ENABLE_SUGON_CUDA_API
compute_type
=
CUBLAS_COMPUTE_32F
;
...
...
src/infiniop/ops/gemm/operator.cc
View file @
95623d82
...
...
@@ -5,7 +5,7 @@
#ifdef ENABLE_CPU_API
#include "cpu/gemm_cpu.h"
#endif
#ifdef
ENABLE_NVIDIA_API
#if
def
ined(
ENABLE_NVIDIA_API
) || defined(ENABLE_ILUVATAR_API)
#include "nvidia/gemm_nvidia.cuh"
#endif
#ifdef ENABLE_CAMBRICON_API
...
...
@@ -48,6 +48,9 @@ __C infiniStatus_t infiniopCreateGemmDescriptor(
#ifdef ENABLE_NVIDIA_API
CREATE
(
INFINI_DEVICE_NVIDIA
,
nvidia
);
#endif
#ifdef ENABLE_ILUVATAR_API
CREATE
(
INFINI_DEVICE_ILUVATAR
,
nvidia
);
#endif
#ifdef ENABLE_CAMBRICON_API
CREATE
(
INFINI_DEVICE_CAMBRICON
,
bang
);
#endif
...
...
@@ -90,6 +93,9 @@ infiniopGetGemmWorkspaceSize(
#ifdef ENABLE_NVIDIA_API
GET
(
INFINI_DEVICE_NVIDIA
,
nvidia
);
#endif
#ifdef ENABLE_ILUVATAR_API
GET
(
INFINI_DEVICE_ILUVATAR
,
nvidia
);
#endif
#ifdef ENABLE_CAMBRICON_API
GET
(
INFINI_DEVICE_CAMBRICON
,
bang
);
#endif
...
...
@@ -139,6 +145,9 @@ __C infiniStatus_t infiniopGemm(
#ifdef ENABLE_NVIDIA_API
CALCULATE
(
INFINI_DEVICE_NVIDIA
,
nvidia
);
#endif
#ifdef ENABLE_ILUVATAR_API
CALCULATE
(
INFINI_DEVICE_ILUVATAR
,
nvidia
);
#endif
#ifdef ENABLE_CAMBRICON_API
CALCULATE
(
INFINI_DEVICE_CAMBRICON
,
bang
);
#endif
...
...
@@ -178,6 +187,9 @@ infiniopDestroyGemmDescriptor(infiniopGemmDescriptor_t desc) {
#ifdef ENABLE_NVIDIA_API
DELETE
(
INFINI_DEVICE_NVIDIA
,
nvidia
);
#endif
#ifdef ENABLE_ILUVATAR_API
DELETE
(
INFINI_DEVICE_ILUVATAR
,
nvidia
);
#endif
#ifdef ENABLE_CAMBRICON_API
DELETE
(
INFINI_DEVICE_CAMBRICON
,
bang
);
#endif
...
...
src/infiniop/ops/mul/operator.cc
View file @
95623d82
...
...
@@ -5,7 +5,7 @@
#ifdef ENABLE_CPU_API
#include "cpu/mul_cpu.h"
#endif
#ifdef
ENABLE_NVIDIA_API
#if
def
ined(
ENABLE_NVIDIA_API
) || defined(ENABLE_ILUVATAR_API)
#include "nvidia/mul_nvidia.cuh"
#endif
#ifdef ENABLE_METAX_API
...
...
@@ -36,6 +36,9 @@ __C infiniStatus_t infiniopCreateMulDescriptor(
#ifdef ENABLE_NVIDIA_API
CREATE
(
INFINI_DEVICE_NVIDIA
,
nvidia
);
#endif
#ifdef ENABLE_ILUVATAR_API
CREATE
(
INFINI_DEVICE_ILUVATAR
,
nvidia
);
#endif
#ifdef ENABLE_METAX_API
CREATE
(
INFINI_DEVICE_METAX
,
metax
);
#endif
...
...
@@ -61,9 +64,13 @@ __C infiniStatus_t infiniopGetMulWorkspaceSize(infiniopMulDescriptor_t desc, siz
#ifdef ENABLE_NVIDIA_API
GET
(
INFINI_DEVICE_NVIDIA
,
nvidia
);
#endif
#ifdef ENABLE_ILUVATAR_API
GET
(
INFINI_DEVICE_ILUVATAR
,
nvidia
);
#endif
#ifdef ENABLE_METAX_API
GET
(
INFINI_DEVICE_METAX
,
metax
);
#endif
default:
return
INFINI_STATUS_DEVICE_TYPE_NOT_SUPPORTED
;
}
...
...
@@ -94,6 +101,9 @@ __C infiniStatus_t infiniopMul(
#ifdef ENABLE_NVIDIA_API
CALCULATE
(
INFINI_DEVICE_NVIDIA
,
nvidia
);
#endif
#ifdef ENABLE_ILUVATAR_API
CALCULATE
(
INFINI_DEVICE_ILUVATAR
,
nvidia
);
#endif
#ifdef ENABLE_METAX_API
CALCULATE
(
INFINI_DEVICE_METAX
,
metax
);
#endif
...
...
@@ -121,6 +131,9 @@ infiniopDestroyMulDescriptor(infiniopMulDescriptor_t desc) {
#ifdef ENABLE_NVIDIA_API
DELETE
(
INFINI_DEVICE_NVIDIA
,
nvidia
);
#endif
#ifdef ENABLE_ILUVATAR_API
DELETE
(
INFINI_DEVICE_ILUVATAR
,
nvidia
);
#endif
#ifdef ENABLE_METAX_API
DELETE
(
INFINI_DEVICE_METAX
,
metax
);
#endif
...
...
src/infiniop/ops/random_sample/operator.cc
View file @
95623d82
...
...
@@ -5,7 +5,7 @@
#ifdef ENABLE_CPU_API
#include "cpu/random_sample_cpu.h"
#endif
#ifdef
ENABLE_NVIDIA_API
#if
def
ined(
ENABLE_NVIDIA_API
) || defined(ENABLE_ILUVATAR_API)
#include "nvidia/random_sample_nvidia.cuh"
#endif
#ifdef ENABLE_METAX_API
...
...
@@ -38,6 +38,9 @@ infiniopCreateRandomSampleDescriptor(
#ifdef ENABLE_NVIDIA_API
CREATE
(
INFINI_DEVICE_NVIDIA
,
nvidia
);
#endif
#ifdef ENABLE_ILUVATAR_API
CREATE
(
INFINI_DEVICE_ILUVATAR
,
nvidia
);
#endif
#ifdef ENABLE_METAX_API
CREATE
(
INFINI_DEVICE_METAX
,
metax
);
#endif
...
...
@@ -71,6 +74,9 @@ __C infiniStatus_t infiniopGetRandomSampleWorkspaceSize(
#ifdef ENABLE_NVIDIA_API
GET
(
INFINI_DEVICE_NVIDIA
,
nvidia
);
#endif
#ifdef ENABLE_ILUVATAR_API
GET
(
INFINI_DEVICE_ILUVATAR
,
nvidia
);
#endif
#ifdef ENABLE_METAX_API
GET
(
INFINI_DEVICE_METAX
,
metax
);
#endif
...
...
@@ -114,6 +120,9 @@ __C infiniStatus_t infiniopRandomSample(
#ifdef ENABLE_NVIDIA_API
CALCULATE
(
INFINI_DEVICE_NVIDIA
,
nvidia
);
#endif
#ifdef ENABLE_ILUVATAR_API
CALCULATE
(
INFINI_DEVICE_ILUVATAR
,
nvidia
);
#endif
#ifdef ENABLE_METAX_API
CALCULATE
(
INFINI_DEVICE_METAX
,
metax
);
#endif
...
...
@@ -144,6 +153,9 @@ __C infiniStatus_t infiniopDestroyRandomSampleDescriptor(
#ifdef ENABLE_NVIDIA_API
DELETE
(
INFINI_DEVICE_NVIDIA
,
nvidia
);
#endif
#ifdef ENABLE_ILUVATAR_API
DELETE
(
INFINI_DEVICE_ILUVATAR
,
nvidia
);
#endif
#ifdef ENABLE_METAX_API
DELETE
(
INFINI_DEVICE_METAX
,
metax
);
#endif
...
...
src/infiniop/ops/rearrange/operator.cc
View file @
95623d82
...
...
@@ -8,8 +8,7 @@
#ifdef ENABLE_ASCEND_API
#include "ascend/rearrange_ascend.h"
#endif
#ifdef ENABLE_NVIDIA_API
#if defined(ENABLE_NVIDIA_API) || defined(ENABLE_ILUVATAR_API)
#include "nvidia/rearrange_nvidia.cuh"
#endif
#ifdef ENABLE_METAX_API
...
...
@@ -42,6 +41,9 @@ __C infiniStatus_t infiniopCreateRearrangeDescriptor(
#ifdef ENABLE_NVIDIA_API
CREATE
(
INFINI_DEVICE_NVIDIA
,
nvidia
);
#endif
#ifdef ENABLE_ILUVATAR_API
CREATE
(
INFINI_DEVICE_ILUVATAR
,
nvidia
);
#endif
#ifdef ENABLE_METAX_API
CREATE
(
INFINI_DEVICE_METAX
,
metax
);
#endif
...
...
@@ -75,6 +77,9 @@ __C infiniStatus_t infiniopRearrange(
#ifdef ENABLE_NVIDIA_API
CALCULATE
(
INFINI_DEVICE_NVIDIA
,
nvidia
);
#endif
#ifdef ENABLE_ILUVATAR_API
CALCULATE
(
INFINI_DEVICE_ILUVATAR
,
nvidia
);
#endif
#ifdef ENABLE_METAX_API
CALCULATE
(
INFINI_DEVICE_METAX
,
metax
);
#endif
...
...
@@ -102,10 +107,12 @@ __C infiniStatus_t infiniopDestroyRearrangeDescriptor(
#ifdef ENABLE_ASCEND_API
DELETE
(
INFINI_DEVICE_ASCEND
,
ascend
);
#endif
#ifdef ENABLE_NVIDIA_API
DELETE
(
INFINI_DEVICE_NVIDIA
,
nvidia
);
#endif
#ifdef ENABLE_ILUVATAR_API
DELETE
(
INFINI_DEVICE_ILUVATAR
,
nvidia
);
#endif
#ifdef ENABLE_METAX_API
DELETE
(
INFINI_DEVICE_METAX
,
metax
);
#endif
...
...
src/infiniop/ops/rms_norm/operator.cc
View file @
95623d82
...
...
@@ -5,7 +5,7 @@
#ifdef ENABLE_CPU_API
#include "cpu/rms_norm_cpu.h"
#endif
#ifdef
ENABLE_NVIDIA_API
#if
def
ined(
ENABLE_NVIDIA_API
) || defined(ENABLE_ILUVATAR_API)
#include "nvidia/rms_norm_nvidia.cuh"
#endif
#ifdef ENABLE_ASCEND_API
...
...
@@ -46,6 +46,9 @@ __C infiniStatus_t infiniopCreateRMSNormDescriptor(
#ifdef ENABLE_NVIDIA_API
CREATE
(
INFINI_DEVICE_NVIDIA
,
nvidia
);
#endif
#ifdef ENABLE_ILUVATAR_API
CREATE
(
INFINI_DEVICE_ILUVATAR
,
nvidia
);
#endif
#ifdef ENABLE_KUNLUN_API
CREATE
(
INFINI_DEVICE_KUNLUN
,
kunlun
);
#endif
...
...
@@ -84,6 +87,9 @@ __C infiniStatus_t infiniopGetRMSNormWorkspaceSize(infiniopRMSNormDescriptor_t d
#ifdef ENABLE_NVIDIA_API
GET
(
INFINI_DEVICE_NVIDIA
,
nvidia
);
#endif
#ifdef ENABLE_ILUVATAR_API
GET
(
INFINI_DEVICE_ILUVATAR
,
nvidia
);
#endif
#ifdef ENABLE_KUNLUN_API
GET
(
INFINI_DEVICE_KUNLUN
,
kunlun
);
#endif
...
...
@@ -123,6 +129,9 @@ __C infiniStatus_t infiniopRMSNorm(infiniopRMSNormDescriptor_t desc, void *works
#ifdef ENABLE_NVIDIA_API
CALCULATE
(
INFINI_DEVICE_NVIDIA
,
nvidia
);
#endif
#ifdef ENABLE_ILUVATAR_API
CALCULATE
(
INFINI_DEVICE_ILUVATAR
,
nvidia
);
#endif
#ifdef ENABLE_KUNLUN_API
CALCULATE
(
INFINI_DEVICE_KUNLUN
,
kunlun
);
#endif
...
...
@@ -161,6 +170,9 @@ __C infiniStatus_t infiniopDestroyRMSNormDescriptor(infiniopRMSNormDescriptor_t
#ifdef ENABLE_NVIDIA_API
DESTROY
(
INFINI_DEVICE_NVIDIA
,
nvidia
);
#endif
#ifdef ENABLE_ILUVATAR_API
DESTROY
(
INFINI_DEVICE_ILUVATAR
,
nvidia
);
#endif
#ifdef ENABLE_KUNLUN_API
DESTROY
(
INFINI_DEVICE_KUNLUN
,
kunlun
);
#endif
...
...
src/infiniop/ops/rope/operator.cc
View file @
95623d82
...
...
@@ -5,7 +5,7 @@
#ifdef ENABLE_CPU_API
#include "cpu/rope_cpu.h"
#endif
#ifdef
ENABLE_NVIDIA_API
#if
def
ined(
ENABLE_NVIDIA_API
) || defined(ENABLE_ILUVATAR_API)
#include "nvidia/rope_nvidia.cuh"
#endif
#ifdef ENABLE_ASCEND_API
...
...
@@ -42,6 +42,9 @@ __C infiniStatus_t infiniopCreateRoPEDescriptor(
#ifdef ENABLE_NVIDIA_API
CREATE
(
INFINI_DEVICE_NVIDIA
,
nvidia
);
#endif
#ifdef ENABLE_ILUVATAR_API
CREATE
(
INFINI_DEVICE_ILUVATAR
,
nvidia
);
#endif
#ifdef ENABLE_METAX_API
CREATE
(
INFINI_DEVICE_METAX
,
metax
);
#endif
...
...
@@ -83,6 +86,9 @@ __C infiniStatus_t infiniopGetRoPEWorkspaceSize(infiniopRoPEDescriptor_t desc,
#ifdef ENABLE_NVIDIA_API
GET
(
INFINI_DEVICE_NVIDIA
,
nvidia
);
#endif
#ifdef ENABLE_ILUVATAR_API
GET
(
INFINI_DEVICE_ILUVATAR
,
nvidia
);
#endif
#ifdef ENABLE_METAX_API
GET
(
INFINI_DEVICE_METAX
,
metax
);
#endif
...
...
@@ -134,6 +140,9 @@ __C infiniStatus_t infiniopRoPE(
#ifdef ENABLE_NVIDIA_API
CALCULATE
(
INFINI_DEVICE_NVIDIA
,
nvidia
);
#endif
#ifdef ENABLE_ILUVATAR_API
CALCULATE
(
INFINI_DEVICE_ILUVATAR
,
nvidia
);
#endif
#ifdef ENABLE_METAX_API
CALCULATE
(
INFINI_DEVICE_METAX
,
metax
);
#endif
...
...
@@ -180,6 +189,9 @@ infiniopDestroyRoPEDescriptor(infiniopRoPEDescriptor_t desc) {
#ifdef ENABLE_NVIDIA_API
DELETE
(
INFINI_DEVICE_NVIDIA
,
nvidia
);
#endif
#ifdef ENABLE_ILUVATAR_API
DELETE
(
INFINI_DEVICE_ILUVATAR
,
nvidia
);
#endif
#ifdef ENABLE_METAX_API
DELETE
(
INFINI_DEVICE_METAX
,
metax
);
#endif
...
...
src/infiniop/ops/sub/operator.cc
View file @
95623d82
...
...
@@ -5,7 +5,7 @@
#ifdef ENABLE_CPU_API
#include "cpu/sub_cpu.h"
#endif
#ifdef
ENABLE_NVIDIA_API
#if
def
ined(
ENABLE_NVIDIA_API
) || defined(ENABLE_ILUVATAR_API)
#include "nvidia/sub_nvidia.cuh"
#endif
#ifdef ENABLE_METAX_API
...
...
@@ -36,6 +36,9 @@ __C infiniStatus_t infiniopCreateSubDescriptor(
#ifdef ENABLE_NVIDIA_API
CREATE
(
INFINI_DEVICE_NVIDIA
,
nvidia
);
#endif
#ifdef ENABLE_ILUVATAR_API
CREATE
(
INFINI_DEVICE_ILUVATAR
,
nvidia
);
#endif
#ifdef ENABLE_METAX_API
CREATE
(
INFINI_DEVICE_METAX
,
metax
);
#endif
...
...
@@ -61,6 +64,9 @@ __C infiniStatus_t infiniopGetSubWorkspaceSize(infiniopSubDescriptor_t desc, siz
#ifdef ENABLE_NVIDIA_API
GET
(
INFINI_DEVICE_NVIDIA
,
nvidia
);
#endif
#ifdef ENABLE_ILUVATAR_API
GET
(
INFINI_DEVICE_ILUVATAR
,
nvidia
);
#endif
#ifdef ENABLE_METAX_API
GET
(
INFINI_DEVICE_METAX
,
metax
);
#endif
...
...
@@ -94,6 +100,9 @@ __C infiniStatus_t infiniopSub(
#ifdef ENABLE_NVIDIA_API
CALCULATE
(
INFINI_DEVICE_NVIDIA
,
nvidia
);
#endif
#ifdef ENABLE_ILUVATAR_API
CALCULATE
(
INFINI_DEVICE_ILUVATAR
,
nvidia
);
#endif
#ifdef ENABLE_METAX_API
CALCULATE
(
INFINI_DEVICE_METAX
,
metax
);
#endif
...
...
@@ -121,6 +130,9 @@ infiniopDestroySubDescriptor(infiniopSubDescriptor_t desc) {
#ifdef ENABLE_NVIDIA_API
DELETE
(
INFINI_DEVICE_NVIDIA
,
nvidia
);
#endif
#ifdef ENABLE_ILUVATAR_API
DELETE
(
INFINI_DEVICE_ILUVATAR
,
nvidia
);
#endif
#ifdef ENABLE_METAX_API
DELETE
(
INFINI_DEVICE_METAX
,
metax
);
#endif
...
...
src/infiniop/ops/swiglu/operator.cc
View file @
95623d82
...
...
@@ -5,7 +5,7 @@
#ifdef ENABLE_CPU_API
#include "cpu/swiglu_cpu.h"
#endif
#ifdef
ENABLE_NVIDIA_API
#if
def
ined(
ENABLE_NVIDIA_API
) || defined(ENABLE_ILUVATAR_API)
#include "nvidia/swiglu_nvidia.cuh"
#endif
#ifdef ENABLE_KUNLUN_API
...
...
@@ -42,6 +42,9 @@ __C infiniStatus_t infiniopCreateSwiGLUDescriptor(
#ifdef ENABLE_NVIDIA_API
CREATE
(
INFINI_DEVICE_NVIDIA
,
nvidia
);
#endif
#ifdef ENABLE_ILUVATAR_API
CREATE
(
INFINI_DEVICE_ILUVATAR
,
nvidia
);
#endif
#ifdef ENABLE_KUNLUN_API
CREATE
(
INFINI_DEVICE_KUNLUN
,
kunlun
);
#endif
...
...
@@ -92,6 +95,9 @@ __C infiniStatus_t infiniopGetSwiGLUWorkspaceSize(infiniopSwiGLUDescriptor_t des
#ifdef ENABLE_NVIDIA_API
GET
(
INFINI_DEVICE_NVIDIA
,
nvidia
);
#endif
#ifdef ENABLE_ILUVATAR_API
GET
(
INFINI_DEVICE_ILUVATAR
,
nvidia
);
#endif
#ifdef ENABLE_KUNLUN_API
GET
(
INFINI_DEVICE_KUNLUN
,
kunlun
);
#endif
...
...
@@ -140,6 +146,9 @@ __C infiniStatus_t infiniopSwiGLU(
#ifdef ENABLE_NVIDIA_API
CALCULATE
(
INFINI_DEVICE_NVIDIA
,
nvidia
);
#endif
#ifdef ENABLE_ILUVATAR_API
CALCULATE
(
INFINI_DEVICE_ILUVATAR
,
nvidia
);
#endif
#ifdef ENABLE_KUNLUN_API
CALCULATE
(
INFINI_DEVICE_KUNLUN
,
kunlun
);
#endif
...
...
@@ -186,6 +195,9 @@ infiniopDestroySwiGLUDescriptor(infiniopSwiGLUDescriptor_t desc) {
#ifdef ENABLE_NVIDIA_API
DELETE
(
INFINI_DEVICE_NVIDIA
,
nvidia
);
#endif
#ifdef ENABLE_ILUVATAR_API
DELETE
(
INFINI_DEVICE_ILUVATAR
,
nvidia
);
#endif
#ifdef ENABLE_KUNLUN_API
DELETE
(
INFINI_DEVICE_KUNLUN
,
kunlun
);
#endif
...
...
Prev
1
2
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment