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
507be07e
Commit
507be07e
authored
Jul 11, 2025
by
YdrMaster
Browse files
issue/291/style: 所有 maca 改为 metax
Signed-off-by:
YdrMaster
<
ydrml@hotmail.com
>
parent
e4605f7c
Changes
30
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
46 additions
and
46 deletions
+46
-46
src/infiniop/ops/rms_norm/metax/rms_norm_metax.maca
src/infiniop/ops/rms_norm/metax/rms_norm_metax.maca
+13
-13
src/infiniop/ops/rms_norm/operator.cc
src/infiniop/ops/rms_norm/operator.cc
+4
-4
src/infiniop/ops/rope/metax/rope_metax.h
src/infiniop/ops/rope/metax/rope_metax.h
+3
-3
src/infiniop/ops/rope/metax/rope_metax.maca
src/infiniop/ops/rope/metax/rope_metax.maca
+7
-7
src/infiniop/ops/swiglu/metax/swiglu_metax.h
src/infiniop/ops/swiglu/metax/swiglu_metax.h
+5
-5
src/infiniop/ops/swiglu/metax/swiglu_metax.maca
src/infiniop/ops/swiglu/metax/swiglu_metax.maca
+4
-4
src/infinirt/infinirt.cc
src/infinirt/infinirt.cc
+2
-2
src/infinirt/metax/infinirt_metax.cc
src/infinirt/metax/infinirt_metax.cc
+3
-3
src/infinirt/metax/infinirt_metax.h
src/infinirt/metax/infinirt_metax.h
+2
-2
xmake/metax.lua
xmake/metax.lua
+3
-3
No files found.
src/infiniop/ops/rms_norm/metax/rms_norm_metax.maca
View file @
507be07e
#include "../../../devices/m
aca/
common
_maca
.h"
#include "../../../devices/m
etax/metax_
common.h"
#include "rms_norm_metax.cuh"
#include "../../../devices/m
aca/maca
_kernel_common.h"
#include "../../../devices/m
etax/metax
_kernel_common.h"
#include <cub/block/block_reduce.cuh>
#include "../../../reduce/cuda/reduce.cuh"
...
...
@@ -9,7 +9,7 @@
#include "../cuda/kernel.cuh"
template <unsigned int BLOCK_SIZE, typename Tcompute, typename Tdata, typename Tweight>
INFINIOP_M
ACA
_KERNEL rmsnormKernel(
INFINIOP_M
ETAX
_KERNEL rmsnormKernel(
Tdata *__restrict__ y,
ptrdiff_t stride_y,
const Tdata *__restrict__ x,
...
...
@@ -20,10 +20,10 @@ INFINIOP_MACA_KERNEL rmsnormKernel(
rmsnormBlock<BLOCK_SIZE, Tcompute>(y, stride_y, x, stride_x, w, dim, epsilon);
}
namespace op::rms_norm::m
aca
{
namespace op::rms_norm::m
etax
{
struct Descriptor::Opaque {
std::shared_ptr<device::m
aca
::Handle::Internal> internal;
std::shared_ptr<device::m
etax
::Handle::Internal> internal;
};
Descriptor::~Descriptor() {
...
...
@@ -47,7 +47,7 @@ infiniStatus_t Descriptor::create(
}
*desc_ptr = new Descriptor(
new Opaque{reinterpret_cast<device::m
aca
::Handle *>(handle)->internal()},
new Opaque{reinterpret_cast<device::m
etax
::Handle *>(handle)->internal()},
std::move(info),
0,
handle->device, handle->device_id);
...
...
@@ -62,10 +62,10 @@ infiniStatus_t launchKernel(
const void *x, ptrdiff_t stride_x,
const void *w, infiniDtype_t wtype,
float epsilon,
hcStream_t
maca_
stream) {
hcStream_t stream) {
#define LAUNCH_KERNEL(Tdata, Tweight, Tcompute) \
rmsnormKernel<BLOCK_SIZE, Tcompute, Tdata, Tweight><<<batch_size, BLOCK_SIZE, 0,
maca_
stream>>>( \
rmsnormKernel<BLOCK_SIZE, Tcompute, Tdata, Tweight><<<batch_size, BLOCK_SIZE, 0, stream>>>( \
reinterpret_cast<Tdata *>(y), \
stride_y, \
reinterpret_cast<const Tdata *>(x), \
...
...
@@ -96,7 +96,7 @@ infiniStatus_t launchKernel(
infiniStatus_t Descriptor::calculate(
void *workspace, size_t workspace_size,
void *y, const void *x, const void *w,
void *stream) const {
void *stream
_
) const {
if (workspace_size < _workspace_size) {
return INFINI_STATUS_INSUFFICIENT_WORKSPACE;
...
...
@@ -106,14 +106,14 @@ infiniStatus_t Descriptor::calculate(
auto stride_y = _info.y_strides[0];
auto dim = _info.dim();
uint32_t batch_size = static_cast<uint32_t>(_info.shape[0]);
auto
maca_
stream = reinterpret_cast<hcStream_t>(stream);
auto stream = reinterpret_cast<hcStream_t>(stream
_
);
// launch kernel with different block sizes
if (_opaque->internal->maxThreadsPerBlock() == M
ACA
_BLOCK_SIZE_1024) {
CHECK_STATUS(launchKernel<M
ACA
_BLOCK_SIZE_1024>(batch_size, dim, y, _info.atype, stride_y, x, stride_x, w, _info.wtype, _info.epsilon,
maca_
stream));
if (_opaque->internal->maxThreadsPerBlock() == M
ETAX
_BLOCK_SIZE_1024) {
CHECK_STATUS(launchKernel<M
ETAX
_BLOCK_SIZE_1024>(batch_size, dim, y, _info.atype, stride_y, x, stride_x, w, _info.wtype, _info.epsilon, stream));
} else {
return INFINI_STATUS_DEVICE_ARCHITECTURE_NOT_SUPPORTED;
}
return INFINI_STATUS_SUCCESS;
}
} // namespace op::rms_norm::m
aca
} // namespace op::rms_norm::m
etax
src/infiniop/ops/rms_norm/operator.cc
View file @
507be07e
...
...
@@ -58,7 +58,7 @@ __C infiniStatus_t infiniopCreateRMSNormDescriptor(
CREATE
(
INFINI_DEVICE_ASCEND
,
ascend
);
#endif
#ifdef ENABLE_METAX_API
CREATE
(
INFINI_DEVICE_METAX
,
m
aca
);
CREATE
(
INFINI_DEVICE_METAX
,
m
etax
);
#endif
#ifdef ENABLE_MOORE_API
CREATE
(
INFINI_DEVICE_MOORE
,
musa
);
...
...
@@ -96,7 +96,7 @@ __C infiniStatus_t infiniopGetRMSNormWorkspaceSize(infiniopRMSNormDescriptor_t d
GET
(
INFINI_DEVICE_ASCEND
,
ascend
);
#endif
#ifdef ENABLE_METAX_API
GET
(
INFINI_DEVICE_METAX
,
m
aca
);
GET
(
INFINI_DEVICE_METAX
,
m
etax
);
#endif
#ifdef ENABLE_MOORE_API
GET
(
INFINI_DEVICE_MOORE
,
musa
);
...
...
@@ -135,7 +135,7 @@ __C infiniStatus_t infiniopRMSNorm(infiniopRMSNormDescriptor_t desc, void *works
CALCULATE
(
INFINI_DEVICE_ASCEND
,
ascend
);
#endif
#ifdef ENABLE_METAX_API
CALCULATE
(
INFINI_DEVICE_METAX
,
m
aca
);
CALCULATE
(
INFINI_DEVICE_METAX
,
m
etax
);
#endif
#ifdef ENABLE_MOORE_API
CALCULATE
(
INFINI_DEVICE_MOORE
,
musa
);
...
...
@@ -173,7 +173,7 @@ __C infiniStatus_t infiniopDestroyRMSNormDescriptor(infiniopRMSNormDescriptor_t
DESTROY
(
INFINI_DEVICE_ASCEND
,
ascend
);
#endif
#ifdef ENABLE_METAX_API
DESTROY
(
INFINI_DEVICE_METAX
,
m
aca
);
DESTROY
(
INFINI_DEVICE_METAX
,
m
etax
);
#endif
#ifdef ENABLE_MOORE_API
DESTROY
(
INFINI_DEVICE_MOORE
,
musa
);
...
...
src/infiniop/ops/rope/metax/rope_metax.h
View file @
507be07e
#ifndef __INFINIOP_ROPE_M
ACA
_H__
#define __INFINIOP_ROPE_M
ACA
_H__
#ifndef __INFINIOP_ROPE_M
ETAX
_H__
#define __INFINIOP_ROPE_M
ETAX
_H__
#include "../rope.h"
DESCRIPTOR
(
metax
)
#endif // __INFINIOP_ROPE_M
ACA
_H__
#endif // __INFINIOP_ROPE_M
ETAX
_H__
src/infiniop/ops/rope/metax/rope_metax.maca
View file @
507be07e
#include "../../../devices/m
aca/
common
_maca
.h"
#include "../../../devices/m
etax/metax_
common.h"
#include "rope_metax.h"
#include "../../../devices/m
aca/maca
_kernel_common.h"
#include "../../../devices/m
etax/metax
_kernel_common.h"
#include "../cuda/kernel.cuh"
template <typename Tdata, typename Tindex, typename Tangle>
INFINIOP_M
ACA
_KERNEL ropeThreadPerItemKernel(
INFINIOP_M
ETAX
_KERNEL ropeThreadPerItemKernel(
Tdata *y_,
const Tdata *x_,
const Tindex *__restrict__ pos_ids,
...
...
@@ -28,7 +28,7 @@ INFINIOP_MACA_KERNEL ropeThreadPerItemKernel(
namespace op::rope::metax {
struct Descriptor::Opaque {
std::shared_ptr<device::m
aca
::Handle::Internal> internal;
std::shared_ptr<device::m
etax
::Handle::Internal> internal;
};
Descriptor::~Descriptor() {
...
...
@@ -44,7 +44,7 @@ infiniStatus_t Descriptor::create(
infiniopTensorDescriptor_t sin_desc,
infiniopTensorDescriptor_t cos_desc) {
auto handle = reinterpret_cast<device::m
aca
::Handle *>(handle_);
auto handle = reinterpret_cast<device::m
etax
::Handle *>(handle_);
auto info = RoPEInfo::createRoPEInfo(y_desc, x_desc, pos_desc, sin_desc, cos_desc);
CHECK_RESULT(info);
...
...
@@ -53,7 +53,7 @@ infiniStatus_t Descriptor::create(
*desc_ptr = new Descriptor(
info.take(),
0,
new Opaque{reinterpret_cast<device::m
aca
::Handle *>(handle)->internal()},
new Opaque{reinterpret_cast<device::m
etax
::Handle *>(handle)->internal()},
handle->device,
handle->device_id);
...
...
@@ -141,4 +141,4 @@ infiniStatus_t Descriptor::calculate(
#undef ROPE_TYPE
#undef CALCULATE_ROPE
} // namespace op::rope::m
aca
} // namespace op::rope::m
etax
src/infiniop/ops/swiglu/metax/swiglu_metax.h
View file @
507be07e
#ifndef __SWIGLU_M
ACA
_API_H__
#define __SWIGLU_M
ACA
_API_H__
#ifndef __SWIGLU_M
ETAX
_API_H__
#define __SWIGLU_M
ETAX
_API_H__
#include "../../../elementwise/m
aca
/elementwise_m
aca
_api.h"
#include "../../../elementwise/m
etax
/elementwise_m
etax
_api.h"
ELEMENTWISE_DESCRIPTOR
(
swiglu
,
metax
,
m
aca
)
ELEMENTWISE_DESCRIPTOR
(
swiglu
,
metax
,
m
etax
)
#endif // __SWIGLU_M
ACA
_API_H__
#endif // __SWIGLU_M
ETAX
_API_H__
src/infiniop/ops/swiglu/metax/swiglu_metax.maca
View file @
507be07e
#include "swiglu_metax.h"
#include "../../../elementwise/m
aca
/elementwise_m
aca
.h"
#include "../../../elementwise/m
etax
/elementwise_m
etax
.h"
#include "../cuda/kernel.cuh"
...
...
@@ -14,7 +14,7 @@ infiniStatus_t Descriptor::create(
infiniopTensorDescriptor_t out_desc,
std::vector<infiniopTensorDescriptor_t> input_desc_vec) {
auto handle = reinterpret_cast<device::m
aca
::Handle *>(handle_);
auto handle = reinterpret_cast<device::m
etax
::Handle *>(handle_);
auto dtype = out_desc->dtype();
const auto &up_desc = input_desc_vec.at(0);
...
...
@@ -26,8 +26,8 @@ infiniStatus_t Descriptor::create(
CHECK_DTYPE(dtype, INFINI_DTYPE_F16, INFINI_DTYPE_BF16, INFINI_DTYPE_F32, INFINI_DTYPE_F64);
CHECK_SAME_SHAPE(out_shape, up_shape, gate_shape);
// create M
ACA
elementwise descriptor
CREATE_ELEMENTWISE_M
ACA
_DESCRIPTOR(handle, dtype, out_desc, input_desc_vec)
// create M
ETAX
elementwise descriptor
CREATE_ELEMENTWISE_M
ETAX
_DESCRIPTOR(handle, dtype, out_desc, input_desc_vec)
return INFINI_STATUS_SUCCESS;
}
...
...
src/infinirt/infinirt.cc
View file @
507be07e
...
...
@@ -5,7 +5,7 @@
#include "cpu/infinirt_cpu.h"
#include "cuda/infinirt_cuda.cuh"
#include "kunlun/infinirt_kunlun.h"
#include "m
aca
/infinirt_m
aca
.h"
#include "m
etax
/infinirt_m
etax
.h"
#include "musa/infinirt_musa.h"
thread_local
infiniDevice_t
CURRENT_DEVICE_TYPE
=
INFINI_DEVICE_CPU
;
...
...
@@ -62,7 +62,7 @@ __C infiniStatus_t infinirtGetDevice(infiniDevice_t *device_ptr, int *device_id_
_status = infinirt::ascend::API PARAMS; \
break; \
case INFINI_DEVICE_METAX: \
_status = infinirt::m
aca
::API PARAMS;
\
_status = infinirt::m
etax
::API PARAMS; \
break; \
case INFINI_DEVICE_MOORE: \
_status = infinirt::musa::API PARAMS; \
...
...
src/infinirt/m
aca
/infinirt_m
aca
.cc
→
src/infinirt/m
etax
/infinirt_m
etax
.cc
View file @
507be07e
#include "infinirt_m
aca
.h"
#include "infinirt_m
etax
.h"
#include "../../utils.h"
#include <hcr/hc_runtime.h>
#include <hcr/hc_runtime_api.h>
#define CHECK_MACART(RT_API) CHECK_INTERNAL(RT_API, hcSuccess)
namespace
infinirt
::
m
aca
{
namespace
infinirt
::
m
etax
{
infiniStatus_t
getDeviceCount
(
int
*
count
)
{
CHECK_MACART
(
hcGetDeviceCount
(
count
));
return
INFINI_STATUS_SUCCESS
;
...
...
@@ -124,4 +124,4 @@ infiniStatus_t freeAsync(void *ptr, infinirtStream_t stream) {
CHECK_MACART
(
hcFreeAsync
(
ptr
,
(
hcStream_t
)
stream
));
return
INFINI_STATUS_SUCCESS
;
}
}
// namespace infinirt::m
aca
}
// namespace infinirt::m
etax
src/infinirt/m
aca
/infinirt_m
aca
.h
→
src/infinirt/m
etax
/infinirt_m
etax
.h
View file @
507be07e
...
...
@@ -2,12 +2,12 @@
#define __INFINIRT_MACA_H__
#include "../infinirt_impl.h"
namespace
infinirt
::
m
aca
{
namespace
infinirt
::
m
etax
{
#ifdef ENABLE_METAX_API
INFINIRT_DEVICE_API_IMPL
#else
INFINIRT_DEVICE_API_NOOP
#endif
}
// namespace infinirt::m
aca
}
// namespace infinirt::m
etax
#endif // __INFINIRT_MACA_H__
xmake/metax.lua
View file @
507be07e
...
...
@@ -34,7 +34,7 @@ target("infiniop-metax")
set_languages
(
"cxx17"
)
set_warnings
(
"all"
,
"error"
)
add_cxflags
(
"-lstdc++"
,
"-fPIC"
,
"-Wno-defaulted-function-deleted"
,
"-Wno-strict-aliasing"
)
add_files
(
"../src/infiniop/devices/m
aca
/*.cc"
,
"../src/infiniop/ops/*/metax/*.cc"
)
add_files
(
"../src/infiniop/devices/m
etax
/*.cc"
,
"../src/infiniop/ops/*/metax/*.cc"
)
add_files
(
"../src/infiniop/ops/*/metax/*.maca"
,
{
rule
=
"maca"
})
target_end
()
...
...
@@ -45,7 +45,7 @@ target("infinirt-metax")
add_deps
(
"infini-utils"
)
set_warnings
(
"all"
,
"error"
)
add_cxflags
(
"-lstdc++ -fPIC"
)
add_files
(
"../src/infinirt/m
aca
/*.cc"
)
add_files
(
"../src/infinirt/m
etax
/*.cc"
)
target_end
()
target
(
"infiniccl-metax"
)
...
...
@@ -58,7 +58,7 @@ target("infiniccl-metax")
end
if
has_config
(
"ccl"
)
then
add_links
(
"libhccl.so"
)
add_files
(
"../src/infiniccl/m
aca
/*.cc"
)
add_files
(
"../src/infiniccl/m
etax
/*.cc"
)
end
set_languages
(
"cxx17"
)
...
...
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