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

Implement L1Loss #3401

Open
wants to merge 28 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
8de41ef
add kernel for l1lossreducedforward5d
cognaiger9 May 13, 2024
0d00d6d
draft for utilities
cognaiger9 May 16, 2024
005fd3c
add 3 files in include/miopen/l1loss
cognaiger9 May 16, 2024
c3ba011
pull new driver code
cognaiger9 May 17, 2024
a508bbb
Merge branch 'develop-moreh' of github.com:ngoccoder/MIOpen into impl…
cognaiger9 May 17, 2024
de7c0e6
add driver code
cognaiger9 May 17, 2024
7e2014f
fix bug related to workspace
cognaiger9 May 21, 2024
463df2b
add driver for small sized tensor, need to investigate more
cognaiger9 May 22, 2024
415c191
add gtest script
cognaiger9 May 22, 2024
9b1c403
complete gtest cpu and gpu
cognaiger9 May 23, 2024
3bd6980
draft backward phase of l1loss
cognaiger9 May 24, 2024
256c2e0
add driver
cognaiger9 May 24, 2024
4524b09
complete driver for l1loss
cognaiger9 May 27, 2024
8b2f2f5
fix bug related to bfp16 data type in gtest
cognaiger9 May 27, 2024
f2c0750
add filter for forward case
cognaiger9 May 27, 2024
5bc0dfb
add only l1loss forward reduced
cognaiger9 May 30, 2024
3609cb0
remove redundant part
cognaiger9 Jun 4, 2024
8851320
merge rocm develop
cognaiger9 Jul 30, 2024
cdf3853
update benchmark method
cognaiger9 Aug 1, 2024
eeb971d
commit change
cognaiger9 Aug 5, 2024
eb48e6f
Merge branch 'develop' of https://github.com/ROCm/MIOpen into impl_l1…
cognaiger9 Nov 20, 2024
5fa31e6
change reduction procedure, still get inf result
cognaiger9 Nov 22, 2024
6e05582
fix gtest and driver
cognaiger9 Nov 22, 2024
ce8be4f
Merge branch 'develop' of https://github.com/ROCm/MIOpen into impl_l1…
cognaiger9 Nov 22, 2024
675fe1c
Merge branch 'develop' of https://github.com/ROCm/MIOpen into impl_l1…
cognaiger9 Nov 25, 2024
bd01023
Merge branch 'develop' into impl_l1loss_merged
long10024070 Dec 3, 2024
aa1e986
Merge branch 'develop' into impl_l1loss_merged
cognaiger9 Dec 12, 2024
e113fc8
Merge branch 'develop' into impl_l1loss_merged
long10024070 Dec 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
1 change: 0 additions & 1 deletion docs/reference/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,3 @@ The MIOpen API library is structured as follows:
* :doc:`RotaryPositionalEmbeddings <../doxygen/html/group__RotaryPositionalEmbeddings>` (experimental)
* :doc:`ReLU <../doxygen/html/group___re_l_u>` (experimental)
* :doc:`Kthvalue <../doxygen/html/group__kthvalue>` (experimental)
* :doc:`GLU <../doxygen/html/group__glu>` (experimental)
1 change: 1 addition & 0 deletions driver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ add_executable(MIOpenDriver
dm_glu.cpp
dm_groupnorm.cpp
dm_kthvalue.cpp
dm_l1loss.cpp
dm_layernorm.cpp
dm_lrn.cpp
dm_multimarginloss.cpp
Expand Down
41 changes: 41 additions & 0 deletions driver/dm_l1loss.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*******************************************************************************
*
* 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 "l1loss_driver.hpp"
#include "registry_driver_maker.hpp"

static Driver* makeDriver(const std::string& base_arg)
{
if(base_arg == "l1loss")
return new L1LossDriver<float, float>();
if(base_arg == "l1lossfp16")
return new L1LossDriver<float16, float>();
if(base_arg == "l1lossbfp16")
return new L1LossDriver<bfloat16, float>();
return nullptr;
}

REGISTER_DRIVER_MAKER(makeDriver);
4 changes: 2 additions & 2 deletions driver/driver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ inline void PadBufferSize(size_t& sz, int datatype_sz)
"adamw[fp16], ampadamw, transformersadamw[fp16], transformersampadamw, "
"getitem[bfp16|fp16], reducecalculation[bfp16|fp16], rope[bfp16|fp16], "
"prelu[bfp16|fp16], kthvalue[bfp16|fp16], glu[bfp16|fp16], softmarginloss[bfp16|fp16], "
"multimarginloss[bfp16|fp16]\n");
"multimarginloss[bfp16|fp16], l1loss[bfp16|fp16]\n");
exit(0); // NOLINT (concurrency-mt-unsafe)
}

Expand Down Expand Up @@ -352,7 +352,7 @@ inline std::string ParseBaseArg(int argc, char* argv[])
arg != "kthvaluebfp16" && arg != "glu" && arg != "glufp16" && arg != "glubfp16" &&
arg != "softmarginloss" && arg != "softmarginlossfp16" && arg != "softmarginlossbfp16" &&
arg != "multimarginloss" && arg != "multimarginlossfp16" && arg != "multimarginlossbfp16" &&
arg != "--version")
arg != "l1loss" && arg != "l1lossfp16" && arg != "l1lossbfp16" && arg != "--version")
{
printf("FAILED: Invalid Base Input Argument\n");
Usage();
Expand Down
Loading
Loading