Skip to content

Commit

Permalink
Merge branch 'Cambricon:master' into nl22222
Browse files Browse the repository at this point in the history
  • Loading branch information
nth-BYTE authored Dec 18, 2024
2 parents d135509 + c0cb54c commit c09dc81
Show file tree
Hide file tree
Showing 65 changed files with 2,985 additions and 1,659 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/daily.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ jobs:
strategy:
matrix:
runner: [mlu370-m8]
mlu_ops_version : [1.3.1]
cntoolkit_version : [3.14.0]
cnnl_version: [1.26.6]
mlu_ops_version : [1.4.1]
cntoolkit_version : [3.15.2]
cnnl_version: [1.28.0]
runs-on: ${{matrix.runner}}
steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/mluops_ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
strategy:
matrix:
runner: [mlu370-m8]
mlu_ops_version : [v1.3.1]
mlu_ops_version : [v1.4.1]
runs-on: [yellow]
steps:
- uses: actions/checkout@v3
Expand Down
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ endif()

# -- BANG memcheck
#TODO remove this option after cntoolkit upgraded to 4.0

set(BANG_CNCC_FLAGS "${BANG_CNCC_FLAGS} --no-neuware-version-check") # no need after toolkit 4.0

if(${MLUOP_BUILD_BANG_MEMCHECK} MATCHES "ON")
message("-- BANG memcheck enabled")
set(BANG_CNCC_FLAGS "${BANG_CNCC_FLAGS} -mllvm -enable-mlisa-sanitizer")
Expand Down Expand Up @@ -137,7 +140,8 @@ endif()
if (NOT MLUOP_MLU_ARCH_LIST)
message(STATUS "build all arch")
set(BANG_CNCC_FLAGS "${BANG_CNCC_FLAGS}" "--bang-mlu-arch=mtp_372"
"--bang-mlu-arch=mtp_592")
"--bang-mlu-arch=mtp_592"
"--bang-mlu-arch=mtp_613")
else()
foreach (arch ${MLUOP_MLU_ARCH_LIST})
set(CNCC_FLAGS_ARCH ${CNCC_FLAGS_ARCH} "--bang-mlu-arch=${arch}" )
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,11 @@ MLU-OPS™提供了以下功能:
## 依赖条件

