Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
0c2d00d
Reference CGEMM + test stub
myamlak May 11, 2022
4d07aa1
Format.
myamlak May 12, 2022
b1c9458
Incomplete simple implementation
myamlak May 13, 2022
6a0883f
Library instances
myamlak May 13, 2022
14bd143
Sketch of tests
myamlak May 13, 2022
674f74a
Test fixes.
myamlak May 16, 2022
55927aa
Example added
myamlak May 16, 2022
ffe12e2
Cosmetics
myamlak May 16, 2022
a61f34f
Add elementwise operation kernel and example
May 16, 2022
c262612
Add comment
May 17, 2022
e00a943
Merge remote-tracking branch 'origin/develop' into myamlak/cgemm
myamlak May 17, 2022
b3767db
Merge remote-tracking branch 'origin/eltwise_op' into myamlak/cgemm
myamlak May 17, 2022
b456d5e
Add template argument of dim . Prepare to support multiple dimension
May 17, 2022
0d26477
Rename example
May 17, 2022
4af77e1
Support 1 dimension
May 17, 2022
492da45
Add static assert
May 17, 2022
ecdfe96
Add comment
May 17, 2022
5ae304d
Second auxiliary buffer added
myamlak May 17, 2022
0f84025
Extract pad
May 17, 2022
06e52d9
Remove redundant argument
May 17, 2022
7d44e78
Support any dimension for elementwise operation
May 17, 2022
b7a82d2
Remove line
May 17, 2022
83f7531
Let it be the multiple number of CU
May 18, 2022
c4d610b
Move thread per block to the parameter of constructor
May 18, 2022
5e10474
Merge remote-tracking branch 'origin/eltwise_op' into myamlak/cgemm
myamlak May 18, 2022
208ac1a
Consuming binary ops to do A+B / A-B
myamlak May 18, 2022
6ebcb66
Fix + cosmetics + bf16 test commented out temporarily
myamlak May 18, 2022
a7676df
Merge remote-tracking branch 'origin/develop' into myamlak/cgemm
myamlak May 19, 2022
f63ca8e
Format
myamlak May 19, 2022
f497e2b
Enabling bf16 test
myamlak May 19, 2022
18125c3
Revert "Enabling bf16 test"
myamlak May 20, 2022
5fd5daa
Fix + test reenabled
myamlak May 20, 2022
d731023
fix build
May 21, 2022
d00ecab
Revert "fix build"
rosenrodt May 23, 2022
3f8e846
post PR #235 merge fix
rosenrodt May 23, 2022
1cfff19
amend
rosenrodt May 23, 2022
326d331
Merge remote-tracking branch 'origin/develop' into myamlak/cgemm
myamlak May 23, 2022
4379d8d
Merge remote-tracking branch 'origin/fix_build_0521' into myamlak/cgemm
myamlak May 23, 2022
f73c3ea
Single workspace for cgemm + helper
myamlak May 23, 2022
d3ec209
Perf calc fix
myamlak May 23, 2022
b7d9cde
Merge remote-tracking branch 'origin/develop' into myamlak/cgemm
myamlak May 24, 2022
ac9ef30
Review remarks: static_cast
myamlak May 24, 2022
d478a38
Review remarks: binary ops templated
myamlak May 24, 2022
c82093c
Cleaning
myamlak May 24, 2022
e6914f2
Removal of instances and their tests
myamlak May 24, 2022
ee06099
Review remarks from aosew addressed
myamlak May 24, 2022
97ac500
Review remark: unnecessary attribute
myamlak May 25, 2022
bb1f808
Merge remote-tracking branch 'origin/develop' into myamlak/cgemm
myamlak May 26, 2022
80f038a
Post-merge fixes
myamlak May 26, 2022
bda2654
Merge remote-tracking branch 'origin/develop' into myamlak/cgemm
myamlak May 27, 2022
7d2fa99
Restrict 4gemm to PassThrough + bug fix
myamlak May 27, 2022
d35c6a8
Review remarks
myamlak May 30, 2022
5b250a9
Merge branch 'develop' into myamlak/cgemm
myamlak May 30, 2022
fe01b4d
Merge remote-tracking branch 'origin/develop' into myamlak/cgemm
May 30, 2022
52ccb9b
update licence
May 30, 2022
9fdbcf9
change cgemm example to fp16
May 30, 2022
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
36 changes: 31 additions & 5 deletions example/19_binary_elementwise/broadcast_add_2d_amn_bn.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
/*******************************************************************************
*
* MIT License
*
* Copyright (c) 2022 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 <iostream>
#include <cstdlib>
#include "check_err.hpp"
Expand All @@ -17,7 +42,8 @@ using ABDataType = F16;
using CDataType = F16;
using EltwiseComputeDataType = F32;

using Add = ck::tensor_operation::binary_element_wise::Add;
using Add = ck::tensor_operation::binary_element_wise::
Add<EltwiseComputeDataType, EltwiseComputeDataType, EltwiseComputeDataType>;

using DeviceElementwiseAddInstance =
ck::tensor_operation::device::DeviceBinaryElementwise<ABDataType,
Expand Down Expand Up @@ -46,19 +72,19 @@ void host_broadcast2D(
{
for(int n = 0; n < N; ++n)
{
ComputeDataType Amn = static_cast<ComputeDataType>(A(m, n));
ComputeDataType Amn = ck::type_convert<ComputeDataType>(A(m, n));
ComputeDataType Cmn = 0;
if constexpr(broadcastDim == 0)
{
ComputeDataType Bn = static_cast<ComputeDataType>(B(n));
ComputeDataType Bn = ck::type_convert<ComputeDataType>(B(n));
functor(Cmn, Amn, Bn);
}
else
{
ComputeDataType Bm = static_cast<ComputeDataType>(B(m));
ComputeDataType Bm = ck::type_convert<ComputeDataType>(B(m));
functor(Cmn, Amn, Bm);
}
C(m, n) = static_cast<ctype>(Cmn);
C(m, n) = ck::type_convert<ctype>(Cmn);
}
}
}
Expand Down
9 changes: 5 additions & 4 deletions example/19_binary_elementwise/broadcast_add_3d_am_bmnk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ using ABDataType = F16;
using CDataType = F16;
using EltwiseComputeDataType = F32;

using Add = ck::tensor_operation::binary_element_wise::Add;
using Add = ck::tensor_operation::binary_element_wise::
Add<EltwiseComputeDataType, EltwiseComputeDataType, EltwiseComputeDataType>;

using DeviceElementwiseAddInstance =
ck::tensor_operation::device::DeviceBinaryElementwise<ABDataType,
Expand Down Expand Up @@ -48,11 +49,11 @@ void host_broadcast3D_am_bmnk(HostTensorC& C,
for(std::size_t n = 0; n < shape[1]; ++n)
for(std::size_t k = 0; k < shape[2]; ++k)
{
ComputeDataType a_val = static_cast<ComputeDataType>(A(m));
ComputeDataType b_val = static_cast<ComputeDataType>(B(m, n, k));
ComputeDataType a_val = ck::type_convert<ComputeDataType>(A(m));
ComputeDataType b_val = ck::type_convert<ComputeDataType>(B(m, n, k));
ComputeDataType c_val = 0;
functor(c_val, a_val, b_val);
C(m, n, k) = static_cast<ctype>(c_val);
C(m, n, k) = ck::type_convert<ctype>(c_val);
}
}

Expand Down
34 changes: 30 additions & 4 deletions example/19_binary_elementwise/elementwise_add_1d.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
/*******************************************************************************
*
* MIT License
*
* Copyright (c) 2022 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 <iostream>
#include <cstdlib>
#include "check_err.hpp"
Expand All @@ -17,7 +42,8 @@ using ABDataType = F16;
using CDataType = F16;
using EltwiseComputeDataType = F32;

using Add = ck::tensor_operation::binary_element_wise::Add;
using Add = ck::tensor_operation::binary_element_wise::
Add<EltwiseComputeDataType, EltwiseComputeDataType, EltwiseComputeDataType>;

using DeviceElementwiseAddInstance =
ck::tensor_operation::device::DeviceBinaryElementwise<ABDataType,
Expand All @@ -43,11 +69,11 @@ void host_elementwise1D(

for(int m = 0; m < M; ++m)
{
ComputeDataType Am = static_cast<ComputeDataType>(A(m));
ComputeDataType Bm = static_cast<ComputeDataType>(B(m));
ComputeDataType Am = ck::type_convert<ComputeDataType>(A(m));
ComputeDataType Bm = ck::type_convert<ComputeDataType>(B(m));
ComputeDataType Cm = 0;
functor(Cm, Am, Bm);
C(m) = static_cast<ctype>(Cm);
C(m) = ck::type_convert<ctype>(Cm);
}
}

Expand Down
34 changes: 30 additions & 4 deletions example/19_binary_elementwise/elementwise_add_4d.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
/*******************************************************************************
*
* MIT License
*
* Copyright (c) 2020 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 <iostream>
#include <cstdlib>
#include "check_err.hpp"
Expand All @@ -17,7 +42,8 @@ using ABDataType = F16;
using CDataType = F16;
using EltwiseComputeDataType = F32;

using Add = ck::tensor_operation::binary_element_wise::Add;
using Add = ck::tensor_operation::binary_element_wise::
Add<EltwiseComputeDataType, EltwiseComputeDataType, EltwiseComputeDataType>;

using DeviceElementwiseAddInstance =
ck::tensor_operation::device::DeviceBinaryElementwise<ABDataType,
Expand Down Expand Up @@ -49,11 +75,11 @@ void host_elementwise4D(HostTensorC& C,
for(std::size_t h = 0; h < shape[2]; ++h)
for(std::size_t w = 0; w < shape[3]; ++w)
{
ComputeDataType a_val = static_cast<ComputeDataType>(A(n, c, h, w));
ComputeDataType b_val = static_cast<ComputeDataType>(B(n, c, h, w));
ComputeDataType a_val = ck::type_convert<ComputeDataType>(A(n, c, h, w));
ComputeDataType b_val = ck::type_convert<ComputeDataType>(B(n, c, h, w));
ComputeDataType c_val = 0;
functor(c_val, a_val, b_val);
C(n, c, h, w) = static_cast<ctype>(c_val);
C(n, c, h, w) = ck::type_convert<ctype>(c_val);
}
}

Expand Down
1 change: 1 addition & 0 deletions example/22_cgemm/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
add_example_executable(example_cgemm_xdl_fp16 cgemm_xdl_fp16.cpp)
Loading