Backed out changeset 2450366cf7ca (bug 1891629) for causing win msix mochitest failures
[gecko.git] / js / src / wasm / WasmBuiltinModule.yaml
blob755e0e5e74aec9f6ebe66dc63b4641b0c2315fd4
1 # The file contains information need to define wasm builtin module funcs
2 # operations.
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.
8 - op: I8VecMul
9   symbolic_address:
10     name: IntrI8VecMul
11     type: Args_Int32_GeneralInt32Int32Int32Int32General
12   entry: Instance::intrI8VecMul
13   export: i8vecmul
14   params:
15     - 'i32'
16     - 'i32'
17     - 'i32'
18     - 'i32'
19   fail_mode: FailOnNegI32
20   uses_memory: true
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)
36 - op: I8PrepareB
37   symbolic_address:
38     name: IntrI8PrepareB
39     type: Args_Int32_GeneralInt32Float32Float32Int32Int32Int32General
40   entry: intgemm::IntrI8PrepareB
41   export: int8_prepare_b
42   params:
43     - 'i32'
44     - 'f32'
45     - 'f32'
46     - 'i32'
47     - 'i32'
48     - 'i32'
49   fail_mode: FailOnNegI32
50   uses_memory: true
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
62   symbolic_address:
63     name: IntrI8PrepareBFromTransposed
64     type: Args_Int32_GeneralInt32Float32Float32Int32Int32Int32General
65   entry: intgemm::IntrI8PrepareBFromTransposed
66   export: int8_prepare_b_from_transposed
67   params:
68     - 'i32'
69     - 'f32'
70     - 'f32'
71     - 'i32'
72     - 'i32'
73     - 'i32'
74   fail_mode: FailOnNegI32
75   uses_memory: true
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
87   symbolic_address:
88     name: IntrI8PrepareBFromQuantizedTransposed
89     type: Args_Int32_GeneralInt32Int32Int32Int32General
90   entry: intgemm::IntrI8PrepareBFromQuantizedTransposed
91   export: int8_prepare_b_from_quantized_transposed
92   params:
93     - 'i32'
94     - 'i32'
95     - 'i32'
96     - 'i32'
97   fail_mode: FailOnNegI32
98   uses_memory: true
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
106 #  be signed.
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)
112 - op: I8PrepareA
113   symbolic_address:
114     name: IntrI8PrepareA
115     type: Args_Int32_GeneralInt32Float32Float32Int32Int32Int32General
116   entry: intgemm::IntrI8PrepareA
117   export: int8_prepare_a
118   params:
119     - 'i32'
120     - 'f32'
121     - 'f32'
122     - 'i32'
123     - 'i32'
124     - 'i32'
125   fail_mode: FailOnNegI32
126   uses_memory: true
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)
138 - op: I8PrepareBias
139   symbolic_address:
140     name: IntrI8PrepareBias
141     type: Args_Int32_GeneralInt32Float32Float32Float32Float32Int32Int32Int32Int32General
142   entry: intgemm::IntrI8PrepareBias
143   export: int8_prepare_bias
144   params:
145     - 'i32'
146     - 'f32'
147     - 'f32'
148     - 'f32'
149     - 'f32'
150     - 'i32'
151     - 'i32'
152     - 'i32'
153     - 'i32'
154   fail_mode: FailOnNegI32
155   uses_memory: true
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
174   symbolic_address:
175     name: IntrI8MultiplyAndAddBias
176     type: Args_Int32_GeneralInt32Float32Float32Int32Float32Float32Int32Float32Int32Int32Int32Int32General
177   entry: intgemm::IntrI8MultiplyAndAddBias
178   export: int8_multiply_and_add_bias
179   params:
180     - 'i32'
181     - 'f32'
182     - 'f32'
183     - 'i32'
184     - 'f32'
185     - 'f32'
186     - 'i32'
187     - 'f32'
188     - 'i32'
189     - 'i32'
190     - 'i32'
191     - 'i32'
192   fail_mode: FailOnNegI32
193   uses_memory: true
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
203   symbolic_address:
204     name: IntrI8SelectColumnsOfB
205     type: Args_Int32_GeneralInt32Int32Int32Int32Int32Int32General
206   entry: intgemm::IntrI8SelectColumnsOfB
207   export: int8_select_columns_of_b
208   params:
209     - 'i32'
210     - 'i32'
211     - 'i32'
212     - 'i32'
213     - 'i32'
214     - 'i32'
215   fail_mode: FailOnNegI32
216   uses_memory: true
218 #endif // ENABLE_WASM_MOZ_INTGEMM
220 #if defined(ENABLE_WASM_JS_STRING_BUILTINS)
222 - op: StringTest
223   symbolic_address:
224     name: StringTest
225     type: Args_Int32_GeneralGeneral
226   entry: Instance::stringTest
227   export: test
228   params:
229     - 'externref'
230   result: 'i32'
231   fail_mode: Infallible
232   uses_memory: false
234 - op: StringCast
235   symbolic_address:
236     name: StringCast
237     type: Args_General2
238   entry: Instance::stringCast
239   export: cast
240   params:
241     - 'externref'
242   result:
243     code: 'extern'
244     nullable: false
245   fail_mode: FailOnNullPtr
246   uses_memory: false
248 - op: StringFromCharCodeArray
249   symbolic_address:
250     name: StringFromCharCodeArray
251     type: Args_General_GeneralGeneralInt32Int32
252   entry: Instance::stringFromCharCodeArray
253   export: fromCharCodeArray
254   params:
255     - type: "StaticTypeDefs::arrayMutI16"
256       nullable: true
257     - 'i32'
258     - 'i32'
259   result:
260     code: 'extern'
261     nullable: false
262   fail_mode: FailOnNullPtr
263   uses_memory: false
265 - op: StringIntoCharCodeArray
266   symbolic_address:
267     name: StringIntoCharCodeArray
268     type: Args_Int32_GeneralGeneralGeneralInt32
269   entry: Instance::stringIntoCharCodeArray
270   export: intoCharCodeArray
271   params:
272     - 'externref'
273     - type: "StaticTypeDefs::arrayMutI16"
274       nullable: true
275     - 'i32'
276   result: 'i32'
277   fail_mode: FailOnNegI32
278   uses_memory: false
280 - op: StringFromCharCode
281   symbolic_address:
282     name: StringFromCharCode
283     type: Args_General_GeneralInt32
284   entry: Instance::stringFromCharCode
285   export: fromCharCode
286   params:
287     - 'i32'
288   result: 'externref'
289   fail_mode: FailOnNullPtr
290   uses_memory: false
292 - op: StringFromCodePoint
293   symbolic_address:
294     name: StringFromCodePoint
295     type: Args_General_GeneralInt32
296   entry: Instance::stringFromCodePoint
297   export: fromCodePoint
298   params:
299     - 'i32'
300   result: 'externref'
301   fail_mode: FailOnNullPtr
302   uses_memory: false
304 - op: StringCharCodeAt
305   symbolic_address:
306     name: StringCharCodeAt
307     type: Args_Int32_GeneralGeneralInt32
308   entry: Instance::stringCharCodeAt
309   export: charCodeAt
310   params:
311     - 'externref'
312     - 'i32'
313   result: 'i32'
314   fail_mode: FailOnNegI32
315   uses_memory: false
317 - op: StringCodePointAt
318   symbolic_address:
319     name: StringCodePointAt
320     type: Args_Int32_GeneralGeneralInt32
321   entry: Instance::stringCodePointAt
322   export: codePointAt
323   params:
324     - 'externref'
325     - 'i32'
326   result: 'i32'
327   fail_mode: FailOnNegI32
328   uses_memory: false
330 - op: StringLength
331   symbolic_address:
332     name: StringLength
333     type: Args_Int32_GeneralGeneral
334   entry: Instance::stringLength
335   export: length
336   params:
337     - 'externref'
338   result: 'i32'
339   fail_mode: FailOnNegI32
340   uses_memory: false
342 - op: StringConcat
343   symbolic_address:
344     name: StringConcat
345     type: Args_General3
346   entry: Instance::stringConcat
347   export: concat
348   params:
349     - 'externref'
350     - 'externref'
351   result: 'externref'
352   fail_mode: FailOnNullPtr
353   uses_memory: false
355 - op: StringSubstring
356   symbolic_address:
357     name: StringSubstring
358     type: Args_General_GeneralGeneralInt32Int32
359   entry: Instance::stringSubstring
360   export: substring
361   params:
362     - 'externref'
363     - 'i32'
364     - 'i32'
365   result: 'externref'
366   fail_mode: FailOnNullPtr
367   uses_memory: false
369 - op: StringEquals
370   symbolic_address:
371     name: StringEquals
372     type: Args_Int32_GeneralGeneralGeneral
373   entry: Instance::stringEquals
374   export: equals
375   params:
376     - 'externref'
377     - 'externref'
378   result: 'i32'
379   fail_mode: FailOnNegI32
380   uses_memory: false
382 - op: StringCompare
383   symbolic_address:
384     name: StringCompare
385     type: Args_Int32_GeneralGeneralGeneral
386   entry: Instance::stringCompare
387   export: compare
388   params:
389     - 'externref'
390     - 'externref'
391   result: 'i32'
392   fail_mode: FailOnMaxI32
393   uses_memory: false
395 #endif // ENABLE_WASM_JS_STRING_BUILTINS