| # springbok_modules() |
| # |
| # A wrapper for the springbok_bytecode_module and springbok_c_module to apply common iree-compile flags |
| # Parameters: |
| # NAME: Name of target. |
| # SRC: Source file to compile into a bytecode module. Support relative path. |
| # FLAGS: Flags to pass to the translation tool (list of strings). |
| # C_IDENTIFIER: Identifier to use for generate c embed code. |
| # If omitted then no C embed code will be generated. |
| # RVV_OFF: Indicate RVV is OFF (default: ON) |
| # VMVX: Compile VMVX backend |
| # INLINE_HAL: Use inline HAL. |
| # |
| # Examples: |
| # springbok_modules( |
| # NAME |
| # dare_devel |
| # SRC |
| # "daredevil_quant.tflite" |
| # C_IDENTIFIER |
| # "daredevil_bytecode_module_static" |
| # FLAGS |
| # "-iree-input-type=tosa" |
| # ) |
| # |
| # springbok_modules( |
| # NAME |
| # simple_float_mul |
| # SRC |
| # "simple_float_mul.mlir" |
| # C_IDENTIFIER |
| # "simple_float_mul" |
| # FLAGS |
| # "-iree-input-type=mhlo" |
| # RVV_OFF |
| # PUBLIC |
| # ) |
| # |
| |
| function(springbok_modules) |
| cmake_parse_arguments( |
| _RULE |
| "PUBLIC;RVV_OFF;VMVX;INLINE_HAL" |
| "NAME;SRC;C_IDENTIFIER" |
| "FLAGS" |
| ${ARGN} |
| ) |
| |
| if (${_RULE_RVV_OFF}) |
| set(_RVV_OFF_ARG "RVV_OFF") |
| endif() |
| |
| if (${_RULE_INLINE_HAL}) |
| set(_INLINE_HAL_ARG "INLINE_HAL") |
| endif() |
| |
| springbok_static_module( |
| NAME |
| "${_RULE_NAME}_bytecode_module_static" |
| SRC |
| "${_RULE_SRC}" |
| C_IDENTIFIER |
| "${_RULE_C_IDENTIFIER}_bytecode_module_static" |
| FLAGS |
| "${_RULE_FLAGS}" |
| "${_RVV_OFF_ARG}" |
| "${_INLINE_HAL_ARG}" |
| ) |
| |
| springbok_static_module( |
| NAME |
| "${_RULE_NAME}_c_module_static" |
| SRC |
| "${_RULE_SRC}" |
| FLAGS |
| "${_RULE_FLAGS}" |
| "${_RVV_OFF_ARG}" |
| EMITC |
| ) |
| |
| if (${_RULE_VMVX}) |
| springbok_vmvx_module( |
| NAME |
| "${_RULE_NAME}_bytecode_module_vmvx" |
| SRC |
| "${_RULE_SRC}" |
| C_IDENTIFIER |
| "${_RULE_C_IDENTIFIER}_bytecode_module_vmvx" |
| FLAGS |
| "${_RULE_FLAGS}" |
| "${_INLINE_HAL_ARG}" |
| ) |
| |
| springbok_vmvx_module( |
| NAME |
| "${_RULE_NAME}_c_module_vmvx" |
| SRC |
| "${_RULE_SRC}" |
| FLAGS |
| "${_RULE_FLAGS}" |
| EMITC |
| ) |
| endif() |
| |
| endfunction() |