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
gaoqiong
MIGraphX
Commits
155bb1fd
Commit
155bb1fd
authored
Jun 30, 2022
by
Paul
Browse files
Add lazy index calculations
parent
551c2e45
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
5 deletions
+30
-5
src/targets/gpu/kernels/include/migraphx/kernels/index.hpp
src/targets/gpu/kernels/include/migraphx/kernels/index.hpp
+30
-5
No files found.
src/targets/gpu/kernels/include/migraphx/kernels/index.hpp
View file @
155bb1fd
...
@@ -31,11 +31,36 @@
...
@@ -31,11 +31,36 @@
namespace
migraphx
{
namespace
migraphx
{
extern
"C"
__device__
__attribute__
((
const
))
size_t
__ockl_get_global_id
(
uint
);
extern
"C"
__device__
__attribute__
((
const
))
size_t
__ockl_get_local_id
(
uint
);
extern
"C"
__device__
__attribute__
((
const
))
size_t
__ockl_get_group_id
(
uint
);
struct
index
struct
index
{
{
index_int
global
=
0
;
struct
global_read
index_int
local
=
0
;
{
index_int
group
=
0
;
__device__
operator
index_int
()
const
{
return
index_int
{
blockIdx
.
x
}
*
index_int
{
blockDim
.
x
}
+
index_int
{
threadIdx
.
x
};
// NOLINT
}
};
struct
local_read
{
__device__
operator
index_int
()
const
{
return
threadIdx
.
x
;
// NOLINT
}
};
struct
group_read
{
__device__
operator
index_int
()
const
{
return
blockIdx
.
x
;
// NOLINT
}
};
global_read
global
{};
local_read
local
{};
group_read
group
{};
#ifdef MIGRAPHX_NGLOBAL
#ifdef MIGRAPHX_NGLOBAL
constexpr
index_constant
<
MIGRAPHX_NGLOBAL
>
nglobal
()
const
{
return
{};
}
constexpr
index_constant
<
MIGRAPHX_NGLOBAL
>
nglobal
()
const
{
return
{};
}
...
@@ -98,9 +123,9 @@ struct index
...
@@ -98,9 +123,9 @@ struct index
}
}
};
};
inline
__device__
index
make_index
()
inline
__device__
__attribute__
((
const
))
index
make_index
()
{
{
return
index
{
blockIdx
.
x
*
blockDim
.
x
+
threadIdx
.
x
,
threadIdx
.
x
,
blockIdx
.
x
};
// NOLINT
return
index
{
};
}
}
}
// namespace migraphx
}
// namespace migraphx
...
...
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