You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
dpctl.SyclDevice() and *.filter_string are slow #1098
Since filter string is part of type signature in numba-dpex it is calling SyclDevice and *.filter_string at least once per usm/dpnp array parameter on each function call. This generates significant performance overhead.
I doubt this overhead comes from Python. My gut feeling tells it comes from a driver side. Isn't it?
99% sure.
But filter_string could be cached. And device too. We must have device information to do compute follows data in numba. So either we are caching device/filter string on numba side or dpctl do it on it's side
@AlexanderKalistratovfilter_string has a nice UX and visual aspect, but compute follows data has to be based on SyclQueue. The current filter string based compute follows data implementation in numba-dpex is a temporary workaround till numba_dpex/#930 gets resolved.
There are several issues with basing compute follows data on filter string:
Filter string computation is slow because it has an inherent ranking of devices.
The same device can have different types of queues(in order or out-order, with or without profiling)
filter string does not work for sub-devices
Lastly, ranking of devices is a problematic concept in itself. If your system has a CUDA and L0 device what maps to gpu or gpu:0?
@diptorupd as IntelPython/numba-dpex#930 resolved you still need to know for which device you are compiling. You need to generate different SPIRV for different devices. Datatype of the result could be different for different devices. So, at the moment of Numba function compilation you must know for which device you are compiling.
I don't see how you are going to overcome these limitations.
I have all that information from the queue. What is your argument against getting device information from a queue?
You need to get this information from the queue at compile time. Which means, it should be part of SyclQueue siganture. SyclQueue would be part of DpnpArray, which means this information would be part of DpnpArray signature too.
So, no arguments against getting this information from queue. It simply doesn't change anything.
a) Compiling a kernel
b) Implementing compute follows data programming model that requires us to figure out what queue should execution take place.
I am talking about b), for the programming model we will not use filter string because of the points I presented above.
As for compiling a kernel for a specific device:
This is the flow:
i. numba-dpex evaluates all array arg types for a kernel and first figures if compute follows data is satisfied.
ii. If compute follows data is satisfied, we get the queue object.
iii. Then we compile the kernel based on the device type and backend that is extracted from the queue.
You need to get this information from the queue at compile time. Which means, it should be part of SyclQueue siganture. SyclQueue would be part of DpnpArray, which means this information would be part of DpnpArray signature too.
So, no arguments against getting this information from queue. It simply doesn't change anything.
And I keep telling you that SyclQueue is part of the type information available at static type. Look at
And I keep telling you that you need to put all the same information stored in filter_string to SyclQueue type. You can reinvent filter_string from the scratch, or just get one from dpctl.
And I keep telling you that you need to put all the same information stored in filter_string to SyclQueue type. You can reinvent filter_string from the scratch, or just get one from dpctl.
No, you only keep telling me that filter string is needed. You need to first start by explaining why you need it and why what I have explained till now does not meet the requirement.
Moreover, just to be clear are you fully aware what a filter string is? Can you explain why you need device rank?
Activity
samaid commentedon Mar 3, 2023
I doubt this overhead comes from Python. My gut feeling tells it comes from a driver side. Isn't it?
AlexanderKalistratov commentedon Mar 3, 2023
@samaid
99% sure.
But
filter_stringcould be cached. And device too. We must have device information to do compute follows data in numba. So either we are caching device/filter string on numba side or dpctl do it on it's sidediptorupd commentedon Mar 10, 2023
@AlexanderKalistratov
filter_stringhas a niceUXand visual aspect, but compute follows data has to be based onSyclQueue. The current filter string based compute follows data implementation in numba-dpex is a temporary workaround till numba_dpex/#930 gets resolved.There are several issues with basing compute follows data on filter string:
gpuorgpu:0?AlexanderKalistratov commentedon Mar 10, 2023
@diptorupd
It is based on SyclQueue.
filter_stringdoesn't affect that.It could be cached for the device. You don't need to compute it every time. It is from 1 to 3 lines of code for fix.
It doesn't have any affect on compilation. Device - does.
Kernel compiled for device could be run on sub-device. No recompilation needed.
Something
dpctlto deal with anyway.AlexanderKalistratov commentedon Mar 10, 2023
@diptorupd as IntelPython/numba-dpex#930 resolved you still need to know for which device you are compiling. You need to generate different SPIRV for different devices. Datatype of the result could be different for different devices. So, at the moment of Numba function compilation you must know for which device you are compiling.
I don't see how you are going to overcome these limitations.
diptorupd commentedon Mar 10, 2023
@AlexanderKalistratov I have all that information from the queue. What is your argument against getting device information from a queue?
AlexanderKalistratov commentedon Mar 10, 2023
@diptorupd
You need to get this information from the queue at compile time. Which means, it should be part of SyclQueue siganture. SyclQueue would be part of DpnpArray, which means this information would be part of DpnpArray signature too.
So, no arguments against getting this information from queue. It simply doesn't change anything.
diptorupd commentedon Mar 10, 2023
@AlexanderKalistratov I feel you are mixing two different concerns:
a) Compiling a kernel
b) Implementing compute follows data programming model that requires us to figure out what queue should execution take place.
I am talking about b), for the programming model we will not use filter string because of the points I presented above.
As for compiling a kernel for a specific device:
This is the flow:
i. numba-dpex evaluates all array arg types for a kernel and first figures if compute follows data is satisfied.
ii. If compute follows data is satisfied, we get the queue object.
iii. Then we compile the kernel based on the device type and backend that is extracted from the queue.
Does that help clarify?
diptorupd commentedon Mar 10, 2023
And I keep telling you that SyclQueue is part of the type information available at static type. Look at https://github.com/IntelPython/numba-dpex/blob/main/numba_dpex/core/types/usm_ndarray_type.py
AlexanderKalistratov commentedon Mar 10, 2023
And I keep telling you that you need to put all the same information stored in
filter_stringto SyclQueue type. You can reinventfilter_stringfrom the scratch, or just get one from dpctl.diptorupd commentedon Mar 10, 2023
No, you only keep telling me that filter string is needed. You need to first start by explaining why you need it and why what I have explained till now does not meet the requirement.
Moreover, just to be clear are you fully aware what a filter string is? Can you explain why you need device rank?
diptorupd commentedon Mar 10, 2023
In any case, I suggest we move this to a discussion topic as the bug report is not really related to the discussion we are having.
diptorupd commentedon Mar 10, 2023
Let's move the topic to https://github.com/IntelPython/dpctl/discussions/1107
oleksandr-pavlyk commentedon Mar 16, 2023
I have opened a PR to cache
filter_stringproperty.