Skip to content

Commit 65bed07

Browse files
Merge pull request #322 from YdrMaster/main
issue/291/style: 所有 maca 改为 metax
2 parents e4605f7 + 507be07 commit 65bed07

31 files changed

+175
-175
lines changed

src/infiniccl/infiniccl.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#include "./ascend/infiniccl_ascend.h"
44
#include "./cuda/infiniccl_cuda.h"
5-
#include "./maca/infiniccl_maca.h"
5+
#include "./metax/infiniccl_metax.h"
66

77
__C infiniStatus_t infinicclCommInitAll(
88
infiniDevice_t device_type,
@@ -17,7 +17,7 @@ __C infiniStatus_t infinicclCommInitAll(
1717
switch (device_type) {
1818
COMM_INIT_ALL(INFINI_DEVICE_NVIDIA, cuda)
1919
COMM_INIT_ALL(INFINI_DEVICE_ASCEND, ascend)
20-
COMM_INIT_ALL(INFINI_DEVICE_METAX, maca)
20+
COMM_INIT_ALL(INFINI_DEVICE_METAX, metax)
2121
default:
2222
return INFINI_STATUS_DEVICE_TYPE_NOT_SUPPORTED;
2323
}
@@ -37,7 +37,7 @@ __C infiniStatus_t infinicclCommDestroy(infinicclComm_t comm) {
3737
switch (comm->device_type) {
3838
COMM_DESTROY(INFINI_DEVICE_NVIDIA, cuda)
3939
COMM_DESTROY(INFINI_DEVICE_ASCEND, ascend)
40-
COMM_DESTROY(INFINI_DEVICE_METAX, maca)
40+
COMM_DESTROY(INFINI_DEVICE_METAX, metax)
4141

4242
default:
4343
return INFINI_STATUS_DEVICE_TYPE_NOT_SUPPORTED;
@@ -65,7 +65,7 @@ __C infiniStatus_t infinicclAllReduce(
6565
switch (comm->device_type) {
6666
ALL_REDUCE(INFINI_DEVICE_NVIDIA, cuda)
6767
ALL_REDUCE(INFINI_DEVICE_ASCEND, ascend)
68-
ALL_REDUCE(INFINI_DEVICE_METAX, maca)
68+
ALL_REDUCE(INFINI_DEVICE_METAX, metax)
6969

7070
default:
7171
return INFINI_STATUS_DEVICE_TYPE_NOT_SUPPORTED;

src/infiniccl/maca/infiniccl_maca.h

Lines changed: 0 additions & 12 deletions
This file was deleted.

src/infiniccl/maca/infiniccl_maca.cc renamed to src/infiniccl/metax/infiniccl_metax.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "infiniccl_maca.h"
1+
#include "infiniccl_metax.h"
22

33
#include "../../utils.h"
44

@@ -51,7 +51,7 @@ inline hcclComm_t getHcclComm(infinicclComm_t comm) {
5151
return static_cast<hcclComm_t>(comm->comm);
5252
}
5353

54-
namespace infiniccl::maca {
54+
namespace infiniccl::metax {
5555

5656
infiniStatus_t commInitAll(
5757
infinicclComm_t *comms,
@@ -92,4 +92,4 @@ infiniStatus_t allReduce(
9292

9393
return INFINI_STATUS_SUCCESS;
9494
}
95-
} // namespace infiniccl::maca
95+
} // namespace infiniccl::metax
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#ifndef INFINICCL_METAX_H_
2+
#define INFINICCL_METAX_H_
3+
4+
#include "../infiniccl_impl.h"
5+
6+
#if defined(ENABLE_METAX_API) && defined(ENABLE_CCL)
7+
INFINICCL_DEVICE_API_IMPL(metax)
8+
#else
9+
INFINICCL_DEVICE_API_NOOP(metax)
10+
#endif
11+
12+
#endif /* INFINICCL_METAX_H_ */

src/infiniop/devices/handle.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#include "kunlun/kunlun_handle.h"
2222
#endif
2323
#ifdef ENABLE_METAX_API
24-
#include "maca/maca_handle.h"
24+
#include "metax/metax_handle.h"
2525
#endif
2626

2727
__C infiniStatus_t infiniopCreateHandle(infiniopHandle_t *handle_ptr) {
@@ -57,7 +57,7 @@ __C infiniStatus_t infiniopCreateHandle(infiniopHandle_t *handle_ptr) {
5757
CREATE(INFINI_DEVICE_KUNLUN, kunlun);
5858
#endif
5959
#ifdef ENABLE_METAX_API
60-
CREATE(INFINI_DEVICE_METAX, maca);
60+
CREATE(INFINI_DEVICE_METAX, metax);
6161
#endif
6262

6363
default:
@@ -94,7 +94,7 @@ __C infiniStatus_t infiniopDestroyHandle(infiniopHandle_t handle) {
9494
DELETE(INFINI_DEVICE_KUNLUN, kunlun);
9595
#endif
9696
#ifdef ENABLE_METAX_API
97-
DELETE(INFINI_DEVICE_METAX, maca);
97+
DELETE(INFINI_DEVICE_METAX, metax);
9898
#endif
9999
default:
100100
return INFINI_STATUS_DEVICE_TYPE_NOT_SUPPORTED;

src/infiniop/devices/maca/common_maca.h renamed to src/infiniop/devices/metax/metax_common.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
#include "../../../utils.h"
22
#include "../pool.h"
3-
#include "maca_handle.h"
3+
#include "metax_handle.h"
44
#include <hcblas/hcblas.h>
55
#include <hcdnn/hcdnn.h>
66
#include <memory>
77

88
#define CHECK_MCBLAS(API) CHECK_INTERNAL(API, HCBLAS_STATUS_SUCCESS)
99
#define CHECK_MCDNN(API) CHECK_INTERNAL(API, HCDNN_STATUS_SUCCESS)
1010

11-
namespace device::maca {
11+
namespace device::metax {
1212

1313
class Handle::Internal {
1414
Pool<hcblasHandle_t> mcblas_handles;
@@ -39,4 +39,4 @@ class Handle::Internal {
3939

4040
hcdnnDataType_t getHcdnnDtype(infiniDtype_t dt);
4141

42-
} // namespace device::maca
42+
} // namespace device::metax

src/infiniop/devices/maca/maca_handle.cc renamed to src/infiniop/devices/metax/metax_handle.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#include "common_maca.h"
1+
#include "metax_common.h"
22

3-
namespace device::maca {
3+
namespace device::metax {
44
Handle::Handle(infiniDevice_t device, int device_id)
55
: InfiniopHandle{device, device_id},
66
_internal(std::make_shared<Handle::Internal>(device_id)) {}
@@ -83,4 +83,4 @@ infiniStatus_t Handle::create(InfiniopHandle **handle_ptr, int device_id) {
8383
return INFINI_STATUS_SUCCESS;
8484
}
8585

86-
} // namespace device::maca
86+
} // namespace device::metax

src/infiniop/devices/maca/maca_handle.h renamed to src/infiniop/devices/metax/metax_handle.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
#ifndef __INFINIOP_MACA_HANDLE_H__
2-
#define __INFINIOP_MACA_HANDLE_H__
1+
#ifndef __INFINIOP_METAX_HANDLE_H__
2+
#define __INFINIOP_METAX_HANDLE_H__
33

44
#include "../../handle.h"
55
#include <memory>
66

7-
namespace device::maca {
7+
namespace device::metax {
88
struct Handle : public InfiniopHandle {
99
Handle(int device_id);
1010
class Internal;
@@ -20,6 +20,6 @@ struct Handle : public InfiniopHandle {
2020
std::shared_ptr<Internal> _internal;
2121
};
2222

23-
} // namespace device::maca
23+
} // namespace device::metax
2424

25-
#endif // __INFINIOP_MACA_HANDLE_H__
25+
#endif // __INFINIOP_METAX_HANDLE_H__

src/infiniop/devices/maca/maca_kernel_common.h renamed to src/infiniop/devices/metax/metax_kernel_common.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
#define INFINIOP_MACA_KERNEL __global__ void
1+
#define INFINIOP_METAX_KERNEL __global__ void
22

3-
// Posible maximum number of threads per block for MACA architectures
3+
// Posible maximum number of threads per block for METAX architectures
44
// Used for picking correct kernel launch configuration
5-
#define MACA_BLOCK_SIZE_1024 1024
6-
#define MACA_BLOCK_SIZE_512 512
5+
#define METAX_BLOCK_SIZE_1024 1024
6+
#define METAX_BLOCK_SIZE_512 512
77

8-
#define CHECK_MACA(API) CHECK_INTERNAL(API, hcSuccess)
8+
#define CHECK_METAX(API) CHECK_INTERNAL(API, hcSuccess)
99

1010
using cuda_bfloat16 = hpcc_bfloat16;
1111
using cuda_bfloat162 = hpcc_bfloat162;
1212

13-
namespace device::maca {
13+
namespace device::metax {
1414

1515
// return the memory offset of original tensor, given the flattened index of broadcasted tensor
1616
__forceinline__ __device__ __host__ size_t
@@ -41,7 +41,7 @@ indexToOffset(
4141
}
4242
return res;
4343
}
44-
} // namespace device::maca
44+
} // namespace device::metax
4545

4646
__forceinline__ __device__ float
4747
exp_(const float val) {

src/infiniop/elementwise/maca/elementwise_maca.h renamed to src/infiniop/elementwise/metax/elementwise_metax.h

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
#ifndef __INFINIOP_ELEMENTWISE_MACA_H__
2-
#define __INFINIOP_ELEMENTWISE_MACA_H__
1+
#ifndef __INFINIOP_ELEMENTWISE_METAX_H__
2+
#define __INFINIOP_ELEMENTWISE_METAX_H__
33

44
#include "../../../utils.h"
5-
#include "../../devices/maca/common_maca.h"
6-
#include "../../devices/maca/maca_kernel_common.h"
7-
#include "elementwise_maca_api.h"
5+
#include "../../devices/metax/metax_common.h"
6+
#include "../../devices/metax/metax_kernel_common.h"
7+
#include "elementwise_metax_api.h"
88

9-
namespace op::elementwise::maca {
9+
namespace op::elementwise::metax {
1010
template <typename T>
1111
__device__ __forceinline__ const T *typedInputPtr(const void *ptr) {
1212
return reinterpret_cast<const T *>(ptr);
1313
}
1414

1515
__device__ __forceinline__ size_t getOutputIndex(size_t idx, bool is_contiguous, size_t ndim,
1616
const size_t *shape, const ptrdiff_t *strides) {
17-
return is_contiguous ? idx : device::maca::indexToOffset(idx, ndim, shape, strides);
17+
return is_contiguous ? idx : device::metax::indexToOffset(idx, ndim, shape, strides);
1818
}
1919

2020
struct InputIndexer {
@@ -30,8 +30,8 @@ struct InputIndexer {
3030
return input_contiguous[input_id]
3131
? idx
3232
: (input_broadcasted[input_id]
33-
? device::maca::indexToReducedOffset(idx, ndim, output_strides, input_strides + input_id * ndim)
34-
: device::maca::indexToOffset(idx, ndim, input_shapes + input_id * ndim, input_strides + input_id * ndim));
33+
? device::metax::indexToReducedOffset(idx, ndim, output_strides, input_strides + input_id * ndim)
34+
: device::metax::indexToOffset(idx, ndim, input_shapes + input_id * ndim, input_strides + input_id * ndim));
3535
}
3636
};
3737

@@ -41,7 +41,7 @@ __device__ __forceinline__ void unpackInputsAndApply(F &&f, std::index_sequence<
4141
}
4242

4343
template <size_t N, typename Op, typename Tdata, typename... Args>
44-
INFINIOP_MACA_KERNEL elementwiseKernel(
44+
INFINIOP_METAX_KERNEL elementwiseKernel(
4545
size_t output_size,
4646
size_t ndim,
4747
bool output_contiguous,
@@ -72,7 +72,7 @@ INFINIOP_MACA_KERNEL elementwiseKernel(
7272
}
7373

7474
template <typename Op, typename Tout, typename... Tin>
75-
INFINIOP_MACA_KERNEL elementwiseKernel(
75+
INFINIOP_METAX_KERNEL elementwiseKernel(
7676
size_t output_size,
7777
size_t ndim,
7878
bool output_contiguous,
@@ -102,9 +102,9 @@ INFINIOP_MACA_KERNEL elementwiseKernel(
102102
}
103103

104104
struct DeviceImpl::Opaque {
105-
std::shared_ptr<device::maca::Handle::Internal> internal;
105+
std::shared_ptr<device::metax::Handle::Internal> internal;
106106

107-
Opaque(const std::shared_ptr<device::maca::Handle::Internal> &internal)
107+
Opaque(const std::shared_ptr<device::metax::Handle::Internal> &internal)
108108
: internal(internal) {}
109109

110110
template <uint32_t BLOCK_SIZE, size_t N, typename Op, typename Tdata, typename... Args>
@@ -159,8 +159,8 @@ struct DeviceImpl::Opaque {
159159
const int8_t *d_meta_start = reinterpret_cast<int8_t *>(workspace) + input_arr_size;
160160

161161
// copy the input pointer array and meta to device
162-
CHECK_MACA(hcMemcpyAsync(workspace, h_inputs_arr, input_arr_size, hcMemcpyHostToDevice, stream));
163-
CHECK_MACA(hcMemcpyAsync((void *)d_meta_start, info_meta_start, info.getMetaMemSize(), hcMemcpyHostToDevice, stream));
162+
CHECK_METAX(hcMemcpyAsync(workspace, h_inputs_arr, input_arr_size, hcMemcpyHostToDevice, stream));
163+
CHECK_METAX(hcMemcpyAsync((void *)d_meta_start, info_meta_start, info.getMetaMemSize(), hcMemcpyHostToDevice, stream));
164164

165165
// offset/assign the pointers
166166
d_inputs_arr = reinterpret_cast<const void **>(workspace);
@@ -259,6 +259,6 @@ infiniStatus_t DeviceImpl::calculate(const op::elementwise::ElementwiseInfo &inf
259259
std::forward<Args>(args)...);
260260
}
261261

262-
} // namespace op::elementwise::maca
262+
} // namespace op::elementwise::metax
263263

264264
#endif

0 commit comments

Comments
 (0)