[NFC] Use std::vector to store large size array. (#2060)

windows default stack size is 1M, BUFFER_SIZE is 2 * 1024 * 1024, use
array with BUFFER_SIZE elemets on stack can exceed available stack size
limits.
This commit is contained in:
Haonan Yang
2024-08-29 20:45:40 +08:00
committed by GitHub
parent c0db608eac
commit a7162188d6
3 changed files with 3 additions and 3 deletions

View File

@@ -139,7 +139,7 @@ int TestFunc_Float_Float_Float_Float(const Func *f, MTdata d, bool relaxedMode)
float maxErrorVal3 = 0.0f;
uint64_t step = getTestStep(sizeof(float), BUFFER_SIZE);
cl_uchar overflow[BUFFER_SIZE / sizeof(float)];
std::vector<cl_uchar> overflow(BUFFER_SIZE / sizeof(float));
float float_ulps;
if (gIsEmbedded)

View File

@@ -79,7 +79,7 @@ int TestFunc_Half_Half_Half_Half(const Func *f, MTdata d, bool relaxedMode)
constexpr size_t bufferElements = BUFFER_SIZE / sizeof(cl_half);
cl_uchar overflow[bufferElements];
std::vector<cl_uchar> overflow(bufferElements);
float half_ulps = f->half_ulps;
int skipNanInf = (0 == strcmp("fma", f->nameInCode));

View File

@@ -51,7 +51,7 @@ int TestFunc_Float2_Float(const Func *f, MTdata d, bool relaxedMode)
float maxErrorVal1 = 0.0f;
uint64_t step = getTestStep(sizeof(float), BUFFER_SIZE);
int scale = (int)((1ULL << 32) / (16 * BUFFER_SIZE / sizeof(float)) + 1);
cl_uchar overflow[BUFFER_SIZE / sizeof(float)];
std::vector<cl_uchar> overflow(BUFFER_SIZE / sizeof(float));
int isFract = 0 == strcmp("fract", f->nameInCode);
int skipNanInf = isFract && !gInfNanSupport;