-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ GPU/OpenCL ] Split register kernel from forwarding function
- This commit is draft - This commit splits kernel registeration from forwarding function. - This is WIP. This commit contains example update for concat_cl and fc_layer_cl. Self evaluation: Build test: [X]Passed [ ]Failed [ ]Skipped Run test: [X]Passed [ ]Failed [ ]Skipped Signed-off-by: Eunju Yang <[email protected]>
- Loading branch information
Showing
6 changed files
with
162 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
/** | ||
* Copyright (C) 2024 Eunju Yang <[email protected]> | ||
* | ||
* @file layer_impl_cl.h | ||
* @date 04 Nov 2024 | ||
* @brief This is base Layer implementation class for OpenCL | ||
* @see https://github.com/nnstreamer/nntrainer | ||
* @author Eunju Yang <[email protected]> | ||
* @bug No known bugs except for NYI items | ||
* | ||
* @details LayerImplCl forms the base class for all the opencl_layer with | ||
* weights and bias parameters. LayerImpl provides parsing of properties like | ||
* Weight/bias initializer and regularizers. LayerImpl also provides checks for | ||
* double calls to finalize function. This is wrpper class of layer_impl for | ||
* OpenCL. | ||
*/ | ||
#ifndef __LAYER_IMPL_CL_H__ | ||
#define __LAYER_IMPL_CL_H__ | ||
#ifdef __cplusplus | ||
|
||
#include <cl_context.h> | ||
#include <layer_impl.h> | ||
|
||
namespace nntrainer { | ||
|
||
/** | ||
* @class LayerImplCl | ||
* @brief LayerImplCl | ||
*/ | ||
class LayerImplCl : public LayerImpl { | ||
|
||
public: | ||
/** | ||
* @brief Constructor of Layer Class | ||
*/ | ||
LayerImplCl() : LayerImpl(){}; | ||
|
||
/** | ||
* @brief Destructor of Layer Class | ||
*/ | ||
virtual ~LayerImplCl() = default; | ||
|
||
/** | ||
* @brief Move constructor of LayerImpl Layer. | ||
* @param[in] LayerImplCl && | ||
*/ | ||
LayerImplCl(LayerImplCl &&rhs) noexcept = default; | ||
|
||
/** | ||
* @brief Move assignment operator. | ||
* @parma[in] rhs LayerImplCl to be moved. | ||
*/ | ||
LayerImplCl &operator=(LayerImplCl &&rhs) = default; | ||
|
||
/** | ||
* @brief register ClKernels for this layer | ||
* registerClKernels() is called in global ClContext. | ||
*/ | ||
static bool registerClKernels(); | ||
|
||
protected: | ||
inline static ClContext cl_context_ref; | ||
}; | ||
|
||
} // namespace nntrainer | ||
|
||
#endif /** __cplusplus */ | ||
#endif /** LAYER_IMPL_CL */ |