From f3536361367499c7222f13b278904d8d9c74a2bd Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Wed, 19 Jun 2024 15:08:25 +0800 Subject: [PATCH] refactor: do some internal refactor. --- include/os/osEnv.h | 4 ++-- source/common/src/tglobal.c | 4 ++-- source/libs/function/src/detail/tavgfunction.c | 2 +- source/libs/function/src/detail/tminmax.c | 4 ++-- source/os/src/osEnv.c | 4 ++-- source/os/src/osSysinfo.c | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/include/os/osEnv.h b/include/os/osEnv.h index e3e5da59f5..4f4a58d4e8 100644 --- a/include/os/osEnv.h +++ b/include/os/osEnv.h @@ -37,8 +37,8 @@ extern float tsNumOfCores; extern int64_t tsTotalMemoryKB; extern char *tsProcPath; extern char tsSIMDEnable; -extern char tsSSE42Enable; -extern char tsAVXEnable; +extern char tsSSE42Supported; +extern char tsAVXSupported; extern char tsAVX2Supported; extern char tsFMASupported; extern char tsAVX512Supported; diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 5b0361f8ca..97cb4b4e1d 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -594,8 +594,8 @@ static int32_t taosAddSystemCfg(SConfig *pCfg) { if (cfgAddBool(pCfg, "enableCoreFile", 1, CFG_SCOPE_BOTH, CFG_DYN_CLIENT) != 0) return -1; if (cfgAddFloat(pCfg, "numOfCores", tsNumOfCores, 1, 100000, CFG_SCOPE_BOTH, CFG_DYN_NONE) != 0) return -1; - if (cfgAddBool(pCfg, "ssd42", tsSSE42Enable, CFG_SCOPE_BOTH, CFG_DYN_NONE) != 0) return -1; - if (cfgAddBool(pCfg, "avx", tsAVXEnable, CFG_SCOPE_BOTH, CFG_DYN_NONE) != 0) return -1; + if (cfgAddBool(pCfg, "ssd42", tsSSE42Supported, CFG_SCOPE_BOTH, CFG_DYN_NONE) != 0) return -1; + if (cfgAddBool(pCfg, "avx", tsAVXSupported, CFG_SCOPE_BOTH, CFG_DYN_NONE) != 0) return -1; if (cfgAddBool(pCfg, "avx2", tsAVX2Supported, CFG_SCOPE_BOTH, CFG_DYN_NONE) != 0) return -1; if (cfgAddBool(pCfg, "fma", tsFMASupported, CFG_SCOPE_BOTH, CFG_DYN_NONE) != 0) return -1; if (cfgAddBool(pCfg, "avx512", tsAVX512Supported, CFG_SCOPE_BOTH, CFG_DYN_NONE) != 0) return -1; diff --git a/source/libs/function/src/detail/tavgfunction.c b/source/libs/function/src/detail/tavgfunction.c index 66ed092f76..3d51f0cd16 100644 --- a/source/libs/function/src/detail/tavgfunction.c +++ b/source/libs/function/src/detail/tavgfunction.c @@ -565,7 +565,7 @@ int32_t avgFunction(SqlFunctionCtx* pCtx) { numOfElem = pInput->numOfRows; pAvgRes->count += pInput->numOfRows; - bool simdAvailable = tsAVXEnable && tsSIMDEnable && (numOfRows > THRESHOLD_SIZE); + bool simdAvailable = tsAVXSupported && tsSIMDEnable && (numOfRows > THRESHOLD_SIZE); switch(type) { case TSDB_DATA_TYPE_UTINYINT: diff --git a/source/libs/function/src/detail/tminmax.c b/source/libs/function/src/detail/tminmax.c index e36157b565..331f222a71 100644 --- a/source/libs/function/src/detail/tminmax.c +++ b/source/libs/function/src/detail/tminmax.c @@ -502,7 +502,7 @@ static void handleFloatCol(SColumnInfoData* pCol, int32_t start, int32_t numOfRo float* val = (float*)&pBuf->v; // AVX version to speedup the loop - if (tsAVXEnable && tsSIMDEnable) { + if (tsAVXSupported && tsSIMDEnable) { *val = floatVectorCmpAVX(pData, numOfRows, isMinFunc); } else { if (!pBuf->assign) { @@ -533,7 +533,7 @@ static void handleDoubleCol(SColumnInfoData* pCol, int32_t start, int32_t numOfR double* val = (double*)&pBuf->v; // AVX version to speedup the loop - if (tsAVXEnable && tsSIMDEnable) { + if (tsAVXSupported && tsSIMDEnable) { *val = (double)doubleVectorCmpAVX(pData, numOfRows, isMinFunc); } else { if (!pBuf->assign) { diff --git a/source/os/src/osEnv.c b/source/os/src/osEnv.c index ea88d5307b..28f4178790 100644 --- a/source/os/src/osEnv.c +++ b/source/os/src/osEnv.c @@ -39,8 +39,8 @@ char *tsProcPath = NULL; char tsSIMDEnable = 0; char tsAVX512Enable = 0; -char tsSSE42Enable = 0; -char tsAVXEnable = 0; +char tsSSE42Supported = 0; +char tsAVXSupported = 0; char tsAVX2Supported = 0; char tsFMASupported = 0; char tsAVX512Supported = 0; diff --git a/source/os/src/osSysinfo.c b/source/os/src/osSysinfo.c index 71cbf5541f..50eb8413c0 100644 --- a/source/os/src/osSysinfo.c +++ b/source/os/src/osSysinfo.c @@ -250,7 +250,7 @@ void taosGetSystemInfo() { taosGetCpuCores(&tsNumOfCores, false); taosGetTotalMemory(&tsTotalMemoryKB); taosGetCpuUsage(NULL, NULL); - taosGetCpuInstructions(&tsSSE42Enable, &tsAVXEnable, &tsAVX2Supported, &tsFMASupported, &tsAVX512Supported); + taosGetCpuInstructions(&tsSSE42Supported, &tsAVXSupported, &tsAVX2Supported, &tsFMASupported, &tsAVX512Supported); #endif }