-
Notifications
You must be signed in to change notification settings - Fork 769
[SYCL] Fixed bug regarding device caching #2566
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SYCL] Fixed bug regarding device caching #2566
Conversation
Created a new function, getOrCreateDevice, so that cached devices could be shared across both piDevicesGet and piextDeviceCreateWithNativeHandle. This new function will check/fill and return cached devices.
Created a new function, populateDeviceCacheIfNeeded, so that cached devices could be shared across both piDevicesGet and piextDeviceCreateWithNativeHandle. This new function will check/fill and return cached devices. Renamed getOrCreatePlatforms to getPlatformCache, and refactored the function so that it limits level zero driver calls and removes redundant code.
Mentioning @gmlueck for comments/code-review. |
I think it would also be good to add errors checks to the calls to |
Currently, error checking is already occurring through the plugin::call interface. PI function calls (in this case 'piextDeviceCreateWithNativeHandle()' and 'piextPlatformCreateWithNativeHandle()') are passed into plugin::call as an argument and invoked from here. The result of the PI call is recorded and is passed into a function called checkPiResult() which will throw an exception if the result is not a PI_SUCCESS. |
Created a new function, populateDeviceCacheIfNeeded, so that cached devices could be shared across both piDevicesGet and piextDeviceCreateWithNativeHandle. This new function will check/fill and return cached devices. Renamed getOrCreatePlatforms to getPlatformCache, and refactored the function so that it limits level zero driver calls and removes redundant code. Also, added an E2E test for these changes.
Created a new function, populateDeviceCacheIfNeeded, so that cached devices could be shared across both piDevicesGet and piextDeviceCreateWithNativeHandle. This new function will check/fill and return cached devices. Renamed getOrCreatePlatforms to getPlatformCache, and refactored the function so that it limits level zero driver calls and removes redundant code. Called getOrMakePlatformImpl() from make_platform() so that the PlatformImpl cache is accessible to platforms that are created using a native handle. Called getOrMakeDeviceImpl() from make_device() so that the DeviceImpl cache is accessible to devices that are created using a native handle. Also, added an E2E test for these changes.
Made make_platform() and make_device() friends of the platform and device class, respectively.
@smaslov-intel @romanovvlad Do you have any comments on these changes? |
Added check for Level Zero Drivers/Devices to cache_test.cpp Removed line changes from platform and device constructors.
Removed direct reference to level_zero namespace from generic SYCL headers (device and platform headers).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok with me.
Created a new function, populateDeviceCacheIfNeeded, so that cached devices could be shared across both piDevicesGet and piextDeviceCreateWithNativeHandle. This new function will check/fill and return cached devices. Removed the function getOrCreatePlatforms. Refactored PiPlatformsGet to limit the number Level Zero driver calls. Called PiPlatformsGet from piextPlatformCreateWithNativeHandle so that the latter has access to the platform cache maintained in the former. Called getOrMakePlatformImpl from make_platform so that the PlatformImpl cache is accessible to platforms that are created using a native handle. Called getOrMakeDeviceImpl from make_device so that the DeviceImpl cache is accessible to devices that are created using a native handle. Also, added an E2E test for these changes.
Removed unnecessary lambda function from PiPlatformsGet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Fixed typo in comments. Co-authored-by: smaslov-intel <48694368+smaslov-intel@users.noreply.github.com>
ShadowMemory should increment/decrement device handle
ShadowMemory should increment/decrement device handle
Created a new function, populateDeviceCacheIfNeeded, so that cached devices could be
shared across both piDevicesGet and piextDeviceCreateWithNativeHandle. This
new function will check/fill and return cached devices.
Renamed getOrCreatePlatforms to getPlatformCache, and refactored the function so
that it limits level zero driver calls and removes redundant code.
Called getOrMakePlatformImpl() from make_platform() so that the PlatformImpl
cache is accessible to platforms that are created using a native handle.
Called getOrMakeDeviceImpl() from make_device() so that the DeviceImpl cache is
accessible to devices that are created using a native handle.
Also, added an E2E test for these changes.