Skip to content

Intrinsic for example subincacc instruction #338

Intrinsic for example subincacc instruction

Intrinsic for example subincacc instruction #338

Triggered via push September 13, 2024 10:40
Status Success
Total duration 21s
Artifacts

style.yml

on: push
Run linters
9s
Run linters
Check for License headers
4s
Check for License headers
Fit to window
Zoom out
Zoom in

Annotations

30 errors and 1 warning
/home/runner/work/seal5/seal5/seal5/backends/riscv_intrinsics/writer.py#L25
def ir_type_to_text(ir_type: str): # needs fleshing out with all likely types # probably needs to take into account RISC-V bit width, e.g. does "Li" means 32 bit integer on a 128-bit platform? - if ir_type == 'i32': - return 'Li' + if ir_type == "i32": + return "Li" raise NotImplementedError(f'Unhandled ir_type "{ir_type}"') def build_target(arch: str, intrinsic: IntrinsicDefn): # Target couples intrinsic name to argument types and function behaviour # Start with return type if not void - arg_str = '' + arg_str = "" if intrinsic.ret_type: arg_str += ir_type_to_text(intrinsic.ret_type) for arg in intrinsic.args: arg_str += ir_type_to_text(arg.arg_type)
seal5/backends/riscv_instr_info/writer.py#L23
'seal5.settings.ExtensionsSettings' imported but unused (F401)
/home/runner/work/seal5/seal5/seal5/backends/riscv_intrinsics/writer.py#L46
return target def ir_type_to_pattern(ir_type: str): # needs fleshing out with all likely types - if ir_type == 'i32': - return 'llvm_i32_ty' + if ir_type == "i32": + return "llvm_i32_ty" raise NotImplementedError(f'Unhandled ir_type "{ir_type}"') def build_attr(arch: str, intrinsic: IntrinsicDefn): uses_mem = False # @todo - attr = f' def int_riscv_{intrinsic.intrinsic_name} : Intrinsic<\n [' + attr = f" def int_riscv_{intrinsic.intrinsic_name} : Intrinsic<\n [" if intrinsic.ret_type: - attr += f'{ir_type_to_pattern(intrinsic.ret_type)}' - attr += '],\n [' + attr += f"{ir_type_to_pattern(intrinsic.ret_type)}" + attr += "],\n [" for idx, arg in enumerate(intrinsic.args): if idx: - attr += ', ' + attr += ", " attr += ir_type_to_pattern(arg.arg_type) - attr += '],\n' - attr += ' [IntrNoMem, IntrSpeculatable, IntrWillReturn]>;' + attr += "],\n" + attr += " [IntrNoMem, IntrSpeculatable, IntrWillReturn]>;" return attr def build_emit(arch: str, intrinsic: IntrinsicDefn): - emit = (f' case RISCV::BI__builtin_{arch}_{intrinsic.intrinsic_name}:\n' - f' ID = Intrinsic::riscv_{intrinsic.intrinsic_name};\n' - f' break;') + emit = ( + f" case RISCV::BI__builtin_{arch}_{intrinsic.intrinsic_name}:\n" + f" ID = Intrinsic::riscv_{intrinsic.intrinsic_name};\n" + f" break;" + ) return emit @DataClass class PatchFrag: """Pairs patch contents to location to apply it""" + patchee: str tag: str contents: str = ""
seal5/backends/riscv_instr_info/writer.py#L224
Expected 2 blank lines, found 1 (E302)
/home/runner/work/seal5/seal5/seal5/backends/riscv_intrinsics/writer.py#L157
if settings: llvm_settings = settings.llvm if llvm_settings: llvm_state = llvm_settings.state if llvm_state: - llvm_version = llvm_state.version # unused today, but needed very soon + llvm_version = llvm_state.version # unused today, but needed very soon patch_frags = { - 'target': PatchFrag(patchee='clang/include/clang/Basic/BuiltinsRISCV.def', tag='builtins_riscv'), - 'attr': PatchFrag(patchee='llvm/include/llvm/IR/IntrinsicsRISCV.td', tag='intrinsics_riscv'), - 'emit': PatchFrag(patchee='clang/lib/CodeGen/CGBuiltin.cpp', tag='cg_builtin') - } + "target": PatchFrag(patchee="clang/include/clang/Basic/BuiltinsRISCV.def", tag="builtins_riscv"), + "attr": PatchFrag(patchee="llvm/include/llvm/IR/IntrinsicsRISCV.td", tag="intrinsics_riscv"), + "emit": PatchFrag(patchee="clang/lib/CodeGen/CGBuiltin.cpp", tag="cg_builtin"), + } for set_name, set_def in model["sets"].items(): artifacts[set_name] = [] metrics["n_sets"] += 1 ext_settings = set_def.settings if ext_settings is None: metrics["n_skipped"] += 1 continue for intrinsic in settings.intrinsics.intrinsics: metrics["n_success"] += 1 - patch_frags['target'].contents += build_target(arch=ext_settings.get_arch(), intrinsic=intrinsic) - patch_frags['attr'].contents += build_attr(arch=ext_settings.get_arch(), intrinsic=intrinsic) - patch_frags['emit'].contents += build_emit(arch=ext_settings.get_arch(), intrinsic=intrinsic) + patch_frags["target"].contents += build_target(arch=ext_settings.get_arch(), intrinsic=intrinsic) + patch_frags["attr"].contents += build_attr(arch=ext_settings.get_arch(), intrinsic=intrinsic) + patch_frags["emit"].contents += build_emit(arch=ext_settings.get_arch(), intrinsic=intrinsic) for id, frag in patch_frags.items(): contents = frag.contents if len(contents) > 0: - if id == 'target': - contents = f'// {ext_settings.get_arch()}\n{contents}\n' - elif id == 'attr': + if id == "target": + contents = f"// {ext_settings.get_arch()}\n{contents}\n" + elif id == "attr": contents = f'let TargetPrefix = "riscv" in {{\n{contents}\n}}' (root, ext) = os.path.splitext(out_path) - patch_path = root + '_' + id + ext + patch_path = root + "_" + id + ext with open(patch_path, "w") as f: f.write(contents) key = frag.tag if ext_settings.experimental: key += "_experimental"
seal5/backends/riscv_instr_info/writer.py#L244
Line too long (155 > 120 characters) (E501)
/home/runner/work/seal5/seal5/seal5/backends/riscv_instr_info/writer.py#L219
formats=formats, compressed_pat=compressed_pat, ) return tablegen_str + def gen_intrinsic_pattern(instr, intrinsic: IntrinsicDefn): pat = f"""class Pat_{instr.name}<SDPatternOperator OpNode, Instruction Inst> : Pat<(OpNode {instr.llvm_ins_str}), (Inst {instr.llvm_ins_str})>; def : Pat_{instr.name}<int_riscv_{intrinsic.intrinsic_name}, {instr.name}>;""" return pat
seal5/backends/riscv_intrinsics/writer.py#L57
Local variable 'uses_mem' is assigned to but never used (F841)
/home/runner/work/seal5/seal5/seal5/backends/riscv_instr_info/writer.py#L239
parser.add_argument("--splitted", action="store_true", help="Split per set") parser.add_argument("--formats", action="store_true", help="Also generate instruction formats") parser.add_argument("--metrics", default=None, help="Output metrics to file") parser.add_argument("--index", default=None, help="Output index to file") parser.add_argument("--ext", type=str, default="td", help="Default file extension (if using --splitted)") - parser.add_argument("--no-add-intrinsics", dest='add_intrinsics', default=True, action='store_false', help="Suppress patterns for intrinsic functions") + parser.add_argument( + "--no-add-intrinsics", + dest="add_intrinsics", + default=True, + action="store_false", + help="Suppress patterns for intrinsic functions", + ) args = parser.parse_args() # initialize logging logging.basicConfig(level=getattr(logging, args.log.upper()))
seal5/backends/riscv_intrinsics/writer.py#L162
Local variable 'llvm_version' is assigned to but never used (F841)
/home/runner/work/seal5/seal5/seal5/settings.py#L156
# "clone_depth": None, "clone_depth": 1, "sparse_checkout": False, }, }, - "intrinsics": { - }, - } + "intrinsics": {}, +} ALLOWED_YAML_TYPES = (int, float, str, bool) def check_supported_types(data):
seal5/model.py#L92
Line too long (131 > 120 characters) (E501)
/home/runner/work/seal5/seal5/seal5/flow.py#L166
utils.copy(src, dest) class Seal5Flow: """Seal5 Flow.""" + def __init__( self, directory: Optional[Path] = None, meta_dir: Optional[Union[str, Path]] = None, name: Optional[str] = None ): self.directory: Path = handle_directory(directory) self.meta_dir: Path = handle_meta_dir(meta_dir, directory, name)
seal5/model.py#L104
Line too long (132 > 120 characters) (E501)
seal5/transform/detect_registers.py#L39
Line too long (128 > 120 characters) (E501)
seal5/backends/riscv_instr_info/writer.py#L23
'seal5.settings.ExtensionsSettings' imported but unused (F401)
seal5/backends/riscv_instr_info/writer.py#L224
Expected 2 blank lines, found 1 (E302)
seal5/backends/riscv_instr_info/writer.py#L244
Line too long (155 > 120 characters) (E501)
seal5/backends/riscv_intrinsics/writer.py#L57
Local variable 'uses_mem' is assigned to but never used (F841)
/home/runner/work/seal5/seal5/seal5/backends/riscv_intrinsics/writer.py#L25
def ir_type_to_text(ir_type: str): # needs fleshing out with all likely types # probably needs to take into account RISC-V bit width, e.g. does "Li" means 32 bit integer on a 128-bit platform? - if ir_type == 'i32': - return 'Li' + if ir_type == "i32": + return "Li" raise NotImplementedError(f'Unhandled ir_type "{ir_type}"') def build_target(arch: str, intrinsic: IntrinsicDefn): # Target couples intrinsic name to argument types and function behaviour # Start with return type if not void - arg_str = '' + arg_str = "" if intrinsic.ret_type: arg_str += ir_type_to_text(intrinsic.ret_type) for arg in intrinsic.args: arg_str += ir_type_to_text(arg.arg_type)
seal5/backends/riscv_intrinsics/writer.py#L162
Local variable 'llvm_version' is assigned to but never used (F841)
/home/runner/work/seal5/seal5/seal5/backends/riscv_intrinsics/writer.py#L46
return target def ir_type_to_pattern(ir_type: str): # needs fleshing out with all likely types - if ir_type == 'i32': - return 'llvm_i32_ty' + if ir_type == "i32": + return "llvm_i32_ty" raise NotImplementedError(f'Unhandled ir_type "{ir_type}"') def build_attr(arch: str, intrinsic: IntrinsicDefn): uses_mem = False # @todo - attr = f' def int_riscv_{intrinsic.intrinsic_name} : Intrinsic<\n [' + attr = f" def int_riscv_{intrinsic.intrinsic_name} : Intrinsic<\n [" if intrinsic.ret_type: - attr += f'{ir_type_to_pattern(intrinsic.ret_type)}' - attr += '],\n [' + attr += f"{ir_type_to_pattern(intrinsic.ret_type)}" + attr += "],\n [" for idx, arg in enumerate(intrinsic.args): if idx: - attr += ', ' + attr += ", " attr += ir_type_to_pattern(arg.arg_type) - attr += '],\n' - attr += ' [IntrNoMem, IntrSpeculatable, IntrWillReturn]>;' + attr += "],\n" + attr += " [IntrNoMem, IntrSpeculatable, IntrWillReturn]>;" return attr def build_emit(arch: str, intrinsic: IntrinsicDefn): - emit = (f' case RISCV::BI__builtin_{arch}_{intrinsic.intrinsic_name}:\n' - f' ID = Intrinsic::riscv_{intrinsic.intrinsic_name};\n' - f' break;') + emit = ( + f" case RISCV::BI__builtin_{arch}_{intrinsic.intrinsic_name}:\n" + f" ID = Intrinsic::riscv_{intrinsic.intrinsic_name};\n" + f" break;" + ) return emit @DataClass class PatchFrag: """Pairs patch contents to location to apply it""" + patchee: str tag: str contents: str = ""
seal5/model.py#L92
Line too long (131 > 120 characters) (E501)
/home/runner/work/seal5/seal5/seal5/backends/riscv_intrinsics/writer.py#L157
if settings: llvm_settings = settings.llvm if llvm_settings: llvm_state = llvm_settings.state if llvm_state: - llvm_version = llvm_state.version # unused today, but needed very soon + llvm_version = llvm_state.version # unused today, but needed very soon patch_frags = { - 'target': PatchFrag(patchee='clang/include/clang/Basic/BuiltinsRISCV.def', tag='builtins_riscv'), - 'attr': PatchFrag(patchee='llvm/include/llvm/IR/IntrinsicsRISCV.td', tag='intrinsics_riscv'), - 'emit': PatchFrag(patchee='clang/lib/CodeGen/CGBuiltin.cpp', tag='cg_builtin') - } + "target": PatchFrag(patchee="clang/include/clang/Basic/BuiltinsRISCV.def", tag="builtins_riscv"), + "attr": PatchFrag(patchee="llvm/include/llvm/IR/IntrinsicsRISCV.td", tag="intrinsics_riscv"), + "emit": PatchFrag(patchee="clang/lib/CodeGen/CGBuiltin.cpp", tag="cg_builtin"), + } for set_name, set_def in model["sets"].items(): artifacts[set_name] = [] metrics["n_sets"] += 1 ext_settings = set_def.settings if ext_settings is None: metrics["n_skipped"] += 1 continue for intrinsic in settings.intrinsics.intrinsics: metrics["n_success"] += 1 - patch_frags['target'].contents += build_target(arch=ext_settings.get_arch(), intrinsic=intrinsic) - patch_frags['attr'].contents += build_attr(arch=ext_settings.get_arch(), intrinsic=intrinsic) - patch_frags['emit'].contents += build_emit(arch=ext_settings.get_arch(), intrinsic=intrinsic) + patch_frags["target"].contents += build_target(arch=ext_settings.get_arch(), intrinsic=intrinsic) + patch_frags["attr"].contents += build_attr(arch=ext_settings.get_arch(), intrinsic=intrinsic) + patch_frags["emit"].contents += build_emit(arch=ext_settings.get_arch(), intrinsic=intrinsic) for id, frag in patch_frags.items(): contents = frag.contents if len(contents) > 0: - if id == 'target': - contents = f'// {ext_settings.get_arch()}\n{contents}\n' - elif id == 'attr': + if id == "target": + contents = f"// {ext_settings.get_arch()}\n{contents}\n" + elif id == "attr": contents = f'let TargetPrefix = "riscv" in {{\n{contents}\n}}' (root, ext) = os.path.splitext(out_path) - patch_path = root + '_' + id + ext + patch_path = root + "_" + id + ext with open(patch_path, "w") as f: f.write(contents) key = frag.tag if ext_settings.experimental: key += "_experimental"
seal5/model.py#L104
Line too long (132 > 120 characters) (E501)
/home/runner/work/seal5/seal5/seal5/backends/riscv_instr_info/writer.py#L219
formats=formats, compressed_pat=compressed_pat, ) return tablegen_str + def gen_intrinsic_pattern(instr, intrinsic: IntrinsicDefn): pat = f"""class Pat_{instr.name}<SDPatternOperator OpNode, Instruction Inst> : Pat<(OpNode {instr.llvm_ins_str}), (Inst {instr.llvm_ins_str})>; def : Pat_{instr.name}<int_riscv_{intrinsic.intrinsic_name}, {instr.name}>;""" return pat
seal5/transform/detect_registers.py#L39
Line too long (128 > 120 characters) (E501)
/home/runner/work/seal5/seal5/seal5/backends/riscv_instr_info/writer.py#L239
parser.add_argument("--splitted", action="store_true", help="Split per set") parser.add_argument("--formats", action="store_true", help="Also generate instruction formats") parser.add_argument("--metrics", default=None, help="Output metrics to file") parser.add_argument("--index", default=None, help="Output index to file") parser.add_argument("--ext", type=str, default="td", help="Default file extension (if using --splitted)") - parser.add_argument("--no-add-intrinsics", dest='add_intrinsics', default=True, action='store_false', help="Suppress patterns for intrinsic functions") + parser.add_argument( + "--no-add-intrinsics", + dest="add_intrinsics", + default=True, + action="store_false", + help="Suppress patterns for intrinsic functions", + ) args = parser.parse_args() # initialize logging logging.basicConfig(level=getattr(logging, args.log.upper()))
/home/runner/work/seal5/seal5/seal5/settings.py#L156
# "clone_depth": None, "clone_depth": 1, "sparse_checkout": False, }, }, - "intrinsics": { - }, - } + "intrinsics": {}, +} ALLOWED_YAML_TYPES = (int, float, str, bool) def check_supported_types(data):
/home/runner/work/seal5/seal5/seal5/flow.py#L166
utils.copy(src, dest) class Seal5Flow: """Seal5 Flow.""" + def __init__( self, directory: Optional[Path] = None, meta_dir: Optional[Union[str, Path]] = None, name: Optional[str] = None ): self.directory: Path = handle_directory(directory) self.meta_dir: Path = handle_meta_dir(meta_dir, directory, name)
Run linters
The following actions use a deprecated Node.js version and will be forced to run on node20: wearerequired/lint-action@v2. For more info: https://github.blog/changelog/2024-03-07-github-actions-all-actions-will-run-on-node20-instead-of-node16-by-default/