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
fd574720
Commit
fd574720
authored
May 16, 2025
by
bolun
Browse files
fix: 修复寒武纪平台 infinirt 编译问题
parent
0c803397
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
6 deletions
+20
-6
src/infinirt/bang/infinirt_bang.cc
src/infinirt/bang/infinirt_bang.cc
+6
-5
src/infinirt/bang/infinirt_bang.h
src/infinirt/bang/infinirt_bang.h
+1
-1
xmake.lua
xmake.lua
+3
-0
xmake/bang.lua
xmake/bang.lua
+10
-0
No files found.
src/infinirt/bang/infinirt_bang.cc
View file @
fd574720
...
...
@@ -6,7 +6,8 @@
namespace
infinirt
::
bang
{
infiniStatus_t
getDeviceCount
(
int
*
count
)
{
CHECK_BANGRT
(
cnrtGetDeviceCount
(
count
));
unsigned
int
device_count
=
static_cast
<
unsigned
int
>
(
*
count
);
CHECK_BANGRT
(
cnrtGetDeviceCount
(
&
device_count
));
return
INFINI_STATUS_SUCCESS
;
}
...
...
@@ -22,7 +23,7 @@ infiniStatus_t deviceSynchronize() {
infiniStatus_t
streamCreate
(
infinirtStream_t
*
stream_ptr
)
{
cnrtQueue_t
queue
;
CHECK_BANGRT
(
cnrtQueueCreate
(
&
stream
));
CHECK_BANGRT
(
cnrtQueueCreate
(
&
queue
));
*
stream_ptr
=
queue
;
return
INFINI_STATUS_SUCCESS
;
}
...
...
@@ -55,7 +56,7 @@ infiniStatus_t eventRecord(infinirtEvent_t event, infinirtStream_t stream) {
}
infiniStatus_t
eventQuery
(
infinirtEvent_t
event
,
infinirtEventStatus_t
*
status_ptr
)
{
auto
status
=
cnrtQueryNotifier
((
cnrt
Queue_t
)
stream
);
auto
status
=
cnrtQueryNotifier
((
cnrt
Notifier_t
)
event
);
if
(
status
==
cnrtSuccess
)
{
*
status_ptr
=
INFINIRT_EVENT_COMPLETE
;
}
else
if
(
status
==
cnrtErrorBusy
)
{
...
...
@@ -112,12 +113,12 @@ cnrtMemTransDir_t toBangMemcpyKind(infinirtMemcpyKind_t kind) {
}
infiniStatus_t
memcpy
(
void
*
dst
,
const
void
*
src
,
size_t
size
,
infinirtMemcpyKind_t
kind
)
{
CHECK_BANGRT
(
cnrtMemcpy
(
dst
,
src
,
size
,
toBangMemcpyKind
(
kind
)));
CHECK_BANGRT
(
cnrtMemcpy
(
dst
,
(
void
*
)
src
,
size
,
toBangMemcpyKind
(
kind
)));
return
INFINI_STATUS_SUCCESS
;
}
infiniStatus_t
memcpyAsync
(
void
*
dst
,
const
void
*
src
,
size_t
size
,
infinirtMemcpyKind_t
kind
,
infinirtStream_t
stream
)
{
CHECK_BANGRT
(
cnrtMemcpyAsync_V2
(
dst
,
src
,
size
,
(
cnrtQueue_t
)
stream
,
toBangMemcpyKind
(
kind
)));
CHECK_BANGRT
(
cnrtMemcpyAsync_V2
(
dst
,
(
void
*
)
src
,
size
,
(
cnrtQueue_t
)
stream
,
toBangMemcpyKind
(
kind
)));
return
INFINI_STATUS_SUCCESS
;
}
...
...
src/infinirt/bang/infinirt_bang.h
View file @
fd574720
...
...
@@ -3,7 +3,7 @@
#include "../infinirt_impl.h"
namespace
infinirt
::
bang
{
#ifdef ENABLE_
BANG
_API
#ifdef ENABLE_
CAMBRICON
_API
INFINIRT_DEVICE_API_IMPL
#else
INFINIRT_DEVICE_API_NOOP
...
...
xmake.lua
View file @
fd574720
...
...
@@ -162,6 +162,9 @@ target("infinirt")
if
has_config
(
"nv-gpu"
)
then
add_deps
(
"infinirt-cuda"
)
end
if
has_config
(
"cambricon-mlu"
)
then
add_deps
(
"infinirt-cambricon"
)
end
if
has_config
(
"ascend-npu"
)
then
add_deps
(
"infinirt-ascend"
)
end
...
...
xmake/bang.lua
View file @
fd574720
...
...
@@ -50,3 +50,13 @@ target("infiniop-cambricon")
add_files
(
mlu_files
,
{
rule
=
"mlu"
})
end
target_end
()
target
(
"infinirt-cambricon"
)
set_kind
(
"static"
)
add_deps
(
"infini-utils"
)
set_languages
(
"cxx17"
)
on_install
(
function
(
target
)
end
)
-- Add include dirs
add_files
(
"../src/infinirt/bang/*.cc"
)
add_cxflags
(
"-lstdc++ -Wall -Werror -fPIC"
)
target_end
()
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