@@ -1524,9 +1524,7 @@ ur_result_t urMemImageCreate(
1524
1524
// own the image.
1525
1525
// TODO: Implement explicit copying for acessing the image from other devices
1526
1526
// in the context.
1527
- ur_device_handle_t Device = Context->SingleRootDevice
1528
- ? Context->SingleRootDevice
1529
- : Context->Devices [0 ];
1527
+ ur_device_handle_t Device = Context->Devices [0 ];
1530
1528
ze_image_handle_t ZeImage;
1531
1529
ZE2UR_CALL (zeImageCreate,
1532
1530
(Context->ZeContext , Device->ZeDevice , &ZeImageDesc, &ZeImage));
@@ -2073,58 +2071,22 @@ ur_result_t _ur_buffer::getZeHandle(char *&ZeHandle, access_mode_t AccessMode,
2073
2071
LastDeviceWithValidAllocation = Device;
2074
2072
return UR_RESULT_SUCCESS;
2075
2073
}
2076
- // Reads user setting on how to deal with buffers in contexts where
2077
- // all devices have the same root-device. Returns "true" if the
2078
- // preference is to have allocate on each [sub-]device and migrate
2079
- // normally (copy) to other sub-devices as needed. Returns "false"
2080
- // if the preference is to have single root-device allocations
2081
- // serve the needs of all [sub-]devices, meaning potentially more
2082
- // cross-tile traffic.
2083
- //
2084
- static const bool SingleRootDeviceBufferMigration = [] {
2085
- const char *UrRet =
2086
- std::getenv (" UR_L0_SINGLE_ROOT_DEVICE_BUFFER_MIGRATION" );
2087
- const char *PiRet =
2088
- std::getenv (" SYCL_PI_LEVEL_ZERO_SINGLE_ROOT_DEVICE_BUFFER_MIGRATION" );
2089
- const char *EnvStr = UrRet ? UrRet : (PiRet ? PiRet : nullptr );
2090
- if (EnvStr)
2091
- return (std::stoi (EnvStr) != 0 );
2092
- // The default is to migrate normally, which may not always be the
2093
- // best option (depends on buffer access patterns), but is an
2094
- // overall win on the set of the available benchmarks.
2095
- return true ;
2096
- }();
2097
2074
2098
2075
// Peform actual device allocation as needed.
2099
2076
if (!Allocation.ZeHandle ) {
2100
- if (!SingleRootDeviceBufferMigration && UrContext->SingleRootDevice &&
2101
- UrContext->SingleRootDevice != Device) {
2102
- // If all devices in the context are sub-devices of the same device
2103
- // then we reuse root-device allocation by all sub-devices in the
2104
- // context.
2105
- // TODO: we can probably generalize this and share root-device
2106
- // allocations by its own sub-devices even if not all other
2107
- // devices in the context have the same root.
2108
- UR_CALL (getZeHandle (ZeHandle, AccessMode, UrContext->SingleRootDevice ,
2109
- phWaitEvents, numWaitEvents));
2110
- Allocation.ReleaseAction = allocation_t ::keep;
2111
- Allocation.ZeHandle = ZeHandle;
2112
- Allocation.Valid = true ;
2113
- return UR_RESULT_SUCCESS;
2114
- } else { // Create device allocation
2115
- if (DisjointPoolConfigInstance.EnableBuffers ) {
2116
- Allocation.ReleaseAction = allocation_t ::free;
2117
- ur_usm_desc_t USMDesc{};
2118
- USMDesc.align = getAlignment ();
2119
- ur_usm_pool_handle_t Pool{};
2120
- UR_CALL (ur::level_zero::urUSMDeviceAlloc (
2121
- UrContext, Device, &USMDesc, Pool, Size ,
2122
- reinterpret_cast <void **>(&ZeHandle)));
2123
- } else {
2124
- Allocation.ReleaseAction = allocation_t ::free_native;
2125
- UR_CALL (ZeDeviceMemAllocHelper (reinterpret_cast <void **>(&ZeHandle),
2126
- UrContext, Device, Size ));
2127
- }
2077
+ // Create device allocation
2078
+ if (DisjointPoolConfigInstance.EnableBuffers ) {
2079
+ Allocation.ReleaseAction = allocation_t ::free;
2080
+ ur_usm_desc_t USMDesc{};
2081
+ USMDesc.align = getAlignment ();
2082
+ ur_usm_pool_handle_t Pool{};
2083
+ UR_CALL (ur::level_zero::urUSMDeviceAlloc (
2084
+ UrContext, Device, &USMDesc, Pool, Size ,
2085
+ reinterpret_cast <void **>(&ZeHandle)));
2086
+ } else {
2087
+ Allocation.ReleaseAction = allocation_t ::free_native;
2088
+ UR_CALL (ZeDeviceMemAllocHelper (reinterpret_cast <void **>(&ZeHandle),
2089
+ UrContext, Device, Size ));
2128
2090
}
2129
2091
Allocation.ZeHandle = ZeHandle;
2130
2092
} else {
0 commit comments