0

Is is possible to generate an (.ll) file from halide code ?

Only way I found to do that was through HL_DEBUG_CODEGEN=2

but that generates alot of architecture related code.

In other words, is there anyway to get llvm code for a specific image processing kernel and its scheduling?

M.A.
  • 31
  • 6

1 Answers1

0

To skip the support code use the -no_runtime target flag. If you're using a Generator, then you want something like ./mygenerator -g foo -e bitcode -o . target=host-no_runtime

You can generate even leaner bitcode with more target flags. When I just want to see the inner loop I use: host-no_runtime-no_bounds_query-no_asserts-disable_llvm_loop_unroll-disable_llvm_loop_vectorize

If you're not using a Generator you want Func::compile_to_llvm_assembly

Andrew Adams
  • 1,396
  • 7
  • 3
  • Thank you for the reply. Could please elaborate what's a generator ? I still had to use the ARM architecture and Linux flags to generate the output. When I use Target::NoOS and Target::ArchUnknown. It doesn't work With ARM and Linux I got 12000+ lines of llvm code How can I remove the architecture code ? – M.A. Mar 13 '19 at 16:51
  • And Theoretically, if I'm able to generate the bare bones llvm for functional and scheduling code, I can use it with any architecture right ? – M.A. Mar 13 '19 at 16:53
  • Generators are introduced here: http://halide-lang.org/tutorials/tutorial_lesson_15_generators.html. They are a way of encapsulating code for compilation with a standard interface. – jrk Mar 14 '19 at 01:30