Skip to content

Improve readability of spy redshift output #474

Description

@paugier

For my experiment on loop fusion with SPy, I need to get a nice, human-readable redshift output.

First, it should be possible to ask for a simplified short version of the redshift output. For the loop fusion demo, I used (https://github.com/paugier/spy-demos/blob/loop-fusion/loop-fusion/simplify_rs_output.py):

# `name` is the file name without `.spy`.
for name, content in files.items():
    files[name] = (
        content.replace(name + "::", "")
        .replace("::Self", "")
        .replace(str(Path.home()), "~")
    )

Self is the name of the concrete types created in type factories. We don't need ndarray[f64, 3]::Self, especially when it's repeated several times. This is about the representation of generic function returning a type. A simple solution would be to treat the word Self as special and not display "::Self" in this case.

Second, the redshift output should be formatted to avoid very long lines to obtain something like this rather that the one-line version:

`unsafe::gc_ptr[f64]::getitem_byval`(
    `unsafe::ptr_getfield_byval[unsafe::gc_ptr[f64]]`(
        `ndarray[f64]::__get___ll____`(
            `LazyAdd[f64, ndarray[f64], ndarray[f64]]::__get_left__`(
                `LazyAdd[f64, LazyAdd[f64, ndarray[f64], ndarray[f64]], ndarray[f64]]::__get_left__`(expr))), 'items', 8), i)
+ `unsafe::gc_ptr[f64]::getitem_byval`(
    `unsafe::ptr_getfield_byval[unsafe::gc_ptr[f64]]`(
        `ndarray[f64]::__get___ll____`(
            `LazyAdd[f64, ndarray[f64], ndarray[f64]]::__get_right__`(
                `LazyAdd[f64, LazyAdd[f64, ndarray[f64], ndarray[f64]], ndarray[f64]]::__get_left__`(expr))), 'items', 8), i)
+ `unsafe::gc_ptr[f64]::getitem_byval`(
    `unsafe::ptr_getfield_byval[unsafe::gc_ptr[f64]]`(
        `ndarray[f64]::__get___ll____`(
            `LazyAdd[f64, LazyAdd[f64, ndarray[f64], ndarray[f64]], ndarray[f64]]::__get_right__`(expr)), 'items', 8), i)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions