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
composable_kernel
Commits
b4e2b28c
Commit
b4e2b28c
authored
Sep 15, 2022
by
Po-Yen, Chen
Browse files
Add BaseInvokerCRTP<> class template to generate method
parent
68a2443a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
0 deletions
+19
-0
include/ck/tensor_operation/gpu/device/device_base.hpp
include/ck/tensor_operation/gpu/device/device_base.hpp
+19
-0
No files found.
include/ck/tensor_operation/gpu/device/device_base.hpp
View file @
b4e2b28c
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
#pragma once
#pragma once
#include <cmath>
#include <string>
#include <string>
#include "ck/stream_config.hpp"
#include "ck/stream_config.hpp"
...
@@ -56,6 +57,24 @@ struct BaseOperator
...
@@ -56,6 +57,24 @@ struct BaseOperator
virtual
~
BaseOperator
()
{}
virtual
~
BaseOperator
()
{}
};
};
template
<
typename
DerivedInvoker
,
typename
Argument
>
struct
BaseInvokerCRTP
:
BaseInvoker
{
static_assert
(
std
::
is_class_v
<
Argument
>
&&
std
::
is_base_of_v
<
BaseArgument
,
Argument
>
);
float
Run
(
const
BaseArgument
*
arg
,
const
StreamConfig
&
stream_config
=
StreamConfig
{})
override
final
{
const
auto
*
const
argument
=
dynamic_cast
<
const
Argument
*>
(
arg
);
if
(
!
argument
)
{
return
NAN
;
}
return
DerivedInvoker
::
Run
(
*
argument
,
stream_config
);
}
};
}
// namespace device
}
// namespace device
}
// namespace tensor_operation
}
// namespace tensor_operation
}
// namespace ck
}
// namespace ck
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