Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port PadConstantForwardContiguous #4

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
2e37c5c
Constant pad skeleton added, build OK
o2buzzle Apr 10, 2024
e035d86
Compute ncdhw inside manually from y_dims
o2buzzle Apr 10, 2024
de22440
fix: make ydesc (output desc) a user input
o2buzzle Apr 11, 2024
7555aa6
pain: redo all the apis with readable comments.
o2buzzle Apr 11, 2024
8897cd4
dummy gtest
o2buzzle Apr 11, 2024
ca93820
Merge branch 'moreh-dev:develop' into port/PadConstantFwdContiguous
o2buzzle Apr 12, 2024
9f57e17
added: gtest unit test for PadConstant
o2buzzle Apr 12, 2024
32df3f6
fix: added checks for input/output tensor types
o2buzzle Apr 12, 2024
4e3392a
fix: use absolute equality (we are not performing calculation, it sho…
o2buzzle Apr 12, 2024
324af0f
added: MIOpenDriver for PadConstant
o2buzzle Apr 15, 2024
e6daba9
use size_t for padding in gtest
o2buzzle Apr 15, 2024
7d413c4
fix: use [INPUT|OUTPUT]_TYPE as kernel launch arguments
o2buzzle Apr 15, 2024
71b568b
fix: 5dpos should be y_dim. oops
o2buzzle Apr 15, 2024
fa53dfb
added: doxygen docs
o2buzzle Apr 15, 2024
e5e10ce
fix: remove unnecessary imports
o2buzzle Apr 15, 2024
7a051ed
chore: license date -> 2024
o2buzzle Apr 16, 2024
ab23d80
chore[cpu_pad_constant.hpp]: remove python example
o2buzzle Apr 16, 2024
ee225c8
chore: make naming consistent
o2buzzle Apr 16, 2024
a2de650
chore: change driver basearg
o2buzzle Apr 16, 2024
672b6f0
chore: rename driver module file name
o2buzzle Apr 16, 2024
13843f9
fix: remove unused context
o2buzzle Apr 16, 2024
6fc4b04
chore: cleanup kernel comments
o2buzzle Apr 16, 2024
5886ed9
fix: input parameters for driver
o2buzzle Apr 16, 2024
85fbed9
chore: tidy CMakeLists
o2buzzle Apr 16, 2024
99a9a43
fix: close `pad_constant` Doxygen group
o2buzzle Apr 16, 2024
4871cfd
fix: switch to `maybe_unused` for unused context
o2buzzle Apr 16, 2024
5ef4fc2
fix: remove source size as kernel cache parameter
o2buzzle Apr 16, 2024
2bd5b9b
fix: use yDesc.GetElementSize instead of computing the sizes manually
o2buzzle Apr 16, 2024
6c660ad
fix: use a static struct for input/output tensors dimensions and strides
o2buzzle Apr 17, 2024
156b71f
chore: reformat some files.
o2buzzle Apr 17, 2024
241c23a
Revert "fix: switch to `maybe_unused` for unused context"
o2buzzle Apr 17, 2024
cf360b4
chore[gtest]: remove debugging comments
o2buzzle Apr 17, 2024
5b5a94e
fix[gtest]: change random scale for prng back to 1
o2buzzle Apr 17, 2024
b898a1a
fix[gtest]: change verification strategy
o2buzzle Apr 17, 2024
078c606
chore: re-format changes
o2buzzle Apr 17, 2024
215f90d
feat[driver]: fp16+bfp16 for constantpad
o2buzzle Apr 17, 2024
121eff4
fix: remove brackets for single if case
o2buzzle Apr 17, 2024
f5eac46
fix: use a static array for padding
o2buzzle Apr 19, 2024
1dfe743
fix: proper fp16+bfp16 impl
o2buzzle Apr 19, 2024
5944639
fix: overload for AlignUp
o2buzzle Apr 19, 2024
c371e48
fix: mark header function as inline
o2buzzle Apr 19, 2024
e5148ea
fix[docs]: change doxygen group name to match PadReflection
o2buzzle Apr 19, 2024
ae3758d
fix[driver]: pass padding as host-side array
o2buzzle Apr 22, 2024
ac0622e
fix: general formmating issues
o2buzzle Apr 23, 2024
dfbcde2
fix: formatting issues
o2buzzle Apr 23, 2024
cf0aa0f
fix: change kernel format
o2buzzle Apr 23, 2024
7e69239
fix: add checks for whether or not the inputs and output have the sam…
o2buzzle Apr 23, 2024
98bba90
fix: condense input and output types.
o2buzzle Apr 23, 2024
4a7123e
Revert "fix: condense input and output types."
o2buzzle Apr 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/reference/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,5 @@ The MIOpen API library is structured as follows:
* :doc:`Sum <../doxygen/html/group__sum>` (experimental)
* :doc:`GroupNorm <../doxygen/html/group__groupnorm>` (experimental)
* :doc:`Cat <../doxygen/html/group__cat>` (experimental)
* :doc:`Argmax<./argmax>` (experimental)
* :doc:`Pad<../doxygen/html/group__pad>` (experimental)
* :doc:`Argmax<./argmax>` (experimental)
1 change: 1 addition & 0 deletions driver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ add_executable(MIOpenDriver
dm_groupnorm.cpp
dm_layernorm.cpp
dm_lrn.cpp
dm_pad_constant.cpp
dm_pool.cpp
dm_reduce.cpp
dm_rnn.cpp
Expand Down
42 changes: 42 additions & 0 deletions driver/dm_pad_constant.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*******************************************************************************
*
* MIT License
*
* Copyright (c) 2024 Advanced Micro Devices, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*******************************************************************************/

#include "miopen/bfloat16.hpp"
#include "pad_constant_driver.hpp"
#include "registry_driver_maker.hpp"

static Driver* makeDriver(const std::string& base_arg)
{
if(base_arg == "padconstant")
return new ConstantPadDriver<float, float>();
if(base_arg == "padconstantbfp16")
return new ConstantPadDriver<bfloat16, bfloat16>();
if(base_arg == "padconstantfp16")
return new ConstantPadDriver<half, half>();
return nullptr;
}

REGISTER_DRIVER_MAKER(makeDriver);
5 changes: 3 additions & 2 deletions driver/driver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ inline void PadBufferSize(size_t& sz, int datatype_sz)
"pool[fp16], lrn[fp16], "
"activ[fp16], softmax[fp16], bnorm[fp16], rnn[fp16], gemm[fp16], ctc, dropout[fp16], "
"tensorop[fp16], reduce[fp16|fp64], layernorm[bfp16|fp16], sum[bfp16|fp16], "
"argmax[bfp16|fp16], groupnorm[bfp16|fp16], cat[bfp16|fp16]\n");
"argmax[bfp16|fp16], groupnorm[bfp16|fp16], cat[bfp16|fp16], padconstant[bfp16|fp16]\n");
exit(0); // NOLINT (concurrency-mt-unsafe)
}

Expand All @@ -176,7 +176,8 @@ inline std::string ParseBaseArg(int argc, char* argv[])
arg != "layernormfp16" && arg != "layernormbfp16" && arg != "sum" && arg != "sumfp16" &&
arg != "sumbfp16" && arg != "argmax" && arg != "argmaxfp16" && arg != "argmaxbfp16" &&
arg != "groupnorm" && arg != "groupnormfp16" && arg != "groupnormbfp16" && arg != "cat" &&
arg != "catfp16" && arg != "catbfp16" && arg != "--version")
arg != "catfp16" && arg != "catbfp16" && arg != "padconstant" && arg != "padconstantbfp16" &&
arg != "padconstantfp16" && arg != "--version")
{
printf("FAILED: Invalid Base Input Argument\n");
Usage();
Expand Down
Loading