From 888dd956ee38cd78aaab93f86e74c65fb6777924 Mon Sep 17 00:00:00 2001 From: Lisa Liu Date: Wed, 8 Jan 2020 07:12:53 -0800 Subject: [PATCH] format files --- L1/include/hw/xf_blas/helpers/utils/types.hpp | 38 ++++++++----------- L3/benchmarks/gemm/gemm_bench.cpp | 6 +-- .../gemm/gemm_mkl/gemm_mkl_helper.hpp | 7 ++-- .../sw/xf_blas/helpers/funcs/fcn_host.hpp | 3 +- 4 files changed, 20 insertions(+), 34 deletions(-) diff --git a/L1/include/hw/xf_blas/helpers/utils/types.hpp b/L1/include/hw/xf_blas/helpers/utils/types.hpp index 71c637ca42..4a5d0da94a 100644 --- a/L1/include/hw/xf_blas/helpers/utils/types.hpp +++ b/L1/include/hw/xf_blas/helpers/utils/types.hpp @@ -382,46 +382,38 @@ inline double BitConv::toType(BitConv::BitsType p_Val) { return (u.f); } -template < - unsigned int t_Bits, - unsigned int t_Width, - typename t_DataType> -ap_uint convWideVal2Bits ( - WideType p_val){ +template +ap_uint convWideVal2Bits(WideType p_val) { #pragma HLS inline - #ifndef __SYNTHESIS__ - assert ((t_Bits>t_Width) && (t_Bits%t_Width == 0)); - #endif - const unsigned int t_DataBits = sizeof(t_DataType)*8; +#ifndef __SYNTHESIS__ + assert((t_Bits > t_Width) && (t_Bits % t_Width == 0)); +#endif + const unsigned int t_DataBits = sizeof(t_DataType) * 8; const unsigned int t_ResEntryBits = t_Bits / t_Width; ap_uint l_res; - for (unsigned int i=0; i l_bitConv; ap_uint l_datBits = l_bitConv.toBits(p_val[i]); ap_uint l_resEntry = l_datBits; - l_res.range((i+1)*t_ResEntryBits-1, i*t_ResEntryBits) = l_resEntry; + l_res.range((i + 1) * t_ResEntryBits - 1, i * t_ResEntryBits) = l_resEntry; } return l_res; } -template < - unsigned int t_Bits, - unsigned int t_Width, - typename t_DataType> -WideType convBits2WideType ( - ap_uint p_bits){ +template +WideType convBits2WideType(ap_uint p_bits) { #pragma HLS inline - #ifndef __SYNTHESIS__ - assert ((t_Bits>t_Width) && (t_Bits%t_Width == 0)); - #endif +#ifndef __SYNTHESIS__ + assert((t_Bits > t_Width) && (t_Bits % t_Width == 0)); +#endif const unsigned int t_DataBits = sizeof(t_DataType) * 8; const unsigned int t_InEntryBits = t_Bits / t_Width; WideType l_res; - for (unsigned int i=0; i l_bitConv; - ap_uint l_inDatBits = p_bits.range((i+1)*t_InEntryBits-1, i*t_InEntryBits); + ap_uint l_inDatBits = p_bits.range((i + 1) * t_InEntryBits - 1, i * t_InEntryBits); ap_uint l_datBits = l_inDatBits; t_DataType l_val = l_bitConv.toType(l_datBits); l_res[i] = l_val; diff --git a/L3/benchmarks/gemm/gemm_bench.cpp b/L3/benchmarks/gemm/gemm_bench.cpp index c3a69b78bd..0df5f02517 100644 --- a/L3/benchmarks/gemm/gemm_bench.cpp +++ b/L3/benchmarks/gemm/gemm_bench.cpp @@ -85,7 +85,6 @@ int main(int argc, char** argv) { #endif } - int i, j; // i-row l_numKernel -1 ,j- column l_numKernel -1 vector goldenC; @@ -147,7 +146,6 @@ int main(int argc, char** argv) { c[kernelIndex], n, kernelIndex); } - #ifdef XFBLAS_LAUNCH_ASYNC for (int kernelIndex = 0; kernelIndex < l_numKernel; kernelIndex++) { xfblasGetMatrixRestrictedAsync(c[kernelIndex], kernelIndex); @@ -159,7 +157,6 @@ int main(int argc, char** argv) { status = xfblasGetMatrixRestricted(c[kernelIndex], kernelIndex); } #endif - showTimeData("copyFromFpga", l_tp_loop[l_tpIdx], l_tp_loop[l_tpIdx + 1]); l_tpIdx++; @@ -170,7 +167,6 @@ int main(int argc, char** argv) { memcpy(tmp_c, c[kernelIndex], m * n * sizeof(XFBLAS_dataType)); resultC.push_back(tmp_c); } - for (int kernelIndex = 0; kernelIndex < l_numKernel; kernelIndex++) { xfblasFree(a[kernelIndex], kernelIndex); @@ -188,7 +184,7 @@ int main(int argc, char** argv) { a.clear(); b.clear(); c.clear(); - + chrono::duration l_timeApi = l_timeApiSum; double l_timeMs = l_timeApi.count() * 1e3; diff --git a/L3/benchmarks/gemm/gemm_mkl/gemm_mkl_helper.hpp b/L3/benchmarks/gemm/gemm_mkl/gemm_mkl_helper.hpp index 391fc12719..a1fc297692 100644 --- a/L3/benchmarks/gemm/gemm_mkl/gemm_mkl_helper.hpp +++ b/L3/benchmarks/gemm/gemm_mkl/gemm_mkl_helper.hpp @@ -67,10 +67,9 @@ XFBLAS_dataType* createMat(int p_rows, int p_cols, bool is_zero = false) { void initMat(XFBLAS_dataType* mat, int p_rows, int p_cols, bool is_zero) { srand(time(NULL)); - for (int j = 0; j < p_rows; j++){ - for (int i = 0; i < p_cols; i++){ - mat[IDX2R(j, i, p_cols)] = 1; - + for (int j = 0; j < p_rows; j++) { + for (int i = 0; i < p_cols; i++) { + mat[IDX2R(j, i, p_cols)] = 1; } } } diff --git a/L3/include/sw/xf_blas/helpers/funcs/fcn_host.hpp b/L3/include/sw/xf_blas/helpers/funcs/fcn_host.hpp index 7980703cf9..280f31410a 100644 --- a/L3/include/sw/xf_blas/helpers/funcs/fcn_host.hpp +++ b/L3/include/sw/xf_blas/helpers/funcs/fcn_host.hpp @@ -129,7 +129,7 @@ class FCNHost : public BLASHost { return XFBLAS_STATUS_SUCCESS; } - + virtual xfblasStatus_t addFCNOpByAddress(unsigned int l_aOff, unsigned int l_bOff, unsigned int l_cOff, @@ -145,7 +145,6 @@ class FCNHost : public BLASHost { int p_postShift, short p_preluScale, short p_preluAlpha) { - FcnArgs args(l_aOff, l_bOff, l_cOff, l_xOff, p_m, p_k, p_n, p_lda, p_ldb, p_ldc, p_ldx, p_postScale, p_postShift, p_preluScale, p_preluAlpha); this->addInstr(&args);