TVM generated OpenCL kernels

how do i determine the mapping to parameters for each kernel i.e., how does the main program with model inputs invoke each of these kernels ?

Hi @gana! I’ll be glad to help you. But could you please describe, what you are trying to do and what are you planning to get as a result? I got that you want to match TVM tensors with OpenCL kernels parameters, am I right?

hi @echuraev,

i have an input onnx model (matrix multiply) with inputs T1 and T2, Output O1

TVM generates 2 OpenCL kernels

Transpose (X, Y)

Dense (U, V, W)

i am unable to obtain a “main” host program that calls these kernels, to obtain the mapping of say T1 to X, Y to V, and output U to O1

i tried to generate C code to see if i can get this mapping, but again no “main” function is available

there is a “main” in LLVM IR and that has two kernel definitions but their parameters are many and hard to trace via “hand data-flow analysis” …

any advice, help appreciated

thanks !

Sorry, for the delay in response.

You are not able to get a “main” host program. From the OpenCL runtime, you can get only OpenCL programs. But the host part you should write by yourself if you want to do any experiments. You can add prints to OpenCL runtime and get the OpenCL kernels and also print the buffers or textures which were allocated. In this case, you’ll be able to create the same surfaces in your code.

You can find some examples in this application: qualcomm/apps/OpenCLCppRunner at master · Deelvin/qualcomm · GitHub In the implementations directory, there are several examples of host code for OpenCL kernels from TVM.