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
OpenDAS
dgl
Commits
4091a49c
Unverified
Commit
4091a49c
authored
Feb 27, 2024
by
Muhammed Fatih BALIN
Committed by
GitHub
Feb 27, 2024
Browse files
[GraphBolt][CUDA] Fix cudart destructor race in unpinning. (#7156)
parent
2d2ad71e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
8 deletions
+6
-8
python/dgl/graphbolt/impl/fused_csc_sampling_graph.py
python/dgl/graphbolt/impl/fused_csc_sampling_graph.py
+2
-4
python/dgl/graphbolt/impl/torch_based_feature_store.py
python/dgl/graphbolt/impl/torch_based_feature_store.py
+4
-4
No files found.
python/dgl/graphbolt/impl/fused_csc_sampling_graph.py
View file @
4091a49c
...
...
@@ -76,10 +76,7 @@ class FusedCSCSamplingGraph(SamplingGraph):
# https://github.com/pytorch/pytorch/issues/32167#issuecomment-753551842
if
hasattr
(
self
,
"_is_inplace_pinned"
):
for
tensor
in
self
.
_is_inplace_pinned
:
assert
(
torch
.
cuda
.
cudart
().
cudaHostUnregister
(
tensor
.
data_ptr
())
==
0
)
assert
self
.
_inplace_unpinner
(
tensor
.
data_ptr
())
==
0
@
property
def
total_num_nodes
(
self
)
->
int
:
...
...
@@ -1121,6 +1118,7 @@ class FusedCSCSamplingGraph(SamplingGraph):
)
self
.
_is_inplace_pinned
.
add
(
x
)
self
.
_inplace_unpinner
=
cudart
.
cudaHostUnregister
return
x
...
...
python/dgl/graphbolt/impl/torch_based_feature_store.py
View file @
4091a49c
...
...
@@ -93,9 +93,7 @@ class TorchBasedFeature(Feature):
# cudaHostUnregister to unpin the tensor in the destructor.
# https://github.com/pytorch/pytorch/issues/32167#issuecomment-753551842
for
tensor
in
self
.
_is_inplace_pinned
:
assert
(
torch
.
cuda
.
cudart
().
cudaHostUnregister
(
tensor
.
data_ptr
())
==
0
)
assert
self
.
_inplace_unpinner
(
tensor
.
data_ptr
())
==
0
def
read
(
self
,
ids
:
torch
.
Tensor
=
None
):
"""Read the feature by index.
...
...
@@ -187,14 +185,16 @@ class TorchBasedFeature(Feature):
assert
(
x
.
is_contiguous
()
),
"Tensor pinning is only supported for contiguous tensors."
cudart
=
torch
.
cuda
.
cudart
()
assert
(
torch
.
cuda
.
cudart
()
.
cudaHostRegister
(
cudart
.
cudaHostRegister
(
x
.
data_ptr
(),
x
.
numel
()
*
x
.
element_size
(),
0
)
==
0
)
self
.
_is_inplace_pinned
.
add
(
x
)
self
.
_inplace_unpinner
=
cudart
.
cudaHostUnregister
return
self
...
...
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