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
torch-scatter
Commits
e30538b1
Commit
e30538b1
authored
Jan 09, 2020
by
rusty1s
Browse files
removed __host__ calls
parent
2a7622b6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
8 deletions
+9
-8
cuda/indptr.cuh
cuda/indptr.cuh
+1
-1
cuda/segment_kernel.cu
cuda/segment_kernel.cu
+8
-7
No files found.
cuda/indptr.cuh
View file @
e30538b1
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
// We need our own `IndexToOffset` implementation since we do not want to
// We need our own `IndexToOffset` implementation since we do not want to
// access the last element of the `indexptr`.
// access the last element of the `indexptr`.
template
<
typename
scalar_t
>
struct
IndexPtrToOffset
{
template
<
typename
scalar_t
>
struct
IndexPtrToOffset
{
static
inline
__host__
__device__
int
static
inline
__device__
int
get
(
int
idx
,
const
at
::
cuda
::
detail
::
TensorInfo
<
scalar_t
,
int
>
&
info
)
{
get
(
int
idx
,
const
at
::
cuda
::
detail
::
TensorInfo
<
scalar_t
,
int
>
&
info
)
{
int
offset
=
idx
%
(
info
.
sizes
[
info
.
dims
-
1
]
-
1
);
int
offset
=
idx
%
(
info
.
sizes
[
info
.
dims
-
1
]
-
1
);
offset
*=
info
.
strides
[
info
.
dims
-
1
];
offset
*=
info
.
strides
[
info
.
dims
-
1
];
...
...
cuda/segment_kernel.cu
View file @
e30538b1
...
@@ -30,7 +30,7 @@ enum ReductionType { ADD, MEAN, MIN, MAX };
...
@@ -30,7 +30,7 @@ enum ReductionType { ADD, MEAN, MIN, MAX };
}()
}()
template
<
typename
scalar_t
,
ReductionType
REDUCE
>
struct
Reducer
{
template
<
typename
scalar_t
,
ReductionType
REDUCE
>
struct
Reducer
{
static
inline
__host__
__device__
scalar_t
init
()
{
static
inline
__device__
scalar_t
init
()
{
if
(
REDUCE
==
MIN
)
{
if
(
REDUCE
==
MIN
)
{
return
std
::
numeric_limits
<
scalar_t
>::
max
();
return
std
::
numeric_limits
<
scalar_t
>::
max
();
}
else
if
(
REDUCE
==
MAX
)
{
}
else
if
(
REDUCE
==
MAX
)
{
...
@@ -40,7 +40,7 @@ template <typename scalar_t, ReductionType REDUCE> struct Reducer {
...
@@ -40,7 +40,7 @@ template <typename scalar_t, ReductionType REDUCE> struct Reducer {
}
}
}
}
static
inline
__host__
__device__
void
update
(
scalar_t
*
val
,
scalar_t
new_val
,
static
inline
__device__
void
update
(
scalar_t
*
val
,
scalar_t
new_val
,
int64_t
*
arg
,
int64_t
new_arg
)
{
int64_t
*
arg
,
int64_t
new_arg
)
{
if
(
REDUCE
==
ADD
||
REDUCE
==
MEAN
)
{
if
(
REDUCE
==
ADD
||
REDUCE
==
MEAN
)
{
*
val
=
*
val
+
new_val
;
*
val
=
*
val
+
new_val
;
...
@@ -51,9 +51,9 @@ template <typename scalar_t, ReductionType REDUCE> struct Reducer {
...
@@ -51,9 +51,9 @@ template <typename scalar_t, ReductionType REDUCE> struct Reducer {
}
}
}
}
static
inline
__host__
__device__
void
write
(
scalar_t
*
address
,
scalar_t
val
,
static
inline
__device__
void
write
(
scalar_t
*
address
,
scalar_t
val
,
int64_t
*
arg_address
,
int64_t
*
arg_address
,
int64_t
arg
,
int64_t
arg
,
int
count
)
{
int
count
)
{
if
(
REDUCE
==
ADD
)
{
if
(
REDUCE
==
ADD
)
{
*
address
=
val
;
*
address
=
val
;
}
else
if
(
REDUCE
==
MEAN
)
{
}
else
if
(
REDUCE
==
MEAN
)
{
...
@@ -126,7 +126,8 @@ segment_csr_kernel(const scalar_t *src_data,
...
@@ -126,7 +126,8 @@ segment_csr_kernel(const scalar_t *src_data,
if
(
REDUCE
==
MIN
||
REDUCE
==
MAX
)
{
if
(
REDUCE
==
MIN
||
REDUCE
==
MAX
)
{
tmp
=
__shfl_down_sync
(
FULL_MASK
,
val
,
i
);
tmp
=
__shfl_down_sync
(
FULL_MASK
,
val
,
i
);
arg_tmp
=
__shfl_down_sync
(
FULL_MASK
,
arg
,
i
);
arg_tmp
=
__shfl_down_sync
(
FULL_MASK
,
arg
,
i
);
if
(
row_start
+
lane_idx
+
i
<
row_end
)
// Only update valid entries.
if
(
lane_idx
<
i
&&
row_start
+
lane_idx
+
i
<
row_end
)
Reducer
<
scalar_t
,
REDUCE
>::
update
(
&
val
,
tmp
,
&
arg
,
arg_tmp
);
Reducer
<
scalar_t
,
REDUCE
>::
update
(
&
val
,
tmp
,
&
arg
,
arg_tmp
);
}
else
{
}
else
{
Reducer
<
scalar_t
,
REDUCE
>::
update
(
Reducer
<
scalar_t
,
REDUCE
>::
update
(
...
...
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