|
|
|
|
|
by jph00
2547 days ago
|
|
The goal is to allow Swift to be used for writing MLIR and XLA kernels. The new LazyTensor under development already allows for fused XLA operations to be created in Swift. There's an awful lot you can do in Swift which is very very hard to do properly in Python. I've got a bit more background on this here: https://www.fast.ai/2019/03/06/fastai-swift/ Edit: HN isn't letting me reply deeper, so I'll reply to "what are the benefits over C++?" here. The first is that MLIR has dialects that support stuff like polyhedral compilation, which result in much more concise and understandable code, which is often faster too. The second is that using the same language from top to bottom means you can profile/debug/etc your code in one place, which is much more efficient. And you don't have to learn two languages. And you don't have to use C++, which (for me at least) is a big win! ;) |
|
You can achieve the same efficiency in C++ via a custom TF op. You end up with native instructions either way. And you have access to the entire memmapped model in the op, allowing you to do as you please.
You're only debugging in one place, because the same C++ code runs during training in your notebook that runs during inference on your device.
You're getting ease of implementation and usage of Swift. But your code will be less portable; you won't be able to run the same model on Android or on the server. And there's not necessarily any performance benefit over doing the same in C++, definitely not if your kernel is simple.