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

Fix compiler error #1619

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
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
15 changes: 11 additions & 4 deletions tensilelite/Tensile/Source/ReductionTemplate.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ struct static_for
}
};

constexpr size_t max(size_t a, size_t b)
{
return (a > b) ? a : b;
}

template <typename DataTypeCompute, typename DataTypeOut, size_t MT0, size_t MT1, size_t VW>
__device__ inline void
reductionKernel_ijk(DataTypeCompute* in, DataTypeOut* out, int m, int n, int strideJ)
Expand All @@ -60,7 +65,8 @@ __device__ inline void
int num_records = strideJ * n * sizeof(DataTypeCompute);
int num_records_bias = m * sizeof(DataTypeOut);

DataTypeCompute sum[VW] = {0};
constexpr size_t sumLength = max((size_t)1, VW - 1);
DataTypeCompute sum[sumLength] = {0};
if(idx + (VW - 1) < m)
{
for(int i = 0; i < n; i += MT1)
Expand Down Expand Up @@ -102,9 +108,10 @@ __device__ inline void
{
for(int i = 0; i < n; i += MT1)
{
int currRow = row + i;
int rowStride = currRow * strideJ + voffset;
DataTypeCompute tmp[VW - 1];
int currRow = row + i;
int rowStride = currRow * strideJ + voffset;
constexpr size_t tmpLength = max((size_t)1, VW - 1);
DataTypeCompute tmp[tmpLength];
static_for<0, VW - 1>()([&](int vw) {
buffer_load<DataTypeCompute, sizeof(DataTypeCompute)>(
tmp[vw],
Expand Down