Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
5ed2320c
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2299
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
5ed2320c
编写于
3月 20, 2023
作者:
Z
Zhang Na
提交者:
GitHub
3月 20, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add LoongArch support (#51109)
上级
2dfc3fa8
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
29 addition
and
10 deletion
+29
-10
CMakeLists.txt
CMakeLists.txt
+11
-0
cmake/external/openblas.cmake
cmake/external/openblas.cmake
+4
-0
cmake/flags.cmake
cmake/flags.cmake
+2
-1
paddle/fluid/operators/search_compute.h
paddle/fluid/operators/search_compute.h
+4
-4
paddle/fluid/platform/denormal.cc
paddle/fluid/platform/denormal.cc
+2
-1
paddle/phi/backends/cpu/cpu_info.cc
paddle/phi/backends/cpu/cpu_info.cc
+3
-2
paddle/phi/backends/cpu/cpu_info.h
paddle/phi/backends/cpu/cpu_info.h
+3
-2
未找到文件。
CMakeLists.txt
浏览文件 @
5ed2320c
...
@@ -298,6 +298,7 @@ option(WITH_CRYPTO "Compile PaddlePaddle with crypto support" ON)
...
@@ -298,6 +298,7 @@ option(WITH_CRYPTO "Compile PaddlePaddle with crypto support" ON)
option
(
WITH_ARM
"Compile PaddlePaddle with arm support"
OFF
)
option
(
WITH_ARM
"Compile PaddlePaddle with arm support"
OFF
)
option
(
WITH_SW
"Compile PaddlePaddle with sw support"
OFF
)
option
(
WITH_SW
"Compile PaddlePaddle with sw support"
OFF
)
option
(
WITH_MIPS
"Compile PaddlePaddle with mips support"
OFF
)
option
(
WITH_MIPS
"Compile PaddlePaddle with mips support"
OFF
)
option
(
WITH_LOONGARCH
"Compile PaddlePaddle with loongarch support"
OFF
)
option
(
WITH_MUSL
"Compile with musl libc instead of gblic"
OFF
)
option
(
WITH_MUSL
"Compile with musl libc instead of gblic"
OFF
)
option
(
WITH_UNITY_BUILD
"Compile with UnityBuild mode"
OFF
)
option
(
WITH_UNITY_BUILD
"Compile with UnityBuild mode"
OFF
)
option
(
WITH_STRIP
"Strip so files of Whl packages"
OFF
)
option
(
WITH_STRIP
"Strip so files of Whl packages"
OFF
)
...
@@ -659,6 +660,16 @@ if(WITH_MIPS)
...
@@ -659,6 +660,16 @@ if(WITH_MIPS)
add_definitions
(
-DPADDLE_WITH_MIPS
)
add_definitions
(
-DPADDLE_WITH_MIPS
)
endif
()
endif
()
if
(
WITH_LOONGARCH
)
set
(
WITH_XBYAK
OFF
CACHE STRING
"Disable XBYAK when compiling WITH_LOONGARCH=ON"
FORCE
)
set
(
WITH_MKL
OFF
CACHE STRING
"Disable MKL when compiling WITH_LOONGARCH=ON."
FORCE
)
add_definitions
(
-DPADDLE_WITH_LOONGARCH
)
endif
()
if
(
WITH_ONEMKL
)
if
(
WITH_ONEMKL
)
add_definitions
(
-DPADDLE_WITH_ONEMKL
)
add_definitions
(
-DPADDLE_WITH_ONEMKL
)
endif
()
endif
()
...
...
cmake/external/openblas.cmake
浏览文件 @
5ed2320c
...
@@ -26,6 +26,10 @@ if(WITH_MIPS)
...
@@ -26,6 +26,10 @@ if(WITH_MIPS)
set
(
CBLAS_TAG v0.3.13
)
set
(
CBLAS_TAG v0.3.13
)
endif
()
endif
()
if
(
WITH_LOONGARCH
)
set
(
CBLAS_TAG v0.3.18
)
endif
()
if
(
NOT WIN32
)
if
(
NOT WIN32
)
set
(
CBLAS_LIBRARIES
set
(
CBLAS_LIBRARIES
"
${
CBLAS_INSTALL_DIR
}
/lib/
${
CMAKE_STATIC_LIBRARY_PREFIX
}
openblas
${
CMAKE_STATIC_LIBRARY_SUFFIX
}
"
"
${
CBLAS_INSTALL_DIR
}
/lib/
${
CMAKE_STATIC_LIBRARY_PREFIX
}
openblas
${
CMAKE_STATIC_LIBRARY_SUFFIX
}
"
...
...
cmake/flags.cmake
浏览文件 @
5ed2320c
...
@@ -196,7 +196,8 @@ if(NOT WIN32)
...
@@ -196,7 +196,8 @@ if(NOT WIN32)
if
(
NOT WITH_NV_JETSON
if
(
NOT WITH_NV_JETSON
AND NOT WITH_ARM
AND NOT WITH_ARM
AND NOT WITH_SW
AND NOT WITH_SW
AND NOT WITH_MIPS
)
AND NOT WITH_MIPS
AND NOT WITH_LOONGARCH
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-m64"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-m64"
)
endif
()
endif
()
endif
()
endif
()
...
...
paddle/fluid/operators/search_compute.h
浏览文件 @
5ed2320c
...
@@ -15,7 +15,7 @@ limitations under the License. */
...
@@ -15,7 +15,7 @@ limitations under the License. */
#pragma once
#pragma once
#if !defined(PADDLE_WITH_ARM) && !defined(PADDLE_WITH_SW) && \
#if !defined(PADDLE_WITH_ARM) && !defined(PADDLE_WITH_SW) && \
!defined(PADDLE_WITH_MIPS)
!defined(PADDLE_WITH_MIPS)
&& !defined(PADDLE_WITH_LOONGARCH)
#include <immintrin.h>
#include <immintrin.h>
#endif
#endif
#include <cfloat>
#include <cfloat>
...
@@ -103,7 +103,7 @@ void call_gemm_batched(const framework::ExecutionContext& ctx,
...
@@ -103,7 +103,7 @@ void call_gemm_batched(const framework::ExecutionContext& ctx,
}
}
#if !defined(PADDLE_WITH_ARM) && !defined(PADDLE_WITH_SW) && \
#if !defined(PADDLE_WITH_ARM) && !defined(PADDLE_WITH_SW) && \
!defined(PADDLE_WITH_MIPS)
!defined(PADDLE_WITH_MIPS)
&& !defined(PADDLE_WITH_LOONGARCH)
#define __m256x __m256
#define __m256x __m256
...
@@ -144,7 +144,7 @@ inline void axpy(const T* x, T* y, size_t len, const T alpha) {
...
@@ -144,7 +144,7 @@ inline void axpy(const T* x, T* y, size_t len, const T alpha) {
_mm256_mul_px
(
mm_alpha
,
_mm256_load_px
(
x
+
jjj
))));
_mm256_mul_px
(
mm_alpha
,
_mm256_load_px
(
x
+
jjj
))));
}
}
#elif defined(PADDLE_WITH_ARM) || defined(PADDLE_WITH_SW) || \
#elif defined(PADDLE_WITH_ARM) || defined(PADDLE_WITH_SW) || \
defined(PADDLE_WITH_MIPS)
defined(PADDLE_WITH_MIPS)
|| defined(PADDLE_WITH_LOONGARCH)
PADDLE_THROW
(
platform
::
errors
::
Unimplemented
(
"axpy is not supported"
));
PADDLE_THROW
(
platform
::
errors
::
Unimplemented
(
"axpy is not supported"
));
#else
#else
lll
=
len
&
~
SSE_CUT_LEN_MASK
;
lll
=
len
&
~
SSE_CUT_LEN_MASK
;
...
@@ -174,7 +174,7 @@ inline void axpy_noadd(const T* x, T* y, size_t len, const T alpha) {
...
@@ -174,7 +174,7 @@ inline void axpy_noadd(const T* x, T* y, size_t len, const T alpha) {
_mm256_store_px
(
y
+
jjj
,
_mm256_mul_px
(
mm_alpha
,
_mm256_load_px
(
x
+
jjj
)));
_mm256_store_px
(
y
+
jjj
,
_mm256_mul_px
(
mm_alpha
,
_mm256_load_px
(
x
+
jjj
)));
}
}
#elif defined(PADDLE_WITH_ARM) || defined(PADDLE_WITH_SW) || \
#elif defined(PADDLE_WITH_ARM) || defined(PADDLE_WITH_SW) || \
defined(PADDLE_WITH_MIPS)
defined(PADDLE_WITH_MIPS)
|| defined(PADDLE_WITH_LOONGARCH)
PADDLE_THROW
(
platform
::
errors
::
Unimplemented
(
"axpy_noadd is not supported"
));
PADDLE_THROW
(
platform
::
errors
::
Unimplemented
(
"axpy_noadd is not supported"
));
#else
#else
lll
=
len
&
~
SSE_CUT_LEN_MASK
;
lll
=
len
&
~
SSE_CUT_LEN_MASK
;
...
...
paddle/fluid/platform/denormal.cc
浏览文件 @
5ed2320c
...
@@ -29,7 +29,8 @@
...
@@ -29,7 +29,8 @@
#endif
#endif
#if !defined(GCC_WITHOUT_INTRINSICS) && !defined(PADDLE_WITH_ARM) && \
#if !defined(GCC_WITHOUT_INTRINSICS) && !defined(PADDLE_WITH_ARM) && \
!defined(PADDLE_WITH_SW) && !defined(PADDLE_WITH_MIPS) && !defined(_WIN32)
!defined(PADDLE_WITH_SW) && !defined(PADDLE_WITH_MIPS) && \
!defined(_WIN32) && !defined(PADDLE_WITH_LOONGARCH)
#define DENORM_USE_INTRINSICS
#define DENORM_USE_INTRINSICS
#endif
#endif
...
...
paddle/phi/backends/cpu/cpu_info.cc
浏览文件 @
5ed2320c
...
@@ -165,8 +165,9 @@ bool MayIUse(const cpu_isa_t cpu_isa) {
...
@@ -165,8 +165,9 @@ bool MayIUse(const cpu_isa_t cpu_isa) {
if
(
cpu_isa
==
isa_any
)
{
if
(
cpu_isa
==
isa_any
)
{
return
true
;
return
true
;
}
else
{
}
else
{
#if !defined(WITH_NV_JETSON) && !defined(PADDLE_WITH_ARM) && \
#if !defined(WITH_NV_JETSON) && !defined(PADDLE_WITH_ARM) && \
!defined(PADDLE_WITH_SW) && !defined(PADDLE_WITH_MIPS)
!defined(PADDLE_WITH_SW) && !defined(PADDLE_WITH_MIPS) && \
!defined(PADDLE_WITH_LOONGARCH)
int
reg
[
4
];
int
reg
[
4
];
cpuid
(
reg
,
0
);
cpuid
(
reg
,
0
);
int
nIds
=
reg
[
0
];
int
nIds
=
reg
[
0
];
...
...
paddle/phi/backends/cpu/cpu_info.h
浏览文件 @
5ed2320c
...
@@ -40,8 +40,9 @@
...
@@ -40,8 +40,9 @@
#ifdef _WIN32
#ifdef _WIN32
#define cpuid(reg, x) __cpuidex(reg, x, 0)
#define cpuid(reg, x) __cpuidex(reg, x, 0)
#else
#else
#if !defined(WITH_NV_JETSON) && !defined(PADDLE_WITH_ARM) && \
#if !defined(WITH_NV_JETSON) && !defined(PADDLE_WITH_ARM) && \
!defined(PADDLE_WITH_SW) && !defined(PADDLE_WITH_MIPS)
!defined(PADDLE_WITH_SW) && !defined(PADDLE_WITH_MIPS) && \
!defined(PADDLE_WITH_LOONGARCH)
#include <cpuid.h>
#include <cpuid.h>
inline
void
cpuid
(
int
reg
[
4
],
int
x
)
{
inline
void
cpuid
(
int
reg
[
4
],
int
x
)
{
__cpuid_count
(
x
,
0
,
reg
[
0
],
reg
[
1
],
reg
[
2
],
reg
[
3
]);
__cpuid_count
(
x
,
0
,
reg
[
0
],
reg
[
1
],
reg
[
2
],
reg
[
3
]);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录