-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e838327
commit 6981baf
Showing
6 changed files
with
715 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#include "bang_kernel.hh" | ||
|
||
namespace refactor::kernel { | ||
using K = SoftmaxBang; | ||
|
||
K::SoftmaxBang(SoftmaxInfo info_) noexcept | ||
: Kernel(), info(std::move(info_)) {} | ||
|
||
auto K::build(SoftmaxInfo info) noexcept -> KernelBox { | ||
#ifndef USE_BANG | ||
return nullptr; | ||
#endif | ||
|
||
return info.type.isFloat() | ||
? std::make_unique<K>(std::move(info)) | ||
: nullptr; | ||
} | ||
|
||
auto K::typeId() noexcept -> size_t { | ||
static uint8_t ID = 1; | ||
return reinterpret_cast<size_t>(&ID); | ||
} | ||
|
||
auto K::kernelTypeId() const noexcept -> size_t { return typeId(); } | ||
auto K::description() const noexcept -> std::string_view { | ||
return "Performing Softmax using BANG"; | ||
} | ||
|
||
}// namespace refactor::kernel |
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,26 @@ | ||
#ifndef KERNEL_SOFTMAX_BANG_HH | ||
#define KERNEL_SOFTMAX_BANG_HH | ||
|
||
#include "cnnl.h" | ||
#include "cnrt.h" | ||
#include "kernel/attributes/softmax_info.h" | ||
#include "kernel/collectors/softmax.h" | ||
namespace refactor::kernel { | ||
|
||
struct SoftmaxBang final : public Kernel { | ||
SoftmaxInfo info; | ||
|
||
SoftmaxBang(SoftmaxInfo) noexcept; | ||
static KernelBox build(SoftmaxInfo) noexcept; | ||
static size_t typeId() noexcept; | ||
|
||
size_t kernelTypeId() const noexcept final; | ||
std::string_view description() const noexcept final; | ||
#ifdef USE_BANG | ||
RoutineWorkspace lower(Resources &) const noexcept final; | ||
#endif | ||
}; | ||
|
||
}// namespace refactor::kernel | ||
|
||
#endif//KERNEL_SOFTMAX_BANG_HH |
Oops, something went wrong.