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
c6a3e4c7
Unverified
Commit
c6a3e4c7
authored
Jul 10, 2025
by
PanZezhong1725
Committed by
GitHub
Jul 10, 2025
Browse files
Merge pull request #315 from YdrMaster/main
issue/314 修复 nvidia 上编译和测试问题
parents
f3a075b7
68107e5e
Changes
22
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
26 deletions
+42
-26
xmake.lua
xmake.lua
+27
-18
xmake/cuda.lua
xmake/cuda.lua
+15
-8
No files found.
xmake.lua
View file @
c6a3e4c7
...
@@ -22,7 +22,7 @@ end
...
@@ -22,7 +22,7 @@ end
option
(
"cpu"
)
option
(
"cpu"
)
set_default
(
true
)
set_default
(
true
)
set_showmenu
(
true
)
set_showmenu
(
true
)
set_description
(
"Whether to comp
l
ie implementations for CPU"
)
set_description
(
"Whether to compi
l
e implementations for CPU"
)
option_end
()
option_end
()
option
(
"omp"
)
option
(
"omp"
)
...
@@ -44,32 +44,29 @@ end
...
@@ -44,32 +44,29 @@ end
option
(
"nv-gpu"
)
option
(
"nv-gpu"
)
set_default
(
false
)
set_default
(
false
)
set_showmenu
(
true
)
set_showmenu
(
true
)
set_description
(
"Whether to comp
l
ie implementations for Nvidia GPU"
)
set_description
(
"Whether to compi
l
e implementations for Nvidia GPU"
)
option_end
()
option_end
()
if
has_config
(
"nv-gpu"
)
then
if
has_config
(
"nv-gpu"
)
then
add_defines
(
"ENABLE_
CUD
A_API"
)
add_defines
(
"ENABLE_
NVIDI
A_API"
)
includes
(
"xmake/cuda.lua"
)
includes
(
"xmake/cuda.lua"
)
end
end
-- 天数智芯
option
(
"cudnn"
)
option
(
"iluvatar-gpu"
)
set_default
(
true
)
set_default
(
false
)
set_showmenu
(
true
)
set_showmenu
(
true
)
set_description
(
"Whether to comp
lie implementations for Iluvatar
GPU"
)
set_description
(
"Whether to comp
ile cudnn for Nvidia
GPU"
)
option_end
()
option_end
()
if
has_config
(
"iluvatar-gpu"
)
then
if
has_config
(
"cudnn"
)
then
add_defines
(
"ENABLE_CUDA_API"
)
add_defines
(
"ENABLE_CUDNN_API"
)
add_defines
(
"ENABLE_ILUVATAR_CUDA_API"
)
includes
(
"xmake/iluvatar.lua"
)
end
end
-- 寒武纪
-- 寒武纪
option
(
"cambricon-mlu"
)
option
(
"cambricon-mlu"
)
set_default
(
false
)
set_default
(
false
)
set_showmenu
(
true
)
set_showmenu
(
true
)
set_description
(
"Whether to comp
l
ie implementations for Cambricon MLU"
)
set_description
(
"Whether to compi
l
e implementations for Cambricon MLU"
)
option_end
()
option_end
()
if
has_config
(
"cambricon-mlu"
)
then
if
has_config
(
"cambricon-mlu"
)
then
...
@@ -81,7 +78,7 @@ end
...
@@ -81,7 +78,7 @@ end
option
(
"ascend-npu"
)
option
(
"ascend-npu"
)
set_default
(
false
)
set_default
(
false
)
set_showmenu
(
true
)
set_showmenu
(
true
)
set_description
(
"Whether to comp
l
ie implementations for Huawei Ascend NPU"
)
set_description
(
"Whether to compi
l
e implementations for Huawei Ascend NPU"
)
option_end
()
option_end
()
if
has_config
(
"ascend-npu"
)
then
if
has_config
(
"ascend-npu"
)
then
...
@@ -89,11 +86,24 @@ if has_config("ascend-npu") then
...
@@ -89,11 +86,24 @@ if has_config("ascend-npu") then
includes
(
"xmake/ascend.lua"
)
includes
(
"xmake/ascend.lua"
)
end
end
-- 天数智芯
option
(
"iluvatar-gpu"
)
set_default
(
false
)
set_showmenu
(
true
)
set_description
(
"Whether to compile implementations for Iluvatar GPU"
)
option_end
()
if
has_config
(
"iluvatar-gpu"
)
then
add_defines
(
"ENABLE_CUDA_API"
)
add_defines
(
"ENABLE_ILUVATAR_CUDA_API"
)
includes
(
"xmake/iluvatar.lua"
)
end
-- 沐曦
-- 沐曦
option
(
"metax-gpu"
)
option
(
"metax-gpu"
)
set_default
(
false
)
set_default
(
false
)
set_showmenu
(
true
)
set_showmenu
(
true
)
set_description
(
"Whether to comp
l
ie implementations for MetaX GPU"
)
set_description
(
"Whether to compi
l
e implementations for MetaX GPU"
)
option_end
()
option_end
()
if
has_config
(
"metax-gpu"
)
then
if
has_config
(
"metax-gpu"
)
then
...
@@ -105,7 +115,7 @@ end
...
@@ -105,7 +115,7 @@ end
option
(
"moore-gpu"
)
option
(
"moore-gpu"
)
set_default
(
false
)
set_default
(
false
)
set_showmenu
(
true
)
set_showmenu
(
true
)
set_description
(
"Whether to comp
l
ie implementations for Moore Threads GPU"
)
set_description
(
"Whether to compi
l
e implementations for Moore Threads GPU"
)
option_end
()
option_end
()
if
has_config
(
"moore-gpu"
)
then
if
has_config
(
"moore-gpu"
)
then
...
@@ -117,11 +127,10 @@ end
...
@@ -117,11 +127,10 @@ end
option
(
"sugon-dcu"
)
option
(
"sugon-dcu"
)
set_default
(
false
)
set_default
(
false
)
set_showmenu
(
true
)
set_showmenu
(
true
)
set_description
(
"Whether to comp
l
ie implementations for Sugon DCU"
)
set_description
(
"Whether to compi
l
e implementations for Sugon DCU"
)
option_end
()
option_end
()
if
has_config
(
"sugon-dcu"
)
then
if
has_config
(
"sugon-dcu"
)
then
add_defines
(
"ENABLE_CUDA_API"
)
add_defines
(
"ENABLE_SUGON_CUDA_API"
)
add_defines
(
"ENABLE_SUGON_CUDA_API"
)
end
end
...
@@ -142,7 +151,7 @@ option("ccl")
...
@@ -142,7 +151,7 @@ option("ccl")
set_default
(
false
)
set_default
(
false
)
set_default
(
false
)
set_default
(
false
)
set_showmenu
(
true
)
set_showmenu
(
true
)
set_description
(
"Wether to comp
l
ie implementations for InfiniCCL"
)
set_description
(
"Wether to compi
l
e implementations for InfiniCCL"
)
option_end
()
option_end
()
if
has_config
(
"ccl"
)
then
if
has_config
(
"ccl"
)
then
...
...
xmake/cuda.lua
View file @
c6a3e4c7
local
CUDA_ROOT
=
os.getenv
(
"CUDA_ROOT"
)
or
os.getenv
(
"CUDA_HOME"
)
or
os.getenv
(
"CUDA_PATH"
)
local
CUDNN_ROOT
=
os.getenv
(
"CUDNN_ROOT"
)
or
os.getenv
(
"CUDNN_HOME"
)
or
os.getenv
(
"CUDNN_PATH"
)
local
CUDNN_ROOT
=
os.getenv
(
"CUDNN_ROOT"
)
or
os.getenv
(
"CUDNN_HOME"
)
or
os.getenv
(
"CUDNN_PATH"
)
if
CUDA_ROOT
~=
nil
then
add_includedirs
(
CUDA_ROOT
..
"/include"
)
end
if
CUDNN_ROOT
~=
nil
then
if
CUDNN_ROOT
~=
nil
then
add_includedirs
(
CUDNN_ROOT
..
"/include"
)
add_includedirs
(
CUDNN_ROOT
..
"/include"
)
end
end
...
@@ -15,10 +10,20 @@ target("infiniop-cuda")
...
@@ -15,10 +10,20 @@ target("infiniop-cuda")
set_policy
(
"build.cuda.devlink"
,
true
)
set_policy
(
"build.cuda.devlink"
,
true
)
set_toolchains
(
"cuda"
)
set_toolchains
(
"cuda"
)
add_links
(
"cuda"
,
"cublas"
,
"cudnn"
)
add_links
(
"cudart"
,
"cublas"
)
add_linkdirs
(
CUDA_ROOT
..
"/lib64/stubs"
)
if
has_config
(
"cudnn"
)
then
add_links
(
"cudnn"
)
end
add_cugencodes
(
"native"
)
add_cugencodes
(
"native"
)
on_load
(
function
(
target
)
import
(
"lib.detect.find_tool"
)
local
nvcc
=
find_tool
(
"nvcc"
)
if
nvcc
~=
nil
then
target
:
add
(
"linkdirs"
,
path
.
directory
(
path
.
directory
(
nvcc
.
program
))
..
"/lib64/stubs"
)
end
end
)
if
is_plat
(
"windows"
)
then
if
is_plat
(
"windows"
)
then
add_cuflags
(
"-Xcompiler=/utf-8"
,
"--expt-relaxed-constexpr"
,
"--allow-unsupported-compiler"
)
add_cuflags
(
"-Xcompiler=/utf-8"
,
"--expt-relaxed-constexpr"
,
"--allow-unsupported-compiler"
)
add_cuflags
(
"-Xcompiler=/W3"
,
"-Xcompiler=/WX"
)
add_cuflags
(
"-Xcompiler=/W3"
,
"-Xcompiler=/WX"
)
...
@@ -38,6 +43,8 @@ target("infiniop-cuda")
...
@@ -38,6 +43,8 @@ target("infiniop-cuda")
end
end
end
end
add_cuflags
(
"-Xcompiler=-Wno-error=deprecated-declarations"
)
set_languages
(
"cxx17"
)
set_languages
(
"cxx17"
)
add_files
(
"../src/infiniop/devices/cuda/*.cu"
,
"../src/infiniop/ops/*/cuda/*.cu"
,
"../build/ninetoothed/*.c"
)
add_files
(
"../src/infiniop/devices/cuda/*.cu"
,
"../src/infiniop/ops/*/cuda/*.cu"
,
"../build/ninetoothed/*.c"
)
target_end
()
target_end
()
...
@@ -92,5 +99,5 @@ target("infiniccl-cuda")
...
@@ -92,5 +99,5 @@ target("infiniccl-cuda")
end
end
end
end
set_languages
(
"cxx17"
)
set_languages
(
"cxx17"
)
target_end
()
target_end
()
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