Hi, Could you help me to figure out please, is K2 supposed to fallback to K1 on build targets which are using KSP? Is it a standard behaviour or do we need to specify some extra flags? We use KSP in the same compiler invocation we compile the code, do we need to split it into the two invocations to enable fallback?
Also, does anyone have any ideas on timelines for KSP being supported in K2? Will it be always 2 separate invocations for K2?
Ruslan Latypov
08/23/2023, 1:24 PM
Also, does anyone know if compilation with embedded KSP and 2 steps KSP+compilation suppose to have similar performance? When compiler runs with KSP in single step, does compiler do two passes internally with one command?
t
Ting-Yuan Huang
08/26/2023, 12:15 AM
Are you calling KSP from the command line? If so, you'll need 2 separate calls. There is a slight but noticeable overhead because the compiler is initialized twice.
If you're using KSP in Gradle, it has been invoked a long time ago. KSP always calls K1 regardless of language version settings.
r
Ruslan Latypov
08/29/2023, 1:26 PM
@Ting-Yuan Huang we are using Buck. Atm the implementation in Buck makes 1 compiler calls and it seems to not fall back to K1, do we need to split calls to make the fallback working?
t
Ting-Yuan Huang
09/07/2023, 9:11 PM
Yes, please call them (ksp and compiler) separately and specify K1 for ksp. By the way, the future ksp 2.0 implementation will also require separate calls because it will become an independent tool instead of a compiler plugin.
j
jbarr
09/29/2023, 2:42 AM
@Ting-Yuan Huang why will KSP 2 w/ K2 require an additional kotlinc invocation? can't the independent tool and the kotlinc compiler plugin share the same code? I'm concerned about the performance hit of this choice
t
Ting-Yuan Huang
09/29/2023, 5:17 AM
There might be different overheads compared to the compiler plugin approach, but overall we expect it to be faster due to K2 being faster. Also being an independent tool we avoid most of the workarounds that eat performance too.