Closed clover2123 closed 8 months ago
@zherczeg Would you please check this issue?
Yes, single functions can be compiled. It will increase the resource costs somewhat, and disallow direct function calls (this feature was used in the old jit). But I don't see any other disadvantage. Maybe we should add some management for global jit compiled helpers to compile them only once. We can move into this direction if you want it.
supporting JITC for single function is not an urgent task now, but IMHO this approach is mandatory to switch between interpreter mode and JITC mode in the future. I just want to know that there is any difficulty to support this.
Now, I think that it's the time to merge two branches (interp
and jit
or jit_next
) into the main
branch since there occur many conflicts (like #163) as we develop each branch separately.
Merged walrus will operate in one of two modes (interpret or JITC) for a while.
Are there any issues other than #163 in merging two branches?
I don't think single function compilation is a difficult task. There are some problems, which needs to be carefully handled, but not that many.
About merging: most of the patches in JIT branch are not compiling now due to the changes in the interpreter. The last patch compiles of course. It looks like a bigger work to make all of them compile cleanly. Squashing is an option, but the patch will be big. What shall we do?
Target status: x86-64 is working, except simd x86-32 was working, there are some fails since the last merge ARM64 fully works ARM32 has some issues (mainly unaligned accesses), patches are proposed for them RISCV: unknown
Btw jit_next
is the branch for merging. jit
contains a legacy implementation, it could be removed.
I have updated the compile function:
void jitCompile(ModuleFunction* functions, size_t functionsLength, int verboseLevel)
If functionsLength
is 0, it compiles all functions. Otherwise the functions listed in functions
are compiled only. If a function has been already compiled, it is always ignored (no double compiling). Is this API acceptable for your plans?
@zherczeg That would be great! Thanks for the quick update.
BTW I think that after fixing some conflicts with interpreter, we can merge it into the main
branch.
And then, we can develop walrus based on the main branch together.
Let me give a status update.
ARM64 - Works with simd ARM32 (normal and thumb2) - Wirks ,except floating point simd An emulation layer is created: https://github.com/Samsung/walrus/pull/165 x86 - Works except simd
If https://github.com/Samsung/walrus/pull/175 lands, the emulation layer can be simplified.
Do we need to do anything else before merging?
Thanks for your great contribution👍 SIMD support on ARM platforms would be enough After merging, we can work on performance/memory optimizations together
Thank you very much! How shall we land the patch? In its current state (where several patches does not compile), or do you need any modifications?
Shall we continue the simd support on x86, or do something else?
Would you please merge into the main
branch?
At first, dividing interpreter and jit mode would be enough as is.
SIMD on x86 is not an urgent issue, so let's merge them and work on it later
Resolved by #177
Let's discuss merging JIT with existing interpreter.
I have some questions about JIT compiler.
DefinedFunction
) in a Module right after its creation. But to make a balance with interpreter, JITC needs to be applied on the basis of single function rather than Module. For example, we can directly apply JITC for will-be-hot functions such as a function that includesloop
statements. On the otherhand, we just start to run other cold functions with interpreter, and later, when we find that several functions have been called frequently (hot) then finally JITC compiles these functions. Would it be possible to apply JITC for each single function?