tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

WasmBuiltinModule.yaml (14517B)


      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    needs_thunk: false
     13  entry: Instance::intrI8VecMul
     14  export: i8vecmul
     15  params:
     16    - 'i32'
     17    - 'i32'
     18    - 'i32'
     19    - 'i32'
     20  fail_mode: FailOnNegI32
     21  fail_trap: OutOfBounds
     22  uses_memory: true
     23 
     24 #if defined(ENABLE_WASM_MOZ_INTGEMM)
     25 
     26 # Intrinsics for integer matrix multiplication followed by addition of bias.
     27 # Please refer to @TOPSRCDIR/js/src/intgemm/IntegerGemmIntrinsic.h for more details on these intrinsics.
     28 
     29 
     30 # Prepare B for the Matrix Multiply intrinsic from Input matrix B.
     31 #
     32 #  Quantization is performed on the input.
     33 #  The final prepared B is in CPU-dependent format and can be used as an input to matrix multiply
     34 #  intrinsic (`int8_multiply_and_add_bias`).
     35 #
     36 # int8_prepare_b(const float* inputMatrixB, float scale, float zeroPoint, uint32_t rowsB, uint32_t colsB, int8_t* outputMatrixB)
     37 # int8_prepare_b(inputMatrixB: i32, scale: f32, zeroPoint: f32, rowsB: i32, colsB: i32, outputMatrixB: i32)
     38 - op: I8PrepareB
     39  symbolic_address:
     40    name: IntrI8PrepareB
     41    type: Args_Int32_GeneralInt32Float32Float32Int32Int32Int32General
     42    needs_thunk: false
     43  entry: intgemm::IntrI8PrepareB
     44  export: int8_prepare_b
     45  params:
     46    - 'i32'
     47    - 'f32'
     48    - 'f32'
     49    - 'i32'
     50    - 'i32'
     51    - 'i32'
     52  fail_mode: FailOnNegI32
     53  fail_trap: OutOfBounds
     54  uses_memory: true
     55 
     56 
     57 # Prepare B for the Matrix Multiply intrinsic from transposed version of Input matrix B.
     58 #
     59 #  Quantization is performed on floating values of input.
     60 #  The final prepared B is in CPU-dependent format and can be used as an input to matrix multiply
     61 #  intrinsic (`int8_multiply_and_add_bias`).
     62 #
     63 # int8_prepare_b_from_transposed(const float* inputMatrixBTransposed, float scale, float zeroPoint, uint32_t rowsB, uint32_t colsB, int8_t* outputMatrixB)
     64 # int8_prepare_b_from_transposed(inputMatrixBTransposed: i32, scale: f32, zeroPoint: f32, rowsB: i32, colsB: i32, outputMatrixB: i32)
     65 - op: I8PrepareBFromTransposed
     66  symbolic_address:
     67    name: IntrI8PrepareBFromTransposed
     68    type: Args_Int32_GeneralInt32Float32Float32Int32Int32Int32General
     69    needs_thunk: false
     70  entry: intgemm::IntrI8PrepareBFromTransposed
     71  export: int8_prepare_b_from_transposed
     72  params:
     73    - 'i32'
     74    - 'f32'
     75    - 'f32'
     76    - 'i32'
     77    - 'i32'
     78    - 'i32'
     79  fail_mode: FailOnNegI32
     80  fail_trap: OutOfBounds
     81  uses_memory: true
     82 
     83 
     84 # Prepare B for the Matrix Multiply intrinsic from a quantized and transposed version of Input
     85 # matrix B which is also in a CPU-independent format.
     86 #
     87 #  The final prepared B is in CPU-dependent format and can be used as an input to matrix multiply
     88 #  intrinsic (`int8_multiply_and_add_bias`).
     89 #
     90 # int8_prepare_b_from_quantized_transposed(const int8_t* inputMatrixBQuantizedTransposed, uint32_t rowsB, uint32_t colsB, int8_t* outputMatrixB)
     91 # int8_prepare_b_from_quantized_transposed(inputMatrixBQuantizedTransposed: i32, rowsB: i32, colsB: i32, outputMatrixB: i32)
     92 - op: I8PrepareBFromQuantizedTransposed
     93  symbolic_address:
     94    name: IntrI8PrepareBFromQuantizedTransposed
     95    type: Args_Int32_GeneralInt32Int32Int32Int32General
     96    needs_thunk: false
     97  entry: intgemm::IntrI8PrepareBFromQuantizedTransposed
     98  export: int8_prepare_b_from_quantized_transposed
     99  params:
    100    - 'i32'
    101    - 'i32'
    102    - 'i32'
    103    - 'i32'
    104  fail_mode: FailOnNegI32
    105  fail_trap: OutOfBounds
    106  uses_memory: true
    107 
    108 
    109 # Prepare A for the Matrix Multiply intrinsic from Input matrix A.
    110 #
    111 #  It performs quantization on floating values of input.
    112 #  The final prepared A might be architecture dependent. e.g. On some architectures like x86, it
    113 #  might be unsigned (achieved by adding 127 to quantized values) while on others like Arm, it might
    114 #  be signed.
    115 #  The final prepared A can be used as an input to matrix multiply intrinsic
    116 #  (`int8_multiply_and_add_bias`).
    117 #
    118 # int8_prepare_a(const float* inputMatrixA, float scale, float zeroPoint, uint32_t rowsA, uint32_t colsA, uint8_t* outputMatrixA)
    119 # int8_prepare_a(inputMatrixA: i32, scale: f32, zeroPoint: f32, rowsA: i32, colsA: i32, outputMatrixA: i32)
    120 - op: I8PrepareA
    121  symbolic_address:
    122    name: IntrI8PrepareA
    123    type: Args_Int32_GeneralInt32Float32Float32Int32Int32Int32General
    124    needs_thunk: false
    125  entry: intgemm::IntrI8PrepareA
    126  export: int8_prepare_a
    127  params:
    128    - 'i32'
    129    - 'f32'
    130    - 'f32'
    131    - 'i32'
    132    - 'i32'
    133    - 'i32'
    134  fail_mode: FailOnNegI32
    135  fail_trap: OutOfBounds
    136  uses_memory: true
    137 
    138 
    139 # Prepares bias for the Matrix Multiply intrinsic.
    140 #
    141 #  It uses the prepared B (which must be obtained by using any of the `int8_prepare_b*` intrinsics) and
    142 #  a bias input to prepare the final bias.
    143 #
    144 #  The final bias can be used as an input to matrix multiply intrinsic (`int8_multiply_and_add_bias`).
    145 #
    146 # 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)
    147 # int8_prepare_bias(inputMatrixBPrepared: i32, scaleA: f32, zeroPointA: f32, scaleB: f32, zeroPointB: f32, rowsB: i32, colsB: i32, inputBias: i32, output: i32)
    148 - op: I8PrepareBias
    149  symbolic_address:
    150    name: IntrI8PrepareBias
    151    type: Args_Int32_GeneralInt32Float32Float32Float32Float32Int32Int32Int32Int32General
    152    needs_thunk: false
    153  entry: intgemm::IntrI8PrepareBias
    154  export: int8_prepare_bias
    155  params:
    156    - 'i32'
    157    - 'f32'
    158    - 'f32'
    159    - 'f32'
    160    - 'f32'
    161    - 'i32'
    162    - 'i32'
    163    - 'i32'
    164    - 'i32'
    165  fail_mode: FailOnNegI32
    166  fail_trap: OutOfBounds
    167  uses_memory: true
    168 
    169 
    170 # Perform multiplication of 2 matrices followed by adding a bias.
    171 #
    172 #  i.e Output = inputMatrixAPrepared * inputMatrixBPrepared + inputBiasPrepared
    173 #
    174 #  The inputs of this intrinsic must be obtained by using `int8_prepare_A`,
    175 #  one of the `int8_prepare_b*` and `int8_prepare_bias` intrinsics respectively.
    176 #
    177 # int8_multiply_and_add_bias(const uint8_t* inputMatrixAPrepared, float scaleA, float zeroPointA,
    178 #                      const int8_t* inputMatrixBPrepared, float scaleB, float zeroPointB,
    179 #                      const float* inputBiasPrepared, float unquantMultiplier,
    180 #                      uint32_t rowsA, uint32_t width, uint32_t colsB, float* output)
    181 # int8_multiply_and_add_bias(inputMatrixAPrepared: i32, scaleA: f32, zeroPointA: f32,
    182 #                      inputMatrixBPrepared: i32, scaleB: f32, zeroPointB: f32,
    183 #                      inputBiasPrepared: i32, unquantMultiplier: f32,
    184 #                      rowsA: i32, width: i32, colsB: i32, output: i32)
    185 - op: I8MultiplyAndAddBias
    186  symbolic_address:
    187    name: IntrI8MultiplyAndAddBias
    188    type: Args_Int32_GeneralInt32Float32Float32Int32Float32Float32Int32Float32Int32Int32Int32Int32General
    189    needs_thunk: false
    190  entry: intgemm::IntrI8MultiplyAndAddBias
    191  export: int8_multiply_and_add_bias
    192  params:
    193    - 'i32'
    194    - 'f32'
    195    - 'f32'
    196    - 'i32'
    197    - 'f32'
    198    - 'f32'
    199    - 'i32'
    200    - 'f32'
    201    - 'i32'
    202    - 'i32'
    203    - 'i32'
    204    - 'i32'
    205  fail_mode: FailOnNegI32
    206  fail_trap: OutOfBounds
    207  uses_memory: true
    208 
    209 
    210 # Select a subset of columns of prepared B.
    211 #
    212 #  Indices of the columns to be selected are specified by an array.
    213 #
    214 # 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)
    215 # int8_select_columns_of_b(inputMatrixBPrepared: i32, rowsB: i32, colsB: i32, colIndexList: i32, sizeColIndexList: i32, output: i32)
    216 - op: I8SelectColumnsOfB
    217  symbolic_address:
    218    name: IntrI8SelectColumnsOfB
    219    type: Args_Int32_GeneralInt32Int32Int32Int32Int32Int32General
    220    needs_thunk: false
    221  entry: intgemm::IntrI8SelectColumnsOfB
    222  export: int8_select_columns_of_b
    223  params:
    224    - 'i32'
    225    - 'i32'
    226    - 'i32'
    227    - 'i32'
    228    - 'i32'
    229    - 'i32'
    230  fail_mode: FailOnNegI32
    231  fail_trap: OutOfBounds
    232  uses_memory: true
    233 
    234 #endif // ENABLE_WASM_MOZ_INTGEMM
    235 
    236 - op: StringTest
    237  symbolic_address:
    238    name: StringTest
    239    type: Args_Int32_GeneralGeneral
    240    needs_thunk: true
    241  entry: Instance::stringTest
    242  inline_op: StringTest
    243  export: test
    244  params:
    245    - 'externref'
    246  result: 'i32'
    247  fail_mode: Infallible
    248  uses_memory: false
    249 
    250 - op: StringCast
    251  symbolic_address:
    252    name: StringCast
    253    type: Args_General2
    254    needs_thunk: true
    255  entry: Instance::stringCast
    256  inline_op: StringCast
    257  export: cast
    258  params:
    259    - 'externref'
    260  result:
    261    code: 'extern'
    262    nullable: false
    263  fail_mode: FailOnNullPtr
    264  uses_memory: false
    265 
    266 - op: StringFromCharCodeArray
    267  symbolic_address:
    268    name: StringFromCharCodeArray
    269    type: Args_General_GeneralGeneralInt32Int32
    270    needs_thunk: true
    271  entry: Instance::stringFromCharCodeArray
    272  export: fromCharCodeArray
    273  params:
    274    - type: "StaticTypeDefs::arrayMutI16"
    275      nullable: true
    276    - 'i32'
    277    - 'i32'
    278  result:
    279    code: 'extern'
    280    nullable: false
    281  fail_mode: FailOnNullPtr
    282  uses_memory: false
    283 
    284 - op: StringIntoCharCodeArray
    285  symbolic_address:
    286    name: StringIntoCharCodeArray
    287    type: Args_Int32_GeneralGeneralGeneralInt32
    288    needs_thunk: true
    289  entry: Instance::stringIntoCharCodeArray
    290  export: intoCharCodeArray
    291  params:
    292    - 'externref'
    293    - type: "StaticTypeDefs::arrayMutI16"
    294      nullable: true
    295    - 'i32'
    296  result: 'i32'
    297  fail_mode: FailOnNegI32
    298  uses_memory: false
    299 
    300 - op: StringFromCharCode
    301  symbolic_address:
    302    name: StringFromCharCode
    303    type: Args_General_GeneralInt32
    304    needs_thunk: true
    305  entry: Instance::stringFromCharCode
    306  export: fromCharCode
    307  params:
    308    - 'i32'
    309  result:
    310    code: 'extern'
    311    nullable: false
    312  fail_mode: FailOnNullPtr
    313  uses_memory: false
    314 
    315 - op: StringFromCodePoint
    316  symbolic_address:
    317    name: StringFromCodePoint
    318    type: Args_General_GeneralInt32
    319    needs_thunk: true
    320  entry: Instance::stringFromCodePoint
    321  export: fromCodePoint
    322  params:
    323    - 'i32'
    324  result:
    325    code: 'extern'
    326    nullable: false
    327  fail_mode: FailOnNullPtr
    328  uses_memory: false
    329 
    330 - op: StringCharCodeAt
    331  symbolic_address:
    332    name: StringCharCodeAt
    333    type: Args_Int32_GeneralGeneralInt32
    334    needs_thunk: true
    335  entry: Instance::stringCharCodeAt
    336  export: charCodeAt
    337  params:
    338    - 'externref'
    339    - 'i32'
    340  result: 'i32'
    341  fail_mode: FailOnNegI32
    342  uses_memory: false
    343 
    344 - op: StringCodePointAt
    345  symbolic_address:
    346    name: StringCodePointAt
    347    type: Args_Int32_GeneralGeneralInt32
    348    needs_thunk: true
    349  entry: Instance::stringCodePointAt
    350  export: codePointAt
    351  params:
    352    - 'externref'
    353    - 'i32'
    354  result: 'i32'
    355  fail_mode: FailOnNegI32
    356  uses_memory: false
    357 
    358 - op: StringLength
    359  symbolic_address:
    360    name: StringLength
    361    type: Args_Int32_GeneralGeneral
    362    needs_thunk: true
    363  entry: Instance::stringLength
    364  inline_op: StringLength
    365  export: length
    366  params:
    367    - 'externref'
    368  result: 'i32'
    369  fail_mode: FailOnNegI32
    370  uses_memory: false
    371 
    372 - op: StringConcat
    373  symbolic_address:
    374    name: StringConcat
    375    type: Args_General3
    376    needs_thunk: true
    377  entry: Instance::stringConcat
    378  export: concat
    379  params:
    380    - 'externref'
    381    - 'externref'
    382  result:
    383    code: 'extern'
    384    nullable: false
    385  fail_mode: FailOnNullPtr
    386  uses_memory: false
    387 
    388 - op: StringSubstring
    389  symbolic_address:
    390    name: StringSubstring
    391    type: Args_General_GeneralGeneralInt32Int32
    392    needs_thunk: true
    393  entry: Instance::stringSubstring
    394  export: substring
    395  params:
    396    - 'externref'
    397    - 'i32'
    398    - 'i32'
    399  result:
    400    code: 'extern'
    401    nullable: false
    402  fail_mode: FailOnNullPtr
    403  uses_memory: false
    404 
    405 - op: StringEquals
    406  symbolic_address:
    407    name: StringEquals
    408    type: Args_Int32_GeneralGeneralGeneral
    409    needs_thunk: true
    410  entry: Instance::stringEquals
    411  export: equals
    412  params:
    413    - 'externref'
    414    - 'externref'
    415  result: 'i32'
    416  fail_mode: FailOnNegI32
    417  uses_memory: false
    418 
    419 - op: StringCompare
    420  symbolic_address:
    421    name: StringCompare
    422    type: Args_Int32_GeneralGeneralGeneral
    423    needs_thunk: true
    424  entry: Instance::stringCompare
    425  export: compare
    426  params:
    427    - 'externref'
    428    - 'externref'
    429  result: 'i32'
    430  fail_mode: FailOnMaxI32
    431  uses_memory: false
    432 
    433 #if defined(ENABLE_WASM_JSPI)
    434 
    435 - op: CreateSuspender
    436  symbolic_address:
    437    name: CreateSuspender
    438    type: Args_General_GeneralInt32
    439    needs_thunk: true
    440  entry: CreateSuspender
    441  export: createSuspender
    442  params:
    443    - 'i32'
    444  result: 'externref'
    445  fail_mode: FailOnNullPtr
    446  uses_memory: false
    447 
    448 - op: CreatePromisingPromise
    449  symbolic_address:
    450    name: CreatePromisingPromise
    451    type: Args_General2
    452    needs_thunk: true
    453  entry: CreatePromisingPromise
    454  export: createPromisingPromise
    455  params:
    456    - 'externref'
    457  result: 'externref'
    458  fail_mode: FailOnNullPtr
    459  uses_memory: false
    460 
    461 - op: CurrentSuspender
    462  symbolic_address:
    463    name: CurrentSuspender
    464    type: Args_General_GeneralInt32
    465    needs_thunk: true
    466  entry: CurrentSuspender
    467  export: currentSuspender
    468  params:
    469    - 'i32'
    470  result: 'externref'
    471  fail_mode: FailOnNullPtr
    472  uses_memory: false
    473 
    474 - op: GetSuspendingPromiseResult
    475  symbolic_address:
    476    name: GetSuspendingPromiseResult
    477    type: Args_General3
    478    needs_thunk: true
    479  entry: GetSuspendingPromiseResult
    480  export: getSuspendingPromiseResult
    481  params:
    482    - 'externref'
    483    - 'externref'
    484  result: 'anyref'
    485  fail_mode: FailOnNullPtr
    486  uses_memory: false
    487 
    488 - op: AddPromiseReactions
    489  symbolic_address:
    490    name: AddPromiseReactions
    491    type: Args_General4
    492    needs_thunk: true
    493  entry: AddPromiseReactions
    494  export: addPromiseReactions
    495  params:
    496    - 'externref'
    497    - 'externref'
    498    - 'funcref'
    499  result: 'anyref'
    500  fail_mode: FailOnInvalidRef
    501  uses_memory: false
    502 
    503 - op: ForwardExceptionToSuspended
    504  symbolic_address:
    505    name: ForwardExceptionToSuspended
    506    type: Args_General3
    507    needs_thunk: true
    508  entry: ForwardExceptionToSuspended
    509  export: forwardExceptionToSuspended
    510  params:
    511    - 'externref'
    512    - 'exnref'
    513  result: 'anyref'
    514  fail_mode: Infallible
    515  uses_memory: false
    516 
    517 - op: SetPromisingPromiseResults
    518  symbolic_address:
    519    name: SetPromisingPromiseResults
    520    type: Args_Int32_GeneralGeneralGeneral
    521    needs_thunk: true
    522  entry: SetPromisingPromiseResults
    523  export: setPromisingPromiseResults
    524  params:
    525    - 'externref'
    526    - 'anyref'
    527  fail_mode: FailOnNegI32
    528  uses_memory: false
    529 
    530 #endif // ENABLE_WASM_JSPI