- 操作系统:
- 支持 x86_64 架构下的 Ubuntu20.04、Centos7.6、Centos8.5、Kylin10
- MLU-OPS™ v1.0.0版本后将不再支持 Ubuntu18.04。Ubuntu22.04系统将在后续的版本提供支持。
- 支持 x86_64 架构下的 Ubuntu22.04、Centos7.6、Centos8.5、Kylin10
- MLU-OPS™ v1.0.0版本后将不再支持 Ubuntu18.04。
- MLU-OPS™ v1.4.1版本后将不再支持 Ubuntu20.04。
- 寒武纪 MLU SDK:
- 编译和运行时依赖 CNToolkit v3.14.0 或更高版本,CNNL v1.26.6 或者更高版本
- 编译和运行时依赖 CNToolkit v3.15.2 或更高版本,CNNL v1.27.4 或者更高版本
- 寒武纪 MLU 驱动:
- 运行时依赖驱动 v6.0.3 或更高版本
- 外部链接库:
Expand Down
6 changes: 3 additions & 3 deletions build.property
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"version": "1.3.1-1",
"version": "1.4.1-1",
"python": "3.6.0",
"build_requires": {"cntoolkit": ["release","3.15.1-1"],
"cnnl":["release","1.27.4-1"],
"build_requires": {"cntoolkit": ["release","3.15.2-1"],
"cnnl":["release","1.28.0-1"],
"driver": "6.0.3",
"eigen3": "3.4.0",
"libxml2": "2.9.0",
Expand Down
47 changes: 24 additions & 23 deletions core/context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
#include "core/tool.h"
#include "kernels/kernel.h"

#define DEP_CHECK_LOG(level) \
#define DEP_CHECK_LOG(level) \
mluop::logging::LogMessage(__FILE__, __LINE__, 4, level, "MLU-OPS", true, \
true, true, true) \
true, true, true) \
.stream()

namespace mluop {
Expand All @@ -46,27 +46,23 @@ static struct deviceName name_list_table[] = {
// case.
};

// once cnrtGetDeviceProperties() update and not use
// device_ordinal, update this funciton.
mluOpDevType_t convertDeviceName(char *name) {
struct deviceName *pName = NULL;
int num = sizeof(name_list_table) / sizeof(struct deviceName);
if (CONTEXT_DEVICENAME_LEAST_SIZE > strlen(name)) {
LOG(ERROR)
<< "get device name failed. device name too short. device name = "
<< name << "\n";
return MLUOP_UNKNOWN_DEVICE;
}
for (int i = 0; i < num; i++) {
pName = &name_list_table[i];
if (0 == strncmp(pName->name, name, strlen(pName->name)) ||
(i == num - 1 &&
0 >= strncmp(pName->name, name, CONTEXT_DEVICENAME_LEAST_SIZE))) {
return pName->type;
mluOpDevType_t convertDeviceNameFromInt(int device_code) {
switch (device_code) {
case 372: {
return MLUOP_MLU370;
break;
}
case 592: {
return MLUOP_MLU590;
break;
}
case 613: {
return MLUOP_MTP613;
break;
}
default:
break;
}
LOG(ERROR) << "get device name failed. return unknown device. device name = "
<< name << "\n";
return MLUOP_UNKNOWN_DEVICE;
}
} // namespace mluop
Expand Down Expand Up @@ -179,6 +175,7 @@ mluOpStatus_t MLUOP_WIN_API mluOpCreate(mluOpHandle_t *handle) {
int32_t persisting_l2cache_maxsize = 0;
double memory_band_width = 0;
char device_name[CONTEXT_DEVICENAME_BUFFER_SIZE] = "";
int device_code = 0;
mluOpContext *ctx = new (std::nothrow) mluOpContext();
CNcontext drv_ctx;
CNctxConfigParam ctx_conf_param;
Expand Down Expand Up @@ -246,6 +243,11 @@ mluOpStatus_t MLUOP_WIN_API mluOpCreate(mluOpHandle_t *handle) {
cnDeviceGetAttribute(&persisting_l2cache_maxsize,
CN_DEVICE_ATTRIBUTE_MAX_PERSISTING_L2_CACHE_SIZE,
mlu_dev));
INTERNAL_CHECK(
"[mluOpCreate]",
CN_SUCCESS == cnDeviceGetAttribute(&device_code,
CN_DEVICE_ATTRIBUTE_MLU_ISA_VERSION,
mlu_dev));
INTERNAL_CHECK(
"[mluOpCreate]",
CN_SUCCESS == cnDeviceGetName(device_name, CONTEXT_DEVICENAME_BUFFER_SIZE,
Expand All @@ -266,8 +268,7 @@ mluOpStatus_t MLUOP_WIN_API mluOpCreate(mluOpHandle_t *handle) {
}

ctx->capability_job_limit = (int32_t)ctx_conf_param.unionLimit;
ctx->arch = mluop::convertDeviceName(
device_name); // warning: possible return unknown.
ctx->arch = mluop::convertDeviceNameFromInt(device_code);
ctx->sram_size = sram_size - REM_FOR_STACK;

strncpy(ctx->device_name, device_name, sizeof(device_name));
Expand Down
1 change: 1 addition & 0 deletions core/context.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ typedef enum {
MLUOP_MLU270 = 270,
MLUOP_MLU370 = 372,
MLUOP_MLU590 = 592,
MLUOP_MTP613 = 613,
MLUOP_MLU290 = 290,
} mluOpDevType_t;

Expand Down
2 changes: 1 addition & 1 deletion core/gen_case.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ std::string descToString(mluOpTensorDescriptor_t desc, char delimiter) {
tensor_info << " layout: " << mluop::getNameOfTensorLayout(layout)
<< delimiter;
tensor_info << " dtype: " << mluop::getNameOfDataType(dtype) << delimiter;
if (desc->pointer_mode == MLUOP_POINTER_MODE_HOST) {
if (desc->getPointerMode() == MLUOP_POINTER_MODE_HOST) {
tensor_info << " pointer_mode: POINTER_MODE_HOST" << delimiter;
if ((total_element_num != 1) || (dim != 0)) {
LOG(WARNING) << "[gen_case] Tensor has been set to POINTER_MODE_HOST, "
Expand Down
2 changes: 1 addition & 1 deletion core/gen_case.h
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ class PbNode {
uint64_t data_size = total_num * mluop::getSizeOfDataType(dtype);
void *data = malloc(data_size);
auto memcpy_dir =
(tensors[index].desc->pointer_mode == MLUOP_POINTER_MODE_HOST
(tensors[index].desc->getPointerMode() == MLUOP_POINTER_MODE_HOST
? cnrtMemcpyHostToHost
: cnrtMemcpyDevToHost);
if (cnrtSuccess == cnrtMemcpy(data,
Expand Down
Loading

0 comments on commit c09dc81

Please sign in to comment.