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
infinilm
Commits
8a84761b
Commit
8a84761b
authored
Jul 02, 2025
by
Catheriany
Browse files
issue/12: 沐曦多卡推理卡死问题修复
parent
1e30fac0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
src/tensor/tensor.cpp
src/tensor/tensor.cpp
+8
-2
No files found.
src/tensor/tensor.cpp
View file @
8a84761b
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
#include <algorithm>
#include <algorithm>
#include <fstream>
#include <fstream>
#include <iostream>
#include <iostream>
#include <mutex>
#include <numeric>
#include <numeric>
#include <sstream>
#include <sstream>
...
@@ -143,8 +144,13 @@ std::shared_ptr<Tensor> Tensor::weight(void *data, infiniDtype_t dtype,
...
@@ -143,8 +144,13 @@ std::shared_ptr<Tensor> Tensor::weight(void *data, infiniDtype_t dtype,
tensor
->
_storage
=
Storage
::
create
(
size
);
tensor
->
_storage
=
Storage
::
create
(
size
);
tensor
->
_desc
=
TensorDesc
::
create
(
dtype
,
shape
,
strides
);
tensor
->
_desc
=
TensorDesc
::
create
(
dtype
,
shape
,
strides
);
RUN_INFINI
(
infinirtMemcpy
(
tensor
->
_storage
->
memory
(),
// NOTE: 为兼容部分平台(沐曦)多线程并发对同一host数据执行memcpy卡死问题
data
,
size
,
INFINIRT_MEMCPY_H2D
));
static
std
::
mutex
mutex
;
{
std
::
lock_guard
<
std
::
mutex
>
lock
(
mutex
);
RUN_INFINI
(
infinirtMemcpy
(
tensor
->
_storage
->
memory
(),
data
,
size
,
INFINIRT_MEMCPY_H2D
));
}
tensor
->
_offset
=
0
;
tensor
->
_offset
=
0
;
return
tensor
;
return
tensor
;
...
...
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