|
10 | 10 |
|
11 | 11 | #include "device.hpp"
|
12 | 12 | #include "ur_level_zero.hpp"
|
| 13 | +#include "ur_util.hpp" |
13 | 14 | #include <algorithm>
|
14 | 15 | #include <climits>
|
15 | 16 | #include <optional>
|
@@ -268,9 +269,10 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(
|
268 | 269 | return ReturnValue(uint32_t{64});
|
269 | 270 | }
|
270 | 271 | case UR_DEVICE_INFO_MAX_MEM_ALLOC_SIZE:
|
271 |
| - // if not optimized for 32-bit access, return total memory size. |
272 |
| - // otherwise, return only maximum allocatable size. |
273 |
| - if (Device->useOptimized32bitAccess() == 0) { |
| 272 | + // if the user wishes to allocate large allocations on a system that usually |
| 273 | + // does not allow that allocation size, then we return the max global mem |
| 274 | + // size as the limit. |
| 275 | + if (Device->useRelaxedAllocationLimits()) { |
274 | 276 | return ReturnValue(uint64_t{calculateGlobalMemSize(Device)});
|
275 | 277 | } else {
|
276 | 278 | return ReturnValue(uint64_t{Device->ZeDeviceProperties->maxMemAllocSize});
|
@@ -923,20 +925,14 @@ ur_device_handle_t_::useImmediateCommandLists() {
|
923 | 925 | }
|
924 | 926 | }
|
925 | 927 |
|
926 |
| -int32_t ur_device_handle_t_::useOptimized32bitAccess() { |
927 |
| - static const int32_t Optimize32bitAccessMode = [this] { |
928 |
| - // If device is Intel(R) Data Center GPU Max, |
929 |
| - // use default provided by L0 driver. |
930 |
| - // TODO: Use IP versioning to select based on range of devices |
931 |
| - if (this->isPVC()) |
932 |
| - return -1; |
933 |
| - const char *UrRet = std::getenv("UR_L0_USE_OPTIMIZED_32BIT_ACCESS"); |
934 |
| - if (!UrRet) |
935 |
| - return 0; |
936 |
| - return std::atoi(UrRet); |
| 928 | +bool ur_device_handle_t_::useRelaxedAllocationLimits() { |
| 929 | + static const bool EnableRelaxedAllocationLimits = [] { |
| 930 | + auto UrRet = ur_getenv("UR_L0_ENABLE_RELAXED_ALLOCATION_LIMITS"); |
| 931 | + const bool RetVal = UrRet ? std::stoi(*UrRet) : 0; |
| 932 | + return RetVal; |
937 | 933 | }();
|
938 | 934 |
|
939 |
| - return Optimize32bitAccessMode; |
| 935 | + return EnableRelaxedAllocationLimits; |
940 | 936 | }
|
941 | 937 |
|
942 | 938 | ur_result_t ur_device_handle_t_::initialize(int SubSubDeviceOrdinal,
|
|
0 commit comments