Closed Bug 1720514 Opened 4 years ago Closed 4 years ago

Add framework for generating modules for intrinsic functions

Categories

(Core :: JavaScript: WebAssembly, task, P2)

task

Tracking

()

RESOLVED FIXED
92 Branch
Tracking Status
firefox92 --- fixed

People

(Reporter: rhunt, Assigned: rhunt)

References

Details

Attachments

(1 file)

Implement a framework for generating a wasm module that can be instantiated with a memory to provide an instance that exports an intrinsic function that can be linked against.

This commit implements a framework for creating 'intrinsics' which are
natively implemented functions that are exposable as wasm functions
that can be called or linked against. A simple 8-bit dot product for
vectors is implemented as a proof of concept.

The basic API is:

let module = wasmIntrinsicI8Dot(); // WebAssembly.Module
let memory = new WebAssembly.Module({ initial: pageSize });
let instance = new WebAssembly.Instance(module,
  { "": { memory } });
instance.exports.i8dot(dest, src1, src2, len);

The implementation is mainly done through CompileIntrisicModule which
manually builds a ModuleEnvironment with an imported memory, and a single
exported function which is of the bytecode form:

(func (params ...)
  local.get 0
  ...
  local.get n
  private_intrinsic_opcode
)

The private_intrinsic_opcode is implemented as an instance call. An
additional heap base parameter is added which allows quick bounds
checking, similar to Instance::memory32Copy.

A followup will implement the intrinsic for the firefox
translations project.

Attachment #9231229 - Attachment description: Bug 1720514 - wasm: Add framework for intrinsics with basic i8dot. r?jseward → Bug 1720514 - wasm: Add framework for intrinsics with basic i8vecmul. r?jseward
Pushed by rhunt@eqrion.net: https://hg.mozilla.org/integration/autoland/rev/09329fd044d6 wasm: Add framework for intrinsics with basic i8vecmul. r=jseward
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 92 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: