@@ -1592,9 +1592,7 @@ ur_result_t urMemImageCreate(
1592
1592
// own the image.
1593
1593
// TODO: Implement explicit copying for acessing the image from other devices
1594
1594
// in the context.
1595
- ur_device_handle_t Device = Context->SingleRootDevice
1596
- ? Context->SingleRootDevice
1597
- : Context->Devices [0 ];
1595
+ ur_device_handle_t Device = Context->Devices [0 ];
1598
1596
ze_image_handle_t ZeImage;
1599
1597
ZE2UR_CALL (zeImageCreate,
1600
1598
(Context->ZeContext , Device->ZeDevice , &ZeImageDesc, &ZeImage));
@@ -2154,58 +2152,22 @@ ur_result_t _ur_buffer::getZeHandle(char *&ZeHandle, access_mode_t AccessMode,
2154
2152
LastDeviceWithValidAllocation = Device;
2155
2153
return UR_RESULT_SUCCESS;
2156
2154
}
2157
- // Reads user setting on how to deal with buffers in contexts where
2158
- // all devices have the same root-device. Returns "true" if the
2159
- // preference is to have allocate on each [sub-]device and migrate
2160
- // normally (copy) to other sub-devices as needed. Returns "false"
2161
- // if the preference is to have single root-device allocations
2162
- // serve the needs of all [sub-]devices, meaning potentially more
2163
- // cross-tile traffic.
2164
- //
2165
- static const bool SingleRootDeviceBufferMigration = [] {
2166
- const char *UrRet =
2167
- std::getenv (" UR_L0_SINGLE_ROOT_DEVICE_BUFFER_MIGRATION" );
2168
- const char *PiRet =
2169
- std::getenv (" SYCL_PI_LEVEL_ZERO_SINGLE_ROOT_DEVICE_BUFFER_MIGRATION" );
2170
- const char *EnvStr = UrRet ? UrRet : (PiRet ? PiRet : nullptr );
2171
- if (EnvStr)
2172
- return (std::stoi (EnvStr) != 0 );
2173
- // The default is to migrate normally, which may not always be the
2174
- // best option (depends on buffer access patterns), but is an
2175
- // overall win on the set of the available benchmarks.
2176
- return true ;
2177
- }();
2178
2155
2179
2156
// Peform actual device allocation as needed.
2180
2157
if (!Allocation.ZeHandle ) {
2181
- if (!SingleRootDeviceBufferMigration && UrContext->SingleRootDevice &&
2182
- UrContext->SingleRootDevice != Device) {
2183
- // If all devices in the context are sub-devices of the same device
2184
- // then we reuse root-device allocation by all sub-devices in the
2185
- // context.
2186
- // TODO: we can probably generalize this and share root-device
2187
- // allocations by its own sub-devices even if not all other
2188
- // devices in the context have the same root.
2189
- UR_CALL (getZeHandle (ZeHandle, AccessMode, UrContext->SingleRootDevice ,
2190
- phWaitEvents, numWaitEvents));
2191
- Allocation.ReleaseAction = allocation_t ::keep;
2192
- Allocation.ZeHandle = ZeHandle;
2193
- Allocation.Valid = true ;
2194
- return UR_RESULT_SUCCESS;
2195
- } else { // Create device allocation
2196
- if (DisjointPoolConfigInstance.EnableBuffers ) {
2197
- Allocation.ReleaseAction = allocation_t ::free;
2198
- ur_usm_desc_t USMDesc{};
2199
- USMDesc.align = getAlignment ();
2200
- ur_usm_pool_handle_t Pool{};
2201
- UR_CALL (ur::level_zero::urUSMDeviceAlloc (
2202
- UrContext, Device, &USMDesc, Pool, Size,
2203
- reinterpret_cast <void **>(&ZeHandle)));
2204
- } else {
2205
- Allocation.ReleaseAction = allocation_t ::free_native;
2206
- UR_CALL (ZeDeviceMemAllocHelper (reinterpret_cast <void **>(&ZeHandle),
2207
- UrContext, Device, Size));
2208
- }
2158
+ // Create device allocation
2159
+ if (DisjointPoolConfigInstance.EnableBuffers ) {
2160
+ Allocation.ReleaseAction = allocation_t ::free;
2161
+ ur_usm_desc_t USMDesc{};
2162
+ USMDesc.align = getAlignment ();
2163
+ ur_usm_pool_handle_t Pool{};
2164
+ UR_CALL (ur::level_zero::urUSMDeviceAlloc (
2165
+ UrContext, Device, &USMDesc, Pool, Size,
2166
+ reinterpret_cast <void **>(&ZeHandle)));
2167
+ } else {
2168
+ Allocation.ReleaseAction = allocation_t ::free_native;
2169
+ UR_CALL (ZeDeviceMemAllocHelper (reinterpret_cast <void **>(&ZeHandle),
2170
+ UrContext, Device, Size));
2209
2171
}
2210
2172
Allocation.ZeHandle = ZeHandle;
2211
2173
} else {
0 commit comments