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
309878f0
Unverified
Commit
309878f0
authored
Mar 06, 2025
by
PanZezhong1725
Committed by
GitHub
Mar 06, 2025
Browse files
Merge pull request #91 from YdrMaster/main
issue/87/refactor: 重构 cuda handle,并修改 cpu handle 和 matmul 命名空间
parents
2538df1b
01b2f8ab
Changes
25
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
36 additions
and
30 deletions
+36
-30
xmake.lua
xmake.lua
+17
-14
xmake/ascend.lua
xmake/ascend.lua
+5
-4
xmake/bang.lua
xmake/bang.lua
+4
-2
xmake/cuda.lua
xmake/cuda.lua
+5
-6
xmake/kunlun.lua
xmake/kunlun.lua
+5
-4
No files found.
xmake.lua
View file @
309878f0
...
@@ -119,8 +119,25 @@ target("infini-utils")
...
@@ -119,8 +119,25 @@ target("infini-utils")
add_files
(
"src/utils/*.cc"
)
add_files
(
"src/utils/*.cc"
)
target_end
()
target_end
()
target
(
"infinirt"
)
set_kind
(
"shared"
)
if
has_config
(
"cpu"
)
then
add_deps
(
"infinirt-cpu"
)
end
if
has_config
(
"nv-gpu"
)
then
add_deps
(
"infinirt-cuda"
)
end
set_languages
(
"cxx17"
)
set_installdir
(
os.getenv
(
"INFINI_ROOT"
)
or
(
os.getenv
(
is_host
(
"windows"
)
and
"HOMEPATH"
or
"HOME"
)
..
"/.infini"
))
add_files
(
"src/infinirt/*.cc"
)
add_installfiles
(
"include/infinirt.h"
)
target_end
()
target
(
"infiniop"
)
target
(
"infiniop"
)
set_kind
(
"shared"
)
set_kind
(
"shared"
)
add_deps
(
"infinirt"
)
if
has_config
(
"cpu"
)
then
if
has_config
(
"cpu"
)
then
add_deps
(
"infiniop-cpu"
)
add_deps
(
"infiniop-cpu"
)
end
end
...
@@ -166,20 +183,6 @@ target("infiniop")
...
@@ -166,20 +183,6 @@ target("infiniop")
add_installfiles
(
"include/infinicore.h"
,
{
prefixdir
=
"include"
})
add_installfiles
(
"include/infinicore.h"
,
{
prefixdir
=
"include"
})
target_end
()
target_end
()
target
(
"infinirt"
)
set_kind
(
"shared"
)
if
has_config
(
"cpu"
)
then
add_deps
(
"infinirt-cpu"
)
end
if
has_config
(
"nv-gpu"
)
then
add_deps
(
"infinirt-cuda"
)
end
set_languages
(
"cxx17"
)
set_installdir
(
os.getenv
(
"INFINI_ROOT"
)
or
(
os.getenv
(
is_host
(
"windows"
)
and
"HOMEPATH"
or
"HOME"
)
..
"/.infini"
))
add_files
(
"src/infinirt/*.cc"
)
add_installfiles
(
"include/infinirt.h"
)
target_end
()
target
(
"all"
)
target
(
"all"
)
set_kind
(
"phony"
)
set_kind
(
"phony"
)
add_deps
(
"infiniop"
,
"infinirt"
)
add_deps
(
"infiniop"
,
"infinirt"
)
...
...
xmake/ascend.lua
View file @
309878f0
...
@@ -41,15 +41,16 @@ rule_end()
...
@@ -41,15 +41,16 @@ rule_end()
target
(
"infiniop-ascend"
)
target
(
"infiniop-ascend"
)
set_kind
(
"static"
)
set_kind
(
"static"
)
add_deps
(
"infini-utils"
)
add_deps
(
"infini-utils"
)
set_languages
(
"cxx17"
)
on_install
(
function
(
target
)
end
)
on_install
(
function
(
target
)
end
)
-- Add files
add_cxflags
(
"-lstdc++ -fPIC"
)
set_warnings
(
"all"
,
"error"
)
set_languages
(
"cxx17"
)
add_files
(
"$(projectdir)/src/infiniop/devices/ascend/*.cc"
,
"$(projectdir)/src/infiniop/ops/*/ascend/*.cc"
)
add_files
(
"$(projectdir)/src/infiniop/devices/ascend/*.cc"
,
"$(projectdir)/src/infiniop/ops/*/ascend/*.cc"
)
add_cxflags
(
"-lstdc++ -Wall -Werror -fPIC"
)
-- Add operator
-- Add operator
-- TODO: add it back after ascend-kernels is fixed
-- TODO: add it back after ascend-kernels is fixed
-- add_rules("ascend-kernels")
-- add_rules("ascend-kernels")
-- add_links(builddir.."/libascend_kernels.a")
-- add_links(builddir.."/libascend_kernels.a")
target_end
()
target_end
()
xmake/bang.lua
View file @
309878f0
...
@@ -31,7 +31,6 @@ rule("mlu")
...
@@ -31,7 +31,6 @@ rule("mlu")
os
.
execv
(
cc
,
args
)
os
.
execv
(
cc
,
args
)
table.insert
(
target
:
objectfiles
(),
objectfile
)
table.insert
(
target
:
objectfiles
(),
objectfile
)
end
)
end
)
rule_end
()
rule_end
()
local
src_dir
=
path
.
join
(
os
.
projectdir
(),
"src"
,
"infiniop"
)
local
src_dir
=
path
.
join
(
os
.
projectdir
(),
"src"
,
"infiniop"
)
...
@@ -40,11 +39,14 @@ target("infiniop-cambricon")
...
@@ -40,11 +39,14 @@ target("infiniop-cambricon")
set_kind
(
"static"
)
set_kind
(
"static"
)
add_deps
(
"infini-utils"
)
add_deps
(
"infini-utils"
)
on_install
(
function
(
target
)
end
)
on_install
(
function
(
target
)
end
)
add_cxflags
(
"-lstdc++ -fPIC"
)
set_warnings
(
"all"
,
"error"
)
set_languages
(
"cxx17"
)
set_languages
(
"cxx17"
)
add_files
(
src_dir
..
"/devices/bang/*.cc"
,
src_dir
..
"/ops/*/bang/*.cc"
)
add_files
(
src_dir
..
"/devices/bang/*.cc"
,
src_dir
..
"/ops/*/bang/*.cc"
)
local
mlu_files
=
os
.
files
(
src_dir
..
"/ops/*/bang/*.mlu"
)
local
mlu_files
=
os
.
files
(
src_dir
..
"/ops/*/bang/*.mlu"
)
if
#
mlu_files
>
0
then
if
#
mlu_files
>
0
then
add_files
(
mlu_files
,
{
rule
=
"mlu"
})
add_files
(
mlu_files
,
{
rule
=
"mlu"
})
end
end
add_cxflags
(
"-lstdc++ -Wall -Werror -fPIC"
)
target_end
()
target_end
()
xmake/cuda.lua
View file @
309878f0
...
@@ -12,11 +12,10 @@ target("infiniop-cuda")
...
@@ -12,11 +12,10 @@ target("infiniop-cuda")
set_kind
(
"static"
)
set_kind
(
"static"
)
add_deps
(
"infini-utils"
)
add_deps
(
"infini-utils"
)
on_install
(
function
(
target
)
end
)
on_install
(
function
(
target
)
end
)
set_policy
(
"build.cuda.devlink"
,
true
)
set_policy
(
"build.cuda.devlink"
,
true
)
set_toolchains
(
"cuda"
)
set_toolchains
(
"cuda"
)
add_links
(
"cublas"
)
add_links
(
"cublas"
,
"cudnn"
)
add_links
(
"cudnn"
)
add_cugencodes
(
"native"
)
add_cugencodes
(
"native"
)
if
is_plat
(
"windows"
)
then
if
is_plat
(
"windows"
)
then
...
@@ -40,7 +39,10 @@ target("infinirt-cuda")
...
@@ -40,7 +39,10 @@ target("infinirt-cuda")
set_kind
(
"static"
)
set_kind
(
"static"
)
add_deps
(
"infini-utils"
)
add_deps
(
"infini-utils"
)
on_install
(
function
(
target
)
end
)
on_install
(
function
(
target
)
end
)
set_policy
(
"build.cuda.devlink"
,
true
)
set_policy
(
"build.cuda.devlink"
,
true
)
set_toolchains
(
"cuda"
)
add_links
(
"cudart"
)
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"
)
...
@@ -49,9 +51,6 @@ target("infinirt-cuda")
...
@@ -49,9 +51,6 @@ target("infinirt-cuda")
add_culdflags
(
"-Xcompiler=-fPIC"
)
add_culdflags
(
"-Xcompiler=-fPIC"
)
add_cxflags
(
"-fPIC"
)
add_cxflags
(
"-fPIC"
)
end
end
set_toolchains
(
"cuda"
)
add_links
(
"cudart"
)
set_languages
(
"cxx17"
)
set_languages
(
"cxx17"
)
add_files
(
"../src/infinirt/cuda/*.cu"
)
add_files
(
"../src/infinirt/cuda/*.cu"
)
...
...
xmake/kunlun.lua
View file @
309878f0
...
@@ -10,10 +10,11 @@ add_links("xpuapi")
...
@@ -10,10 +10,11 @@ add_links("xpuapi")
target
(
"infiniop-kunlun"
)
target
(
"infiniop-kunlun"
)
set_kind
(
"static"
)
set_kind
(
"static"
)
add_deps
(
"infini-utils"
)
add_deps
(
"infini-utils"
)
set_languages
(
"cxx17"
)
on_install
(
function
(
target
)
end
)
on_install
(
function
(
target
)
end
)
-- Add files
add_files
(
"$(projectdir)/src/infiniop/devices/kunlun/*.cc"
,
"$(projectdir)/src/infiniop/ops/*/kunlun/*.cc"
)
add_cxflags
(
"-lstdc++ -Wall -Werror -fPIC"
)
add_cxflags
(
"-lstdc++ -fPIC"
)
set_warnings
(
"all"
,
"error"
)
set_languages
(
"cxx17"
)
add_files
(
"$(projectdir)/src/infiniop/devices/kunlun/*.cc"
,
"$(projectdir)/src/infiniop/ops/*/kunlun/*.cc"
)
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