1 # The file contains information need to define wasm builtin module funcs
4 # i8vecmul(dest: i32, src1: i32, src2: i32, len: i32)
5 # Performs pairwise multiplication of two i8 vectors of 'len' specified at
6 # 'src1' and 'src2'. Output is written to 'dest'. This is used as a
7 # basic self-test for builtin module funcs.
11 type: Args_Int32_GeneralInt32Int32Int32Int32General
12 entry: Instance::intrI8VecMul
19 fail_mode: FailOnNegI32
22 #if defined(ENABLE_WASM_MOZ_INTGEMM)
24 # Intrinsics for integer matrix multiplication followed by addition of bias.
25 # Please refer to @TOPSRCDIR/js/src/intgemm/IntegerGemmIntrinsic.h for more details on these intrinsics.
28 # Prepare B for the Matrix Multiply intrinsic from Input matrix B.
30 # Quantization is performed on the input.
31 # The final prepared B is in CPU-dependent format and can be used as an input to matrix multiply
32 # intrinsic (`int8_multiply_and_add_bias`).
34 # int8_prepare_b(const float* inputMatrixB, float scale, float zeroPoint, uint32_t rowsB, uint32_t colsB, int8_t* outputMatrixB)
35 # int8_prepare_b(inputMatrixB: i32, scale: f32, zeroPoint: f32, rowsB: i32, colsB: i32, outputMatrixB: i32)
39 type: Args_Int32_GeneralInt32Float32Float32Int32Int32Int32General
40 entry: intgemm::IntrI8PrepareB
41 export: int8_prepare_b
49 fail_mode: FailOnNegI32
53 # Prepare B for the Matrix Multiply intrinsic from transposed version of Input matrix B.
55 # Quantization is performed on floating values of input.
56 # The final prepared B is in CPU-dependent format and can be used as an input to matrix multiply
57 # intrinsic (`int8_multiply_and_add_bias`).
59 # int8_prepare_b_from_transposed(const float* inputMatrixBTransposed, float scale, float zeroPoint, uint32_t rowsB, uint32_t colsB, int8_t* outputMatrixB)
60 # int8_prepare_b_from_transposed(inputMatrixBTransposed: i32, scale: f32, zeroPoint: f32, rowsB: i32, colsB: i32, outputMatrixB: i32)
61 - op: I8PrepareBFromTransposed
63 name: IntrI8PrepareBFromTransposed
64 type: Args_Int32_GeneralInt32Float32Float32Int32Int32Int32General
65 entry: intgemm::IntrI8PrepareBFromTransposed
66 export: int8_prepare_b_from_transposed
74 fail_mode: FailOnNegI32
78 # Prepare B for the Matrix Multiply intrinsic from a quantized and transposed version of Input
79 # matrix B which is also in a CPU-independent format.
81 # The final prepared B is in CPU-dependent format and can be used as an input to matrix multiply
82 # intrinsic (`int8_multiply_and_add_bias`).
84 # int8_prepare_b_from_quantized_transposed(const int8_t* inputMatrixBQuantizedTransposed, uint32_t rowsB, uint32_t colsB, int8_t* outputMatrixB)
85 # int8_prepare_b_from_quantized_transposed(inputMatrixBQuantizedTransposed: i32, rowsB: i32, colsB: i32, outputMatrixB: i32)
86 - op: I8PrepareBFromQuantizedTransposed
88 name: IntrI8PrepareBFromQuantizedTransposed
89 type: Args_Int32_GeneralInt32Int32Int32Int32General
90 entry: intgemm::IntrI8PrepareBFromQuantizedTransposed
91 export: int8_prepare_b_from_quantized_transposed
97 fail_mode: FailOnNegI32
101 # Prepare A for the Matrix Multiply intrinsic from Input matrix A.
103 # It performs quantization on floating values of input.
104 # The final prepared A might be architecture dependent. e.g. On some architectures like x86, it
105 # might be unsigned (achieved by adding 127 to quantized values) while on others like Arm, it might
107 # The final prepared A can be used as an input to matrix multiply intrinsic
108 # (`int8_multiply_and_add_bias`).
110 # int8_prepare_a(const float* inputMatrixA, float scale, float zeroPoint, uint32_t rowsA, uint32_t colsA, int8_t* outputMatrixA)
111 # int8_prepare_a(inputMatrixA: i32, scale: f32, zeroPoint: f32, rowsA: i32, colsA: i32, outputMatrixA: i32)
115 type: Args_Int32_GeneralInt32Float32Float32Int32Int32Int32General
116 entry: intgemm::IntrI8PrepareA
117 export: int8_prepare_a
125 fail_mode: FailOnNegI32
129 # Prepares bias for the Matrix Multiply intrinsic.
131 # It uses the prepared B (which must be obtained by using any of the `int8_prepare_b*` intrinsics) and
132 # a bias input to prepare the final bias.
134 # The final bias can be used as an input to matrix multiply intrinsic (`int8_multiply_and_add_bias`).
136 # 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)
137 # int8_prepare_bias(inputMatrixBPrepared: i32, scaleA: f32, zeroPointA: f32, scaleB: f32, zeroPointB: f32, rowsB: i32, colsB: i32, inputBias: i32, output: i32)
140 name: IntrI8PrepareBias
141 type: Args_Int32_GeneralInt32Float32Float32Float32Float32Int32Int32Int32Int32General
142 entry: intgemm::IntrI8PrepareBias
143 export: int8_prepare_bias
154 fail_mode: FailOnNegI32
158 # Perform multiplication of 2 matrices followed by adding a bias.
160 # i.e Output = inputMatrixAPrepared * inputMatrixBPrepared + inputBiasPrepared
162 # The inputs of this intrinsic must be obtained by using `int8_prepare_A`,
163 # one of the `int8_prepare_b*` and `int8_prepare_bias` intrinsics respectively.
165 # int8_multiply_and_add_bias(const int8_t* inputMatrixAPrepared, float scaleA, float zeroPointA,
166 # const int8_t* inputMatrixBPrepared, float scaleB, float zeroPointB,
167 # const float* inputBiasPrepared, float unquantMultiplier,
168 # uint32_t rowsA, uint32_t width, uint32_t colsB, float* output)
169 # int8_multiply_and_add_bias(inputMatrixAPrepared: i32, scaleA: f32, zeroPointA: f32,
170 # inputMatrixBPrepared: i32, scaleB: f32, zeroPointB: f32,
171 # inputBiasPrepared: i32, unquantMultiplier: f32,
172 # rowsA: i32, width: i32, colsB: i32, output: i32)
173 - op: I8MultiplyAndAddBias
175 name: IntrI8MultiplyAndAddBias
176 type: Args_Int32_GeneralInt32Float32Float32Int32Float32Float32Int32Float32Int32Int32Int32Int32General
177 entry: intgemm::IntrI8MultiplyAndAddBias
178 export: int8_multiply_and_add_bias
192 fail_mode: FailOnNegI32
196 # Select a subset of columns of prepared B.
198 # Indices of the columns to be selected are specified by an array.
200 # 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)
201 # int8_select_columns_of_b(inputMatrixBPrepared: i32, rowsB: i32, colsB: i32, colIndexList: i32, sizeColIndexList: i32, output: i32)
202 - op: I8SelectColumnsOfB
204 name: IntrI8SelectColumnsOfB
205 type: Args_Int32_GeneralInt32Int32Int32Int32Int32Int32General
206 entry: intgemm::IntrI8SelectColumnsOfB
207 export: int8_select_columns_of_b
215 fail_mode: FailOnNegI32
218 #endif // ENABLE_WASM_MOZ_INTGEMM
220 #if defined(ENABLE_WASM_JS_STRING_BUILTINS)
225 type: Args_Int32_GeneralGeneral
226 entry: Instance::stringTest
231 fail_mode: Infallible
238 entry: Instance::stringCast
245 fail_mode: FailOnNullPtr
248 - op: StringFromCharCodeArray
250 name: StringFromCharCodeArray
251 type: Args_General_GeneralGeneralInt32Int32
252 entry: Instance::stringFromCharCodeArray
253 export: fromCharCodeArray
255 - type: "StaticTypeDefs::arrayMutI16"
262 fail_mode: FailOnNullPtr
265 - op: StringIntoCharCodeArray
267 name: StringIntoCharCodeArray
268 type: Args_Int32_GeneralGeneralGeneralInt32
269 entry: Instance::stringIntoCharCodeArray
270 export: intoCharCodeArray
273 - type: "StaticTypeDefs::arrayMutI16"
277 fail_mode: FailOnNegI32
280 - op: StringFromCharCode
282 name: StringFromCharCode
283 type: Args_General_GeneralInt32
284 entry: Instance::stringFromCharCode
289 fail_mode: FailOnNullPtr
292 - op: StringFromCodePoint
294 name: StringFromCodePoint
295 type: Args_General_GeneralInt32
296 entry: Instance::stringFromCodePoint
297 export: fromCodePoint
301 fail_mode: FailOnNullPtr
304 - op: StringCharCodeAt
306 name: StringCharCodeAt
307 type: Args_Int32_GeneralGeneralInt32
308 entry: Instance::stringCharCodeAt
314 fail_mode: FailOnNegI32
317 - op: StringCodePointAt
319 name: StringCodePointAt
320 type: Args_Int32_GeneralGeneralInt32
321 entry: Instance::stringCodePointAt
327 fail_mode: FailOnNegI32
333 type: Args_Int32_GeneralGeneral
334 entry: Instance::stringLength
339 fail_mode: FailOnNegI32
346 entry: Instance::stringConcat
352 fail_mode: FailOnNullPtr
355 - op: StringSubstring
357 name: StringSubstring
358 type: Args_General_GeneralGeneralInt32Int32
359 entry: Instance::stringSubstring
366 fail_mode: FailOnNullPtr
372 type: Args_Int32_GeneralGeneralGeneral
373 entry: Instance::stringEquals
379 fail_mode: FailOnNegI32
385 type: Args_Int32_GeneralGeneralGeneral
386 entry: Instance::stringCompare
392 fail_mode: FailOnMaxI32
395 #endif // ENABLE_WASM_JS_STRING_BUILTINS