Fix FEAT-39125
Add EMU_ENV option. If it is ON, the building is for
emulation environment, thus some logics can be adjusted
to match emulation environment. If it is OFF, the
building is for regular environment.
Currently only ocltst will use the option. But it can
be used for other modules.

Change-Id: I54e1bc1309e82794b41fca2ae1f01f004138dced


[ROCm/clr commit: 76c6dcd558]
Этот коммит содержится в:
taosang2
2021-11-24 21:55:27 -05:00
коммит произвёл Tao Sang
родитель 8c921fc3cc
Коммит 6b3e3bf6c6
15 изменённых файлов: 153 добавлений и 12 удалений
+12 -2
Просмотреть файл
@@ -83,8 +83,11 @@ void OCLMemoryInfo::run(void) {
if (failed_) {
return;
}
#if EMU_ENV
size_t BufSize = 0x10000;
#else
size_t BufSize = 0x1000000;
#endif // EMU_ENV
bool succeed = false;
bool done = false;
if (test_ == 0) {
@@ -166,12 +169,19 @@ void OCLMemoryInfo::run(void) {
_wrapper->clGetDeviceInfo(devices_[_deviceId],
CL_DEVICE_GLOBAL_FREE_MEMORY_AMD,
2 * sizeof(size_t), memoryInfo2, NULL);
#if EMU_ENV
// For testing on emulator with 2G RAM and buffer size of x10000
if (memoryInfo2[0] < (0x3e000 + (BufSize * sizeof(cl_int4) / 1024))) {
#else
if (memoryInfo2[0] < (0x50000 + (BufSize * sizeof(cl_int4) / 1024))) {
#endif // EMU_ENV
break;
}
size_t dif = memoryInfo[0] - memoryInfo2[0];
// extra memory could be allocated/destroyed in the driver
if ((dif / sizeAll) == 1 || (sizeAll / dif) == 1) {
if (dif == 0) {
// the buffer memory may come from the cached memory pool
} else if ((dif / sizeAll) == 1 || (sizeAll / dif) == 1) {
succeed = true;
} else {
succeed = false;