Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv_contrib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv_contrib
Commits
debdc26b
Commit
debdc26b
authored
Mar 05, 2019
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge moved code from opencv
parents
33f18dd6
02b3d77b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
37 deletions
+37
-37
shuffle.hpp
modules/cudev/include/opencv2/cudev/warp/shuffle.hpp
+37
-37
No files found.
modules/cudev/include/opencv2/cudev/warp/shuffle.hpp
View file @
debdc26b
...
...
@@ -157,43 +157,6 @@ CV_CUDEV_SHFL_VEC_INST(double)
// shfl_up
template
<
typename
T
>
__device__
__forceinline__
T
compatible_shfl_up
(
T
val
,
uint
delta
,
int
width
=
warpSize
)
{
#if __CUDACC_VER_MAJOR__ < 9
return
shfl_up
(
val
,
delta
,
width
);
#else // __CUDACC_VER_MAJOR__ < 9
#if CV_CUDEV_ARCH >= 700
return
shfl_up_sync
(
0xFFFFFFFFU
,
val
,
delta
,
width
);
#else
const
int
block_size
=
Block
::
blockSize
();
const
int
residual
=
block_size
&
(
warpSize
-
1
);
if
(
0
==
residual
)
return
shfl_up_sync
(
0xFFFFFFFFU
,
val
,
delta
,
width
);
else
{
const
int
n_warps
=
divUp
(
block_size
,
warpSize
);
const
int
warp_id
=
Warp
::
warpId
();
if
(
warp_id
<
n_warps
-
1
)
return
shfl_up_sync
(
0xFFFFFFFFU
,
val
,
delta
,
width
);
else
{
// We are at the last threads of a block whose number of threads
// is not a multiple of the warp size
uint
mask
=
(
1LU
<<
residual
)
-
1
;
return
shfl_up_sync
(
mask
,
val
,
delta
,
width
);
}
}
#endif
#endif // __CUDACC_VER_MAJOR__ < 9
}
#if __CUDACC_VER_MAJOR__ >= 9
template
<
typename
T
>
...
...
@@ -300,6 +263,43 @@ CV_CUDEV_SHFL_UP_VEC_INST(double)
#endif
template
<
typename
T
>
__device__
__forceinline__
T
compatible_shfl_up
(
T
val
,
uint
delta
,
int
width
=
warpSize
)
{
#if __CUDACC_VER_MAJOR__ < 9
return
shfl_up
(
val
,
delta
,
width
);
#else // __CUDACC_VER_MAJOR__ < 9
#if CV_CUDEV_ARCH >= 700
return
shfl_up_sync
(
0xFFFFFFFFU
,
val
,
delta
,
width
);
#else
const
int
block_size
=
Block
::
blockSize
();
const
int
residual
=
block_size
&
(
warpSize
-
1
);
if
(
0
==
residual
)
return
shfl_up_sync
(
0xFFFFFFFFU
,
val
,
delta
,
width
);
else
{
const
int
n_warps
=
divUp
(
block_size
,
warpSize
);
const
int
warp_id
=
Warp
::
warpId
();
if
(
warp_id
<
n_warps
-
1
)
return
shfl_up_sync
(
0xFFFFFFFFU
,
val
,
delta
,
width
);
else
{
// We are at the last threads of a block whose number of threads
// is not a multiple of the warp size
uint
mask
=
(
1LU
<<
residual
)
-
1
;
return
shfl_up_sync
(
mask
,
val
,
delta
,
width
);
}
}
#endif
#endif // __CUDACC_VER_MAJOR__ < 9
}
// shfl_down
__device__
__forceinline__
uchar
shfl_down
(
uchar
val
,
uint
delta
,
int
width
=
warpSize
)
...
...
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