1、RISC-V Summit 2024利用WebAssembly技术解决多种ISA的挑战Chen Yolanda(),Huang WenyongIntel ConfidentialDepartment or Event Name2RISC-V Summit China 20242Agenda多种ISA的新挑战WebAssembly技术及其特性对 Risc-V的应用和实践Intel ConfidentialDepartment or Event Name3RISC-V Summit China 20243多种ISA的挑战随着RISC-V等新的ISA标准的兴起,未来会是一个多种ISA的世界。不同硬件
2、平台上,新兴的编程语言也层出不穷。如何提供更好的软件开发工具来帮助开发者开发跨平台的解决方案是一个重要的问题。WebAssembly(缩写WASM)于2019年正式成为W3C的推荐标准,其定义了一种低级字节码,具有可移植性、可以安全且快速地跨平台运行。它实现了对现代硬件的抽象,并且独立于语言、硬件和平台,为Web应用而生但又不仅限于Web平台。目前在Chrome V8 引擎,Wasm Micro Runtime(WAMR)中都已实现WASM 对 RISC-V平台的支持。Intel ConfidentialDepartment or Event Name4RISC-V Summit China
3、20244What is WebAssemblyWebAssemblyis a type of code that can be run in modern web browsers it is a low-level assembly-like language with a compact binary format that runs with near-native performance and provides languages such as C/C+,C#and Rust with a compilation target so that they can run on th
4、e web.It is also designed to run alongside JavaScript,allowing both to work together.1emcc-O3-g-o fib.js fib.c./wasm2wat fib.wasm fib.watfib.wasmloop ;label=1 local.get 0 i32.const-2 i32.add local.set 3 local.get 0 i32.const-1 i32.add local.set 2 local.get 2 call$_fib local.set 2 local.get 2 local.g
5、et 1 i32.add local.set 1 local.get 0 i32.const 4 i32.ge_s if ;label=2 local.get 3 local.set 0 br 1(;1;)end end#include int fib(int x)if(x 2)return 1;else return fib(x-1)+fib(x-2);int main()int result=fib(45);printf(%dn,result);return 1;12Intel ConfidentialDepartment or Event Name5RISC-V Summit China
6、 20245用法和特点LanguageChromeSafariFirefoxNode.jsWAMRWasmtimeAny language supported by LLVMToolchainPlatformRuntime PortableWrite once,run everywhere.Language-,hardware-and platform-independent.FastLow-level code emitted by a C/C+compiler is typically optimized ahead-of-time.Support hand-written intrins