Debian Codegraph @

js/src/wasm/WasmBuiltinModule.yaml

raw
1 # The file contains information need to define wasm builtin module funcs
2 # operations.
3
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
21
22 #if defined(ENABLE_WASM_MOZ_INTGEMM)
23
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.
26
27
28 # Prepare B for the Matrix Multiply intrinsic from Input matrix B.
29 #
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`).
33 #
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
51
52
53 # Prepare B for the Matrix Multiply intrinsic from transposed version of Input matrix B.
54 #
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`).
58 #
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
76
77
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.
80 #
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`).
83 #
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
99
100
101 # Prepare A for the Matrix Multiply intrinsic from Input matrix A.
102 #
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`).
109 #
110 # int8_prepare_a(const float* inputMatrixA, float scale, float zeroPoint, uint32_t rowsA, uint32_t colsA, uint8_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
127
128
129 # Prepares bias for the Matrix Multiply intrinsic.
130 #
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.
133 #
134 # The final bias can be used as an input to matrix multiply intrinsic (`int8_multiply_and_add_bias`).
135 #
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
156
157
158 # Perform multiplication of 2 matrices followed by adding a bias.
159 #
160 # i.e Output = inputMatrixAPrepared * inputMatrixBPrepared + inputBiasPrepared
161 #
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.
164 #
165 # int8_multiply_and_add_bias(const uint8_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
194
195
196 # Select a subset of columns of prepared B.
197 #
198 # Indices of the columns to be selected are specified by an array.
199 #
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
217
218 #endif // ENABLE_WASM_MOZ_INTGEMM
219
220 #if defined(ENABLE_WASM_JS_STRING_BUILTINS)
221
222 - op: StringTest
223 symbolic_address:
224 name: StringTest
225 type: Args_Int32_GeneralGeneral
226 entry: Instance::stringTest
227 inline_op: StringTest
228 export: test
229 params:
230 - 'externref'
231 result: 'i32'
232 fail_mode: Infallible
233 uses_memory: false
234
235 - op: StringCast
236 symbolic_address:
237 name: StringCast
238 type: Args_General2
239 entry: Instance::stringCast
240 inline_op: StringCast
241 export: cast
242 params:
243 - 'externref'
244 result:
245 code: 'extern'
246 nullable: false
247 fail_mode: FailOnNullPtr
248 uses_memory: false
249
250 - op: StringFromCharCodeArray
251 symbolic_address:
252 name: StringFromCharCodeArray
253 type: Args_General_GeneralGeneralInt32Int32
254 entry: Instance::stringFromCharCodeArray
255 export: fromCharCodeArray
256 params:
257 - type: "StaticTypeDefs::arrayMutI16"
258 nullable: true
259 - 'i32'
260 - 'i32'
261 result:
262 code: 'extern'
263 nullable: false
264 fail_mode: FailOnNullPtr
265 uses_memory: false
266
267 - op: StringIntoCharCodeArray
268 symbolic_address:
269 name: StringIntoCharCodeArray
270 type: Args_Int32_GeneralGeneralGeneralInt32
271 entry: Instance::stringIntoCharCodeArray
272 export: intoCharCodeArray
273 params:
274 - 'externref'
275 - type: "StaticTypeDefs::arrayMutI16"
276 nullable: true
277 - 'i32'
278 result: 'i32'
279 fail_mode: FailOnNegI32
280 uses_memory: false
281
282 - op: StringFromCharCode
283 symbolic_address:
284 name: StringFromCharCode
285 type: Args_General_GeneralInt32
286 entry: Instance::stringFromCharCode
287 export: fromCharCode
288 params:
289 - 'i32'
290 result:
291 code: 'extern'
292 nullable: false
293 fail_mode: FailOnNullPtr
294 uses_memory: false
295
296 - op: StringFromCodePoint
297 symbolic_address:
298 name: StringFromCodePoint
299 type: Args_General_GeneralInt32
300 entry: Instance::stringFromCodePoint
301 export: fromCodePoint
302 params:
303 - 'i32'
304 result:
305 code: 'extern'
306 nullable: false
307 fail_mode: FailOnNullPtr
308 uses_memory: false
309
310 - op: StringCharCodeAt
311 symbolic_address:
312 name: StringCharCodeAt
313 type: Args_Int32_GeneralGeneralInt32
314 entry: Instance::stringCharCodeAt
315 export: charCodeAt
316 params:
317 - 'externref'
318 - 'i32'
319 result: 'i32'
320 fail_mode: FailOnNegI32
321 uses_memory: false
322
323 - op: StringCodePointAt
324 symbolic_address:
325 name: StringCodePointAt
326 type: Args_Int32_GeneralGeneralInt32
327 entry: Instance::stringCodePointAt
328 export: codePointAt
329 params:
330 - 'externref'
331 - 'i32'
332 result: 'i32'
333 fail_mode: FailOnNegI32
334 uses_memory: false
335
336 - op: StringLength
337 symbolic_address:
338 name: StringLength
339 type: Args_Int32_GeneralGeneral
340 entry: Instance::stringLength
341 inline_op: StringLength
342 export: length
343 params:
344 - 'externref'
345 result: 'i32'
346 fail_mode: FailOnNegI32
347 uses_memory: false
348
349 - op: StringConcat
350 symbolic_address:
351 name: StringConcat
352 type: Args_General3
353 entry: Instance::stringConcat
354 export: concat
355 params:
356 - 'externref'
357 - 'externref'
358 result:
359 code: 'extern'
360 nullable: false
361 fail_mode: FailOnNullPtr
362 uses_memory: false
363
364 - op: StringSubstring
365 symbolic_address:
366 name: StringSubstring
367 type: Args_General_GeneralGeneralInt32Int32
368 entry: Instance::stringSubstring
369 export: substring
370 params:
371 - 'externref'
372 - 'i32'
373 - 'i32'
374 result:
375 code: 'extern'
376 nullable: false
377 fail_mode: FailOnNullPtr
378 uses_memory: false
379
380 - op: StringEquals
381 symbolic_address:
382 name: StringEquals
383 type: Args_Int32_GeneralGeneralGeneral
384 entry: Instance::stringEquals
385 export: equals
386 params:
387 - 'externref'
388 - 'externref'
389 result: 'i32'
390 fail_mode: FailOnNegI32
391 uses_memory: false
392
393 - op: StringCompare
394 symbolic_address:
395 name: StringCompare
396 type: Args_Int32_GeneralGeneralGeneral
397 entry: Instance::stringCompare
398 export: compare
399 params:
400 - 'externref'
401 - 'externref'
402 result: 'i32'
403 fail_mode: FailOnMaxI32
404 uses_memory: false
405
406 #endif // ENABLE_WASM_JS_STRING_BUILTINS
407
408 #if defined(ENABLE_WASM_JSPI)
409
410 - op: CreateSuspender
411 symbolic_address:
412 name: CreateSuspender
413 type: Args_General_GeneralInt32
414 entry: CreateSuspender
415 export: createSuspender
416 params:
417 - 'i32'
418 result: 'externref'
419 fail_mode: FailOnNullPtr
420 uses_memory: false
421
422 - op: CreatePromisingPromise
423 symbolic_address:
424 name: CreatePromisingPromise
425 type: Args_General2
426 entry: CreatePromisingPromise
427 export: createPromisingPromise
428 params:
429 - 'externref'
430 result: 'externref'
431 fail_mode: FailOnNullPtr
432 uses_memory: false
433
434 - op: CurrentSuspender
435 symbolic_address:
436 name: CurrentSuspender
437 type: Args_General_GeneralInt32
438 entry: CurrentSuspender
439 export: currentSuspender
440 params:
441 - 'i32'
442 result: 'externref'
443 fail_mode: FailOnNullPtr
444 uses_memory: false
445
446 - op: GetSuspendingPromiseResult
447 symbolic_address:
448 name: GetSuspendingPromiseResult
449 type: Args_General3
450 entry: GetSuspendingPromiseResult
451 export: getSuspendingPromiseResult
452 params:
453 - 'externref'
454 - 'externref'
455 result: 'anyref'
456 fail_mode: FailOnNullPtr
457 uses_memory: false
458
459 - op: AddPromiseReactions
460 symbolic_address:
461 name: AddPromiseReactions
462 type: Args_General4
463 entry: AddPromiseReactions
464 export: addPromiseReactions
465 params:
466 - 'externref'
467 - 'externref'
468 - 'funcref'
469 result: 'anyref'
470 fail_mode: FailOnInvalidRef
471 uses_memory: false
472
473 - op: ForwardExceptionToSuspended
474 symbolic_address:
475 name: ForwardExceptionToSuspended
476 type: Args_General3
477 entry: ForwardExceptionToSuspended
478 export: forwardExceptionToSuspended
479 params:
480 - 'externref'
481 - 'exnref'
482 result: 'anyref'
483 fail_mode: Infallible
484 uses_memory: false
485
486 - op: SetPromisingPromiseResults
487 symbolic_address:
488 name: SetPromisingPromiseResults
489 type: Args_Int32_GeneralGeneralGeneral
490 entry: SetPromisingPromiseResults
491 export: setPromisingPromiseResults
492 params:
493 - 'externref'
494 - 'anyref'
495 fail_mode: FailOnNegI32
496 uses_memory: false
497
498 #endif // ENABLE_WASM_JSPI