Skip to content

Commit a813939

Browse files
authored
Merge pull request #74 from InfiniTensor/dev
Dev
2 parents 54c2f7e + 3cb6f5d commit a813939

File tree

205 files changed

+5037
-584
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

205 files changed

+5037
-584
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,6 @@
1919
[submodule "src/09python_ffi/pybind11"]
2020
path = src/09python_ffi/pybind11
2121
url = [email protected]:pybind/pybind11.git
22+
[submodule "3rd-party/cccl"]
23+
path = 3rd-party/cccl
24+
url = [email protected]:NVIDIA/cccl.git

3rd-party/cccl

Submodule cccl added at b7d4228

CMakeLists.txt

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ message(STATUS "Project " ${PROJECT_NAME} " version " ${PROJECT_VERSION})
55
option(ABSL_PROPAGATE_CXX_STD "Abseil need this option" ON)
66
option(USE_CUDA "Support Nvidia GPU" OFF)
77
option(USE_KUNLUN "Support Baidu Kunlunxin" OFF)
8+
option(USE_BANG "Support Hanwuji MLU" OFF)
89

910
set(CMAKE_CXX_STANDARD 20)
1011
set(CMAKE_CXX_STANDARD_REQUIRED ON)
@@ -41,6 +42,38 @@ if(USE_KUNLUN)
4142
message(STATUS "KUNLUN_HOME: ${KUNLUN_HOME}")
4243
endif()
4344

45+
if (USE_BANG)
46+
add_compile_definitions(USE_BANG)
47+
include_directories(src/kernels/mlu/include)
48+
49+
# Neuware Evironment
50+
if ((NOT DEFINED NEUWARE_HOME) AND (NOT DEFINED ENV{NEUWARE_HOME}))
51+
message(FATAL_ERROR "NEUWARE_HOME is not defined from cmake or env")
52+
elseif (DEFINED NEUWARE_HOME)
53+
set(NEUWARE_HOME ${NEUWARE_HOME} CACHE STRING "NEUWARE_HOME directory for Cambricon Neuware development")
54+
else()
55+
set(NEUWARE_HOME $ENV{NEUWARE_HOME} CACHE STRING "NEUWARE_HOME directory for Cambricon Neuware development")
56+
endif()
57+
message(STATUS "NEUWARE_HOME: ${NEUWARE_HOME}")
58+
59+
# cnrt cndrv cnnl
60+
include_directories("${NEUWARE_HOME}/include")
61+
find_library(CAMBRICON_CNNL libcnnl.so "${NEUWARE_HOME}/lib64")
62+
find_library(CAMBRICON_CNRT libcnrt.so "${NEUWARE_HOME}/lib64")
63+
find_library(CAMBRICON_CNDRV libcndrv.so "${NEUWARE_HOME}/lib64")
64+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -lstdc++ -Wall")
65+
66+
if ((NOT DEFINED TARGET_CPU_ARCH) AND (NOT DEFINED ENV{TARGET_CPU_ARCH}))
67+
execute_process(COMMAND uname -m OUTPUT_VARIABLE _uname_m OUTPUT_STRIP_TRAILING_WHITESPACE)
68+
set(TARGET_CPU_ARCH "${_uname_m}" CACHE STRING "Target CPU ARCH")
69+
elseif(DEFINED TARGET_CPU_ARCH)
70+
set(TARGET_CPU_ARCH ${TARGET_CPU_ARCH} CACHE STRING "Target CPU ARCH")
71+
else()
72+
set(TARGET_CPU_ARCH $ENV{TARGET_CPU_ARCH} CACHE STRING "Target CPU ARCH")
73+
endif()
74+
message(STATUS "TARGET_CPU_ARCH: ${TARGET_CPU_ARCH}")
75+
endif()
76+
4477
add_compile_options(-march=native) # this will cause error in some machine
4578
add_compile_options(-mtune=native)
4679
add_compile_options(-Wall)
@@ -72,4 +105,5 @@ add_subdirectory(src/05computation)
72105
add_subdirectory(src/06frontend)
73106
add_subdirectory(src/07onnx)
74107
add_subdirectory(src/08communication)
108+
add_subdirectory(src/08-01llm)
75109
add_subdirectory(src/09python_ffi)

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33
TYPE ?= Debug
44
CUDA ?= OFF
55
KUNLUN ?= OFF
6+
BANG ?= OFF
67

78
CMAKE_EXTRA =
89
# CMAKE_EXTRA += -DCMAKE_CXX_COMPILER=
910

1011
build:
1112
mkdir -p build
12-
cmake -Bbuild -DCMAKE_BUILD_TYPE=$(TYPE) -DUSE_CUDA=$(CUDA) -DUSE_KUNLUN=$(KUNLUN) $(CMAKE_EXTRA)
13+
cmake -Bbuild -DCMAKE_BUILD_TYPE=$(TYPE) -DUSE_CUDA=$(CUDA) -DUSE_KUNLUN=$(KUNLUN) -DUSE_BANG=$(BANG) $(CMAKE_EXTRA)
1314
make -j -C build
1415

1516
install-python: build

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ executor = compiler.compile("cuda", "default", []) # -------- 编译模型
168168
- [fmt 10.1.1](https://github.com/fmtlib/fmt/releases/tag/10.1.0)
169169
- [fmtlog v2.2.1](https://github.com/MengRao/fmtlog/releases/tag/v2.2.1)
170170
- [googletest v1.14.0](https://github.com/google/googletest/releases/tag/v1.14.0)
171-
- [backward-cpp v1.6](https://github.com/bombela/backward-cpp/releases/tag/v1.6)
171+
- [backward-cpp master](https://github.com/bombela/backward-cpp)
172172
- [result master](https://github.com/willowell/result)
173173
- [abseil-cpp 20230802.1](https://github.com/abseil/abseil-cpp/releases/tag/20230802.1)
174174

src/00common/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,5 @@ file(GLOB_RECURSE COMMON_TEST test/*.cpp)
1111
if(COMMON_TEST)
1212
add_executable(common_test ${COMMON_TEST})
1313
add_test(common_test common_test)
14-
target_link_libraries(common_test common GTest::gtest_main ${BACKWARD_ENABLE})
15-
add_backward(common_test)
14+
target_link_libraries(common_test common GTest::gtest_main Backward::Object)
1615
endif()

src/00common/include/common/error_handler.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ namespace refactor {
3030
std::abort()
3131

3232
#ifndef DISABLE_ASSERT
33-
#define ASSERT(CONDITION, F, ...) \
34-
{ \
35-
if (!(CONDITION)) RUNTIME_ERROR(fmt::format("Assertion: " #F, ##__VA_ARGS__)); \
33+
#define ASSERT(CONDITION, F, ...) \
34+
{ \
35+
if (!(CONDITION)) RUNTIME_ERROR(fmt::format("Assertion: " F, ##__VA_ARGS__)); \
3636
}
3737
#else
3838
#define ASSERT(CONDITION, F)

src/00common/include/common/rc.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#define RC_HPP
33

44
#include <functional>
5+
#include <utility>
56

67
namespace refactor {
78

@@ -18,7 +19,7 @@ namespace refactor {
1819
T *_value;
1920
struct Counter {
2021
size_t strong, weak;
21-
} * _counter;
22+
} *_counter;
2223

2324
Rc(T *ptr, Counter *counter) noexcept
2425
: _value(ptr), _counter(counter) { inc(); }

src/01graph_topo/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,5 @@ file(GLOB_RECURSE GRAPH_TOPO_TEST test/*.cpp)
1111
if(GRAPH_TOPO_TEST)
1212
add_executable(graph_topo_test ${GRAPH_TOPO_TEST})
1313
add_test(graph_topo_test graph_topo_test)
14-
target_link_libraries(graph_topo_test graph_topo GTest::gtest_main ${BACKWARD_ENABLE})
15-
add_backward(graph_topo_test)
14+
target_link_libraries(graph_topo_test graph_topo GTest::gtest_main Backward::Object)
1615
endif()

0 commit comments

Comments
 (0)