summaryrefslogtreecommitdiffstats
path: root/js/src/wasm/WasmBuiltinModule.yaml
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /js/src/wasm/WasmBuiltinModule.yaml
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/wasm/WasmBuiltinModule.yaml')
-rw-r--r--js/src/wasm/WasmBuiltinModule.yaml365
1 files changed, 365 insertions, 0 deletions
diff --git a/js/src/wasm/WasmBuiltinModule.yaml b/js/src/wasm/WasmBuiltinModule.yaml
new file mode 100644
index 0000000000..88c2f5a575
--- /dev/null
+++ b/js/src/wasm/WasmBuiltinModule.yaml
@@ -0,0 +1,365 @@
+# The file contains information need to define wasm builtin module funcs
+# operations.
+
+# i8vecmul(dest: i32, src1: i32, src2: i32, len: i32)
+# Performs pairwise multiplication of two i8 vectors of 'len' specified at
+# 'src1' and 'src2'. Output is written to 'dest'. This is used as a
+# basic self-test for builtin module funcs.
+- op: I8VecMul
+ symbolic_address:
+ name: IntrI8VecMul
+ type: Args_Int32_GeneralInt32Int32Int32Int32General
+ entry: Instance::intrI8VecMul
+ export: i8vecmul
+ params:
+ - 'ValType::i32()'
+ - 'ValType::i32()'
+ - 'ValType::i32()'
+ - 'ValType::i32()'
+ fail_mode: FailOnNegI32
+ uses_memory: true
+
+#if defined(ENABLE_WASM_MOZ_INTGEMM)
+
+# Intrinsics for integer matrix multiplication followed by addition of bias.
+# Please refer to @TOPSRCDIR/js/src/intgemm/IntegerGemmIntrinsic.h for more details on these intrinsics.
+
+
+# Prepare B for the Matrix Multiply intrinsic from Input matrix B.
+#
+# Quantization is performed on the input.
+# The final prepared B is in CPU-dependent format and can be used as an input to matrix multiply
+# intrinsic (`int8_multiply_and_add_bias`).
+#
+# int8_prepare_b(const float* inputMatrixB, float scale, float zeroPoint, uint32_t rowsB, uint32_t colsB, int8_t* outputMatrixB)
+# int8_prepare_b(inputMatrixB: i32, scale: f32, zeroPoint: f32, rowsB: i32, colsB: i32, outputMatrixB: i32)
+- op: I8PrepareB
+ symbolic_address:
+ name: IntrI8PrepareB
+ type: Args_Int32_GeneralInt32Float32Float32Int32Int32Int32General
+ entry: intgemm::IntrI8PrepareB
+ export: int8_prepare_b
+ params:
+ - 'ValType::i32()'
+ - 'ValType::f32()'
+ - 'ValType::f32()'
+ - 'ValType::i32()'
+ - 'ValType::i32()'
+ - 'ValType::i32()'
+ fail_mode: FailOnNegI32
+ uses_memory: true
+
+
+# Prepare B for the Matrix Multiply intrinsic from transposed version of Input matrix B.
+#
+# Quantization is performed on floating values of input.
+# The final prepared B is in CPU-dependent format and can be used as an input to matrix multiply
+# intrinsic (`int8_multiply_and_add_bias`).
+#
+# int8_prepare_b_from_transposed(const float* inputMatrixBTransposed, float scale, float zeroPoint, uint32_t rowsB, uint32_t colsB, int8_t* outputMatrixB)
+# int8_prepare_b_from_transposed(inputMatrixBTransposed: i32, scale: f32, zeroPoint: f32, rowsB: i32, colsB: i32, outputMatrixB: i32)
+- op: I8PrepareBFromTransposed
+ symbolic_address:
+ name: IntrI8PrepareBFromTransposed
+ type: Args_Int32_GeneralInt32Float32Float32Int32Int32Int32General
+ entry: intgemm::IntrI8PrepareBFromTransposed
+ export: int8_prepare_b_from_transposed
+ params:
+ - 'ValType::i32()'
+ - 'ValType::f32()'
+ - 'ValType::f32()'
+ - 'ValType::i32()'
+ - 'ValType::i32()'
+ - 'ValType::i32()'
+ fail_mode: FailOnNegI32
+ uses_memory: true
+
+
+# Prepare B for the Matrix Multiply intrinsic from a quantized and transposed version of Input
+# matrix B which is also in a CPU-independent format.
+#
+# The final prepared B is in CPU-dependent format and can be used as an input to matrix multiply
+# intrinsic (`int8_multiply_and_add_bias`).
+#
+# int8_prepare_b_from_quantized_transposed(const int8_t* inputMatrixBQuantizedTransposed, uint32_t rowsB, uint32_t colsB, int8_t* outputMatrixB)
+# int8_prepare_b_from_quantized_transposed(inputMatrixBQuantizedTransposed: i32, rowsB: i32, colsB: i32, outputMatrixB: i32)
+- op: I8PrepareBFromQuantizedTransposed
+ symbolic_address:
+ name: IntrI8PrepareBFromQuantizedTransposed
+ type: Args_Int32_GeneralInt32Int32Int32Int32General
+ entry: intgemm::IntrI8PrepareBFromQuantizedTransposed
+ export: int8_prepare_b_from_quantized_transposed
+ params:
+ - 'ValType::i32()'
+ - 'ValType::i32()'
+ - 'ValType::i32()'
+ - 'ValType::i32()'
+ fail_mode: FailOnNegI32
+ uses_memory: true
+
+
+# Prepare A for the Matrix Multiply intrinsic from Input matrix A.
+#
+# It performs quantization on floating values of input.
+# The final prepared A might be architecture dependent. e.g. On some architectures like x86, it
+# might be unsigned (achieved by adding 127 to quantized values) while on others like Arm, it might
+# be signed.
+# The final prepared A can be used as an input to matrix multiply intrinsic
+# (`int8_multiply_and_add_bias`).
+#
+# int8_prepare_a(const float* inputMatrixA, float scale, float zeroPoint, uint32_t rowsA, uint32_t colsA, int8_t* outputMatrixA)
+# int8_prepare_a(inputMatrixA: i32, scale: f32, zeroPoint: f32, rowsA: i32, colsA: i32, outputMatrixA: i32)
+- op: I8PrepareA
+ symbolic_address:
+ name: IntrI8PrepareA
+ type: Args_Int32_GeneralInt32Float32Float32Int32Int32Int32General
+ entry: intgemm::IntrI8PrepareA
+ export: int8_prepare_a
+ params:
+ - 'ValType::i32()'
+ - 'ValType::f32()'
+ - 'ValType::f32()'
+ - 'ValType::i32()'
+ - 'ValType::i32()'
+ - 'ValType::i32()'
+ fail_mode: FailOnNegI32
+ uses_memory: true
+
+
+# Prepares bias for the Matrix Multiply intrinsic.
+#
+# It uses the prepared B (which must be obtained by using any of the `int8_prepare_b*` intrinsics) and
+# a bias input to prepare the final bias.
+#
+# The final bias can be used as an input to matrix multiply intrinsic (`int8_multiply_and_add_bias`).
+#
+# int8_prepare_bias(const int8_t* inputMatrixBPrepared, float scaleA, float zeroPointA, float scaleB, float zeroPointB, uint32_t rowsB, uint32_t colsB, const float* inputBias, float* output)
+# int8_prepare_bias(inputMatrixBPrepared: i32, scaleA: f32, zeroPointA: f32, scaleB: f32, zeroPointB: f32, rowsB: i32, colsB: i32, inputBias: i32, output: i32)
+- op: I8PrepareBias
+ symbolic_address:
+ name: IntrI8PrepareBias
+ type: Args_Int32_GeneralInt32Float32Float32Float32Float32Int32Int32Int32Int32General
+ entry: intgemm::IntrI8PrepareBias
+ export: int8_prepare_bias
+ params:
+ - 'ValType::i32()'
+ - 'ValType::f32()'
+ - 'ValType::f32()'
+ - 'ValType::f32()'
+ - 'ValType::f32()'
+ - 'ValType::i32()'
+ - 'ValType::i32()'
+ - 'ValType::i32()'
+ - 'ValType::i32()'
+ fail_mode: FailOnNegI32
+ uses_memory: true
+
+
+# Perform multiplication of 2 matrices followed by adding a bias.
+#
+# i.e Output = inputMatrixAPrepared * inputMatrixBPrepared + inputBiasPrepared
+#
+# The inputs of this intrinsic must be obtained by using `int8_prepare_A`,
+# one of the `int8_prepare_b*` and `int8_prepare_bias` intrinsics respectively.
+#
+# int8_multiply_and_add_bias(const int8_t* inputMatrixAPrepared, float scaleA, float zeroPointA,
+# const int8_t* inputMatrixBPrepared, float scaleB, float zeroPointB,
+# const float* inputBiasPrepared, float unquantMultiplier,
+# uint32_t rowsA, uint32_t width, uint32_t colsB, float* output)
+# int8_multiply_and_add_bias(inputMatrixAPrepared: i32, scaleA: f32, zeroPointA: f32,
+# inputMatrixBPrepared: i32, scaleB: f32, zeroPointB: f32,
+# inputBiasPrepared: i32, unquantMultiplier: f32,
+# rowsA: i32, width: i32, colsB: i32, output: i32)
+- op: I8MultiplyAndAddBias
+ symbolic_address:
+ name: IntrI8MultiplyAndAddBias
+ type: Args_Int32_GeneralInt32Float32Float32Int32Float32Float32Int32Float32Int32Int32Int32Int32General
+ entry: intgemm::IntrI8MultiplyAndAddBias
+ export: int8_multiply_and_add_bias
+ params:
+ - 'ValType::i32()'
+ - 'ValType::f32()'
+ - 'ValType::f32()'
+ - 'ValType::i32()'
+ - 'ValType::f32()'
+ - 'ValType::f32()'
+ - 'ValType::i32()'
+ - 'ValType::f32()'
+ - 'ValType::i32()'
+ - 'ValType::i32()'
+ - 'ValType::i32()'
+ - 'ValType::i32()'
+ fail_mode: FailOnNegI32
+ uses_memory: true
+
+
+# Select a subset of columns of prepared B.
+#
+# Indices of the columns to be selected are specified by an array.
+#
+# int8_select_columns_of_b(const int8_t* inputMatrixBPrepared, uint32_t rowsB, uint32_t colsB, const uint32_t* colIndexList, const uint32_t sizeColIndexList, int8_t* output)
+# int8_select_columns_of_b(inputMatrixBPrepared: i32, rowsB: i32, colsB: i32, colIndexList: i32, sizeColIndexList: i32, output: i32)
+- op: I8SelectColumnsOfB
+ symbolic_address:
+ name: IntrI8SelectColumnsOfB
+ type: Args_Int32_GeneralInt32Int32Int32Int32Int32Int32General
+ entry: intgemm::IntrI8SelectColumnsOfB
+ export: int8_select_columns_of_b
+ params:
+ - 'ValType::i32()'
+ - 'ValType::i32()'
+ - 'ValType::i32()'
+ - 'ValType::i32()'
+ - 'ValType::i32()'
+ - 'ValType::i32()'
+ fail_mode: FailOnNegI32
+ uses_memory: true
+
+#endif // ENABLE_WASM_MOZ_INTGEMM
+
+#if defined(ENABLE_WASM_JS_STRING_BUILTINS)
+
+- op: StringFromWTF16Array
+ symbolic_address:
+ name: StringFromWTF16Array
+ type: Args_General_GeneralGeneralInt32Int32
+ entry: Instance::stringFromWTF16Array
+ export: fromWTF16Array
+ params:
+ - 'ValType(RefType::any())'
+ - 'ValType::i32()'
+ - 'ValType::i32()'
+ result: 'ValType(RefType::extern_())'
+ fail_mode: FailOnNullPtr
+ uses_memory: false
+
+- op: StringToWTF16Array
+ symbolic_address:
+ name: StringToWTF16Array
+ type: Args_Int32_GeneralGeneralGeneralInt32
+ entry: Instance::stringToWTF16Array
+ export: toWTF16Array
+ params:
+ - 'ValType(RefType::extern_())'
+ - 'ValType(RefType::any())'
+ - 'ValType::i32()'
+ result: 'ValType::i32()'
+ fail_mode: FailOnNegI32
+ uses_memory: false
+
+- op: StringFromCharCode
+ symbolic_address:
+ name: StringFromCharCode
+ type: Args_General_GeneralInt32
+ entry: Instance::stringFromCharCode
+ export: fromCharCode
+ params:
+ - 'ValType::i32()'
+ result: 'ValType(RefType::extern_())'
+ fail_mode: FailOnNullPtr
+ uses_memory: false
+
+- op: StringFromCodePoint
+ symbolic_address:
+ name: StringFromCodePoint
+ type: Args_General_GeneralInt32
+ entry: Instance::stringFromCodePoint
+ export: fromCodePoint
+ params:
+ - 'ValType::i32()'
+ result: 'ValType(RefType::extern_())'
+ fail_mode: FailOnNullPtr
+ uses_memory: false
+
+- op: StringCharCodeAt
+ symbolic_address:
+ name: StringCharCodeAt
+ type: Args_Int32_GeneralGeneralInt32
+ entry: Instance::stringCharCodeAt
+ export: charCodeAt
+ params:
+ - 'ValType(RefType::extern_())'
+ - 'ValType::i32()'
+ result: 'ValType::i32()'
+ fail_mode: FailOnNegI32
+ uses_memory: false
+
+- op: StringCodePointAt
+ symbolic_address:
+ name: StringCodePointAt
+ type: Args_Int32_GeneralGeneralInt32
+ entry: Instance::stringCodePointAt
+ export: codePointAt
+ params:
+ - 'ValType(RefType::extern_())'
+ - 'ValType::i32()'
+ result: 'ValType::i32()'
+ fail_mode: FailOnNegI32
+ uses_memory: false
+
+- op: StringLength
+ symbolic_address:
+ name: StringLength
+ type: Args_Int32_GeneralGeneral
+ entry: Instance::stringLength
+ export: length
+ params:
+ - 'ValType(RefType::extern_())'
+ result: 'ValType::i32()'
+ fail_mode: FailOnNegI32
+ uses_memory: false
+
+- op: StringConcatenate
+ symbolic_address:
+ name: StringConcatenate
+ type: Args_General3
+ entry: Instance::stringConcatenate
+ export: concatenate
+ params:
+ - 'ValType(RefType::extern_())'
+ - 'ValType(RefType::extern_())'
+ result: 'ValType(RefType::extern_())'
+ fail_mode: FailOnNullPtr
+ uses_memory: false
+
+- op: StringSubstring
+ symbolic_address:
+ name: StringSubstring
+ type: Args_General_GeneralGeneralInt32Int32
+ entry: Instance::stringSubstring
+ export: substring
+ params:
+ - 'ValType(RefType::extern_())'
+ - 'ValType::i32()'
+ - 'ValType::i32()'
+ result: 'ValType(RefType::extern_())'
+ fail_mode: FailOnNullPtr
+ uses_memory: false
+
+- op: StringEquals
+ symbolic_address:
+ name: StringEquals
+ type: Args_Int32_GeneralGeneralGeneral
+ entry: Instance::stringEquals
+ export: equals
+ params:
+ - 'ValType(RefType::extern_())'
+ - 'ValType(RefType::extern_())'
+ result: 'ValType::i32()'
+ fail_mode: FailOnNegI32
+ uses_memory: false
+
+- op: StringCompare
+ symbolic_address:
+ name: StringCompare
+ type: Args_Int32_GeneralGeneralGeneral
+ entry: Instance::stringCompare
+ export: compare
+ params:
+ - 'ValType(RefType::extern_())'
+ - 'ValType(RefType::extern_())'
+ result: 'ValType::i32()'
+ fail_mode: FailOnMaxI32
+ uses_memory: false
+
+#endif // ENABLE_WASM_JS_STRING_BUILTINS