-
Notifications
You must be signed in to change notification settings - Fork 14
Add execution mode option to PyHDK python tests #518
Conversation
Is Also, can we choose a device via |
Yep. The data manager could reset the cache when it's destroyed, but that would create a cycle dependency with executor now. Flushing the cache on executor destruction also doesn't seem right. I think the right thing to do is get rid of the device pointer in the compilation context. There's a couple questions for such a change though that I'll need to address (for example: if we only use the device id to route execution what happens if the new executor has less devices available).
We could, but why would you? I think in the end we will have a default setting that allows any possible offloading scheme. If there's any problem with a particular query (i.e. the cost model is very wrong on the device preference), you can force it to run with a specific setting. We also do have the |
You can do it by adding a new GpuCodeCache interface that Executor would implement and then clear the executor's cache through this interface to avoid the cycle dep. We've used a similar trick with Executor before.
I don't feel the testing is more simple if I have to add an additional arg to each test function, each |
It's not "each test function", only those that need the option. It is also not a global testing option. It may seem so now because we currently allow CPU fallbacks. Simplicity should come with explicitness. I'd like to forbid fallbacks in tests later on so that we are sure a query runs on the device we asked for. Some of those we will want to fall back. Having a global setting seems inconvenient for that. I agree that it would be nice to type less. I initially added the There're a couple of more-or-less straightforward ways to set the device type once of course. Is it worth it though? |
181d417
to
5c8be86
Compare
The PR introduces a
--device
option to pytests to allow for switching between execution modes. The default behavior remains unchanged.It also provides a quick simple fix (by disabling L0 compilation context caching with
enable-gpu-code-compilation-cache=false
) to the following problem:When HDK components are handled manually and the data manager is reinitialized the compilation cache may outlive the GPU manager (since its lifetime is bound to the data manager's lifetime). The compilation context would then try to access an invalid instance
L0Device
with a valid device handle (the driver returns the same handle on consequent calls).