Skip to content

Commit

Permalink
graph(HIP): adding inline keyword to fix kokkos#6623
Browse files Browse the repository at this point in the history
  • Loading branch information
romintomasetti committed Nov 27, 2023
1 parent f1d4666 commit f31436a
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions core/src/HIP/Kokkos_HIP_Graph_Impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class GraphImpl<Kokkos::HIP> {
hipGraphExec_t m_graph_exec = nullptr;
};

GraphImpl<Kokkos::HIP>::~GraphImpl() {
inline GraphImpl<Kokkos::HIP>::~GraphImpl() {
m_execution_space.fence("Kokkos::GraphImpl::~GraphImpl: Graph Destruction");
KOKKOS_EXPECTS(m_graph);
if (m_graph_exec) {
Expand All @@ -92,12 +92,12 @@ GraphImpl<Kokkos::HIP>::~GraphImpl() {
KOKKOS_IMPL_HIP_SAFE_CALL(hipGraphDestroy(m_graph));
}

GraphImpl<Kokkos::HIP>::GraphImpl(Kokkos::HIP instance)
inline GraphImpl<Kokkos::HIP>::GraphImpl(Kokkos::HIP instance)
: m_execution_space(std::move(instance)) {
KOKKOS_IMPL_HIP_SAFE_CALL(hipGraphCreate(&m_graph, 0));
}

void GraphImpl<Kokkos::HIP>::add_node(
inline void GraphImpl<Kokkos::HIP>::add_node(
std::shared_ptr<aggregate_node_impl_t> const& arg_node_ptr) {
// All of the predecessors are just added as normal, so all we need to
// do here is add an empty node
Expand All @@ -110,7 +110,7 @@ void GraphImpl<Kokkos::HIP>::add_node(
// Requires NodeImplPtr is a shared_ptr to specialization of GraphNodeImpl
// Also requires that the kernel has the graph node tag in it's policy
template <class NodeImpl>
void GraphImpl<Kokkos::HIP>::add_node(
inline void GraphImpl<Kokkos::HIP>::add_node(
std::shared_ptr<NodeImpl> const& arg_node_ptr) {
static_assert(NodeImpl::kernel_type::Policy::is_graph_kernel::value);
KOKKOS_EXPECTS(arg_node_ptr);
Expand All @@ -129,8 +129,8 @@ void GraphImpl<Kokkos::HIP>::add_node(
// already been added to this graph and NodeImpl is a specialization of
// GraphNodeImpl that has already been added to this graph.
template <class NodeImplPtr, class PredecessorRef>
void GraphImpl<Kokkos::HIP>::add_predecessor(NodeImplPtr arg_node_ptr,
PredecessorRef arg_pred_ref) {
inline void GraphImpl<Kokkos::HIP>::add_predecessor(
NodeImplPtr arg_node_ptr, PredecessorRef arg_pred_ref) {
KOKKOS_EXPECTS(arg_node_ptr);
auto pred_ptr = GraphAccess::get_node_ptr(arg_pred_ref);
KOKKOS_EXPECTS(pred_ptr);
Expand All @@ -145,20 +145,20 @@ void GraphImpl<Kokkos::HIP>::add_predecessor(NodeImplPtr arg_node_ptr,
hipGraphAddDependencies(m_graph, &pred_node, &node, 1));
}

void GraphImpl<Kokkos::HIP>::submit() {
inline void GraphImpl<Kokkos::HIP>::submit() {
if (!m_graph_exec) {
instantiate_graph();
}
KOKKOS_IMPL_HIP_SAFE_CALL(
hipGraphLaunch(m_graph_exec, m_execution_space.hip_stream()));
}

Kokkos::HIP const& GraphImpl<Kokkos::HIP>::get_execution_space() const
inline Kokkos::HIP const& GraphImpl<Kokkos::HIP>::get_execution_space() const
noexcept {
return m_execution_space;
}

auto GraphImpl<Kokkos::HIP>::create_root_node_ptr() {
inline auto GraphImpl<Kokkos::HIP>::create_root_node_ptr() {
KOKKOS_EXPECTS(m_graph);
KOKKOS_EXPECTS(!m_graph_exec);
auto rv = std::make_shared<root_node_impl_t>(get_execution_space(),
Expand All @@ -172,7 +172,7 @@ auto GraphImpl<Kokkos::HIP>::create_root_node_ptr() {
}

template <class... PredecessorRefs>
auto GraphImpl<Kokkos::HIP>::create_aggregate_ptr(PredecessorRefs&&...) {
inline auto GraphImpl<Kokkos::HIP>::create_aggregate_ptr(PredecessorRefs&&...) {
// The attachment to predecessors, which is all we really need, happens
// in the generic layer, which calls through to add_predecessor for
// each predecessor ref, so all we need to do here is create the (trivial)
Expand Down

0 comments on commit f31436a

Please sign in to comment.