-
I understood that Halide has a OpenCL backend. Can someone clarify me on the below questions.
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
I'm able to print the kernel code by using HL_DEBUG_CODEGEN=1. Looking for other answers. |
Beta Was this translation helpful? Give feedback.
-
Yes, the Halide compiler converts the halide code to a mix of host and kernel code, depending on the schedule. The kernel code is OpenCL C, and there's no good way to dump it except for the one you already discovered. The host code compiles from Halide, to LLVM IR, to machine code. It never exists as C source code. You can see it in Halide IR and LLVM IR form with HL_DEBUG_CODEGEN=2. To choose the platform and device see the functions in HalideRuntimeOpenCL.h (halide_opencl_set_platform_name and halide_opencl_set_device_type) |
Beta Was this translation helpful? Give feedback.
Yes, the Halide compiler converts the halide code to a mix of host and kernel code, depending on the schedule. The kernel code is OpenCL C, and there's no good way to dump it except for the one you already discovered. The host code compiles from Halide, to LLVM IR, to machine code. It never exists as C source code. You can see it in Halide IR and LLVM IR form with HL_DEBUG_CODEGEN=2.
To choose the platform and device see the functions in HalideRuntimeOpenCL.h (halide_opencl_set_platform_name and halide_opencl_set_device_type)