Repository navigation
Description
As part of #1249 I set IREE_LLVMJIT_DISABLE=1 to disable the current LLVM JIT execution tests. Compilation tests are still run.
The issue is that the LLVMJITCommandProcessor uses the memref descriptors:
https://github.com/google/iree/blob/eaa431279aadf5fdbe9af9862327dbb717c8d648/iree/hal/llvmjit/llvmjit_command_processor.cc#L56-L61
We've talked about this change in the past but I forgot that it was a blocker for this work because I couldn't run LLVMJIT tests on Windows yet.
These memref descriptors require shapes (AFAICT) that we don't have anymore. It may be possible to work around this iff no field but the data void* is used, but I believe the shape (and strides/lengths calculated from it) are required (https://github.com/google/iree/blob/eaa431279aadf5fdbe9af9862327dbb717c8d648/iree/hal/llvmjit/memref_runtime.h#L136-L153).
If the workaround doesn't work, maybe generating the LLVM IR in the function shim to populate the memref descriptors will. Or, you could switch away and over to the new API and be ready for dynamic shapes and all the other goodness.
The new VMLA code shows a way the new dispatch can be handled:
https://github.com/google/iree/blob/1af5e0972ea801cd933b59d38a232e8534884a7f/iree/hal/vmla/vmla_command_processor.cc#L37-L74
The bindings (and push constants, where dynamic dimensions/etc live) are setup there and provided to the target executable via a single Interface structure:
https://github.com/google/iree/blob/1af5e0972ea801cd933b59d38a232e8534884a7f/iree/hal/vmla/vmla_module.h#L44-L127
The generated code then queries the constants/bindings from that structure:
https://github.com/google/iree/blob/1af5e0972ea801cd933b59d38a232e8534884a7f/iree/compiler/Dialect/VMLA/vmla.imports.mlir#L24-L38
You could do something similar: a struct with the bindings/push constants, pass a pointer to your generated code, and dereference inside.
Mahesh has a CL train that moves a lot of the codegen over to the new hal interfaces which will make this much easier to get access to there (you need the IREE::HAL::InterfaceOp/InterfaceBindingOps to get the info).
We can gvc/chat more - just wanted to get these code links somewhere :)
Activity
benvanik commentedon Mar 26, 2020
Thanks to #1266 (thanks @asaadaldien!) I'm able to keep the LLVM JIT code path working with the new (temporary) API shim. We'll still need to update to use the new interfaces for dynamic shapes but now there's less pressure!
benvanik commentedon May 5, 2020
Note that this work will be needed for dynamic shapes.
[codegen] Support dynamic shape in llvm-ir backend
[codegen] Support dynamic shape in llvm-ir backend
[codegen] Support dynamic shape in llvm-ir backend
benvanik commentedon Jun 17, 2020
I really want to get rid of the memref_runtime.h and the C ABI incompatible templated C++ structs we are passing across the JIT/shared object boundary and prepare for better versioning across the ABI (as well as custom functions). I'll take a look at doing that before the end of the quarter.