My LFX Mentorship Experience
An introduction to LFX Mentorships
For the uninitiated, LFX Mentorship is a program launched by the Linux Foundation to connect aspiring open-source contributors with experienced project mentors. It is designed to foster talent, promote diversity, and strengthen the open-source ecosystem by providing hands-on experience in real-world projects.
Choosing a Mentorship
After conducting some initial research, I decided to apply for a mentorship through the CNCF program, specifically with WasmEdge. WasmEdge is a high-performance WebAssembly runtime designed for serverless applications, embedded systems, and IoT devices. In simple terms, it enables developers to write efficient, portable code using WebAssembly or languages like C++ and Rust, which can be compiled to WebAssembly, and run it seamlessly across different platforms.
Among the available mentorship projects, I chose to work on porting WasmEdge to the s390x architecture. s390x is the 64-bit architecture used by IBM Z mainframes, which is a popular choice for enterprise-level computing. This project intrigued me because it combined low-level systems work with platform compatibility challenges, giving me the opportunity to dive deeper into cross-compilation, architecture specific optimizations, and open source development workflows. It also involved working with LLVM, which acts as the backend for the AOT and JIT compilers.
My Acceptance into the Program
The Application process for LFX Mentorships involves submitting a cover letter and a resume. I was also asked to complete and submit the pre-test results as part of the process. The pre-test involved launching a VM using qemu to run a Linux distribution for the s390x architecture.
A few weeks later, I received an email from the LFX Engineering team, informing me that I had been accepted into the program.
My Work during the Program
As mentioned earlier, my main focus during the program was on porting WasmEdge to the s390x architecture. The primary challenge was that s390x is a big-endian architecture, while the WebAssembly specification is little-endian. If you are not familiar with endianness, it refers to the order in which bytes are arranged in a binary number. There are two types:
- Big-endian: Stores the most significant byte (left-most byte) at the lowest memory address.
- Little-endian: Stores the least significant byte (right-most byte) at the lowest memory address.
In the case of s390x, the former ordering is used, compared to architectures like x86 and ARM, which use the latter.
To overcome this challenge, I had to modify the backend load and store instuctions to use the correct endianness. This also included writing custom atomic operations for the s390x architecture, Fixing array and SIMD vector ordering, and more. My end goal was to run the entire WebAssembly test suite on the s390x architecture.
My second task was to work on getting the WASI implementation to run properly. WASI, or WebAssembly System Interface, can be considered as syscalls for WebAssembly, allowing for interaction with I/O, networking and file system.
With the wasi-nn extension, WebAssembly can also run machine learning models, using backends such as llama.cpp. My next task was to get the llama.cpp implementation to run on the s390x architecture.
My last goal was to work on the AOT and JIT compiler modes of WasmEdge. I had to fix similar issues as I did with the s390x architecture, such as endianness and SIMD vector ordering, along with a sprinkle of segfaults and ABI issues.
My work can be viewed here.
The Conclusion
Overall, my experience with LFX Mentorships was very positive. As my first time working with a large open-source project, I was able to learn a lot about the project's architecture, development workflow, and more. I'm grateful for my mentors Hung-Ying Tai and Meng-Han Lee for providing me with the opportunity to learn and grow as a developer.