Good day!
Encountered this bug when i was testing ROCm OpenCL implementation with Radeon RX 7900 XTX GPU (24 gb)
The l_capacity test in test_progvar.cpp attempts to create a program with a global array of size max_size that is equal to CL_DEVICE_MAX_GLOBAL_VARIABLE_SIZE.
err = clGetDeviceInfo(device, CL_DEVICE_MAX_GLOBAL_VARIABLE_SIZE,
sizeof(*max_size_ret), max_size_ret, &return_size);
err |= l_capacity(device, context, queue, max_size);
"uchar var[%zu];"
On devices with very large video memory (e.g., 24GB GPUs), this value can exceed 17 GB.
CL_DEVICE_MAX_GLOBAL_VARIABLE_SIZE = 18239350368 bytes (17394.40 MB, 16.99 GB)
When the OpenCL compiler tries to compile a kernel containing: "uchar var[18239350368];" it fails with CL_OUT_OF_HOST_MEMORY during "clCreateKernel" because the compiler cannot handle such a large static array declaration, even though the device theoretically supports it.
$ /usr/bin/test_conformance/basic/test_basic progvar_prog_scope_misc
progvar_prog_scope_misc...
l_capacity...ERROR: Unable to create kernel! (CL_OUT_OF_HOST_MEMORY from kernelHelpers.cpp:995)
ERROR: Failed to create program for capacity test! (CL_OUT_OF_HOST_MEMORY from test_progvar.cpp:1618)
When i tried to limit the max_size to 1gb, test passed correctly.
const size_t max_reasonable_size = 1024 * 1024 * 1024;
if (max_size > max_reasonable_size) {
log_info("max_size (%zu bytes) is too large, running the l_capacity test with the reasonable max_size",max_size);
err |= l_capacity(device, context, queue, max_reasonable_size);
} else {
err |= l_capacity(device, context, queue, max_size);
}
Good day!
Encountered this bug when i was testing ROCm OpenCL implementation with Radeon RX 7900 XTX GPU (24 gb)
The l_capacity test in test_progvar.cpp attempts to create a program with a global array of size max_size that is equal to CL_DEVICE_MAX_GLOBAL_VARIABLE_SIZE.
On devices with very large video memory (e.g., 24GB GPUs), this value can exceed 17 GB.
CL_DEVICE_MAX_GLOBAL_VARIABLE_SIZE = 18239350368 bytes (17394.40 MB, 16.99 GB)When the OpenCL compiler tries to compile a kernel containing: "uchar var[18239350368];" it fails with
CL_OUT_OF_HOST_MEMORYduring "clCreateKernel" because the compiler cannot handle such a large static array declaration, even though the device theoretically supports it.When i tried to limit the max_size to 1gb, test passed correctly.