Assocating CUDA kernel launches to functions

12 views
Skip to first unread message

SANJAY SRIVALLABH SINGAPURAM

unread,
Jun 6, 2017, 4:33:00 PM6/6/17
to Polly Development
Currently, all NVPTX kernels generated by Polly-ACC are named "kernel_#" ( #=0,1,2,3,...) . While profiling, we would have to find the host function that called the kernel by searching for the point where the kernel is launched in the source code. This task becomes even more arduous as the number of kernels increase.

Furthermore, it might become impossible to find the kernel-host function association when Polly is used through JIT. i.e. functions with GPU friendly SCoPs would end up calling a function of the name, although, with different definitions. E.g. nvprof on Julia running PolyBench.jl,
==4776== Profiling application: usr/bin/julia --check-bounds=no -g0
==4776== Profiling result:
Time(%)      Time     Calls       Avg       Min       Max  Name
 76.16%  24.1500s     25701  939.65us  115.55us  46.950ms  kernel_0
 19.28%  6.11307s     25054  244.00us  115.46us  22.412ms  kernel_1
[...]

This makes it impossible to associate a kernel with the function that called it, therefore making it impossible to know which Julia functions were actually run on the GPU.

Is it possible to prefix the name of the function a Scop's associated Region is from to the name of the kernel ? i.e. "kernel_gemm_kernel_0". This would require PPCGCodegen to extract the function name from the Region inside the Scop it received and pass it to GPUNodeBuilder.

Please share your thoughts.

Thanks,
Sanjay

Tobias Grosser

unread,
Jun 6, 2017, 4:35:51 PM6/6/17
to SANJAY SRIVALLABH SINGAPURAM, Polly Development
Hi Sanjay,

this sounds like a very reasonable idea. It should not be too difficult
to do exactly this.

Best,
Tobias
> --
> You received this message because you are subscribed to the Google Groups
> "Polly Development" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to polly-dev+...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

SANJAY SRIVALLABH SINGAPURAM

unread,
Jun 7, 2017, 1:25:22 PM6/7/17
to Tobias Grosser, Polly Development

Tobias Grosser

unread,
Jun 7, 2017, 1:46:03 PM6/7/17
to SANJAY SRIVALLABH SINGAPURAM, Polly Development
Currently at a concert, but could you add a test case? Also, is there a
need for kernel appearing twice in the name?

SANJAY SRIVALLABH SINGAPURAM

unread,
Jun 7, 2017, 2:40:21 PM6/7/17
to Tobias Grosser, Polly Development
All I do is prefix the name of the function to the name of the kernel. The first GPU kernel produced for a host function called "gemm" would be called "gemm_kernel_0".

I will add a test case.

Tobias Grosser

unread,
Jun 7, 2017, 5:52:44 PM6/7/17
to SANJAY SRIVALLABH SINGAPURAM, Polly Development
Great. Thank you.

Tobias
Reply all
Reply to author
Forward
0 new messages