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
601defcb
Commit
601defcb
authored
Mar 05, 2025
by
YdrMaster
Browse files
issue/87/refactor: 修改 infiniop/handle.h,现在 infiniop 依赖 infinirt 创建指定硬件的 handle
Signed-off-by:
YdrMaster
<
ydrml@hotmail.com
>
parent
d64c1b0f
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
18 deletions
+28
-18
include/infiniop.h
include/infiniop.h
+2
-1
include/infiniop/handle.h
include/infiniop/handle.h
+1
-1
src/infiniop/devices/handle.cc
src/infiniop/devices/handle.cc
+8
-2
xmake.lua
xmake.lua
+17
-14
No files found.
include/infiniop.h
View file @
601defcb
#ifndef __INFINIOP_API_H__
#define __INFINIOP_API_H__
#include "infiniop/tensor_descriptor.h"
#include "infiniop/handle.h"
#include "infiniop/ops/add.h"
#include "infiniop/ops/attention.h"
...
...
@@ -19,5 +19,6 @@
#include "infiniop/ops/rms_norm.h"
#include "infiniop/ops/rotary_embedding.h"
#include "infiniop/ops/swiglu.h"
#include "infiniop/tensor_descriptor.h"
#endif // __INFINIOP_API_H__
include/infiniop/handle.h
View file @
601defcb
...
...
@@ -7,7 +7,7 @@ struct InfiniopHandle;
typedef
InfiniopHandle
*
infiniopHandle_t
;
__C
__export
infiniStatus_t
infiniopCreateHandle
(
infiniopHandle_t
*
handle_ptr
,
infiniDevice_t
device
);
__C
__export
infiniStatus_t
infiniopCreateHandle
(
infiniopHandle_t
*
handle_ptr
);
__C
__export
infiniStatus_t
infiniopDestroyHandle
(
infiniopHandle_t
handle
);
...
...
src/infiniop/devices/handle.cc
View file @
601defcb
#include "infiniop/handle.h"
#include "../../utils.h"
#include "infinirt.h"
#ifdef ENABLE_CPU_API
#include "cpu/cpu_handle.h"
#endif
...
...
@@ -15,12 +18,15 @@
#include "kunlun/kunlun_handle.h"
#endif
__C
infiniStatus_t
infiniopCreateHandle
(
infiniopHandle_t
*
handle_ptr
,
infiniDevice_t
device
)
{
__C
infiniStatus_t
infiniopCreateHandle
(
infiniopHandle_t
*
handle_ptr
)
{
if
(
handle_ptr
==
nullptr
)
{
return
INFINI_STATUS_NULL_POINTER
;
}
infiniDevice_t
device
;
int
device_id
;
CHECK_STATUS
(
infinirtGetDevice
(
&
device
,
&
device_id
));
switch
(
device
)
{
#ifdef ENABLE_CPU_API
case
INFINI_DEVICE_CPU
:
...
...
xmake.lua
View file @
601defcb
...
...
@@ -119,8 +119,25 @@ target("infini-utils")
add_files
(
"src/utils/*.cc"
)
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"
)
set_kind
(
"shared"
)
add_deps
(
"infinirt"
)
if
has_config
(
"cpu"
)
then
add_deps
(
"infiniop-cpu"
)
end
...
...
@@ -166,20 +183,6 @@ target("infiniop")
add_installfiles
(
"include/infinicore.h"
,
{
prefixdir
=
"include"
})
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"
)
set_kind
(
"phony"
)
add_deps
(
"infiniop"
,
"infinirt"
)
...
...
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