Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Existing slicing / jump to definition tools? #7

Open
bennn opened this issue May 3, 2023 · 3 comments
Open

Existing slicing / jump to definition tools? #7

bennn opened this issue May 3, 2023 · 3 comments
Assignees

Comments

@bennn
Copy link
Member

bennn commented May 3, 2023

Does Julia have tools for program slicing / jumping to variable definitions?

If not, we should build some.

We need them to figure out if in an injected NaN is a real problem or not. Doing it manually is hard. Worse, it's easy to get wrong.

Example from Finch's grid.jl, read bottom-up:

        ....      ## gotta keep looking upward
        # sample distance betweeen vertices
        for i=2:n_vert    ## i defined here, definitely not NaN
            tmp = 0.0;    ## tmp initialized here, definitely not NaN
            for di=1:dim       ## di defined here, definitely not NaN
                tmp += abs(e_vert[di,i] .- e_vert[di,i-1]);    ## tmp updated here; could it give a NaN?
            end
            vertex_dist_scale[ei] += tmp;       ## NaN injected here. Is it realistic? Gotta look up
        end
        vertex_dist_scale[ei] /= (n_vert-1);
@ashton314
Copy link
Member

program slicing

I'm unfamiliar with this term: could you please describe what that means?

jumping to variable definitions

I use the Julia language server when developing Julia—it would be rather interesting to see if we could build a plugin to this (or maybe the DAP) for editors—is that what you were thinking?

So, are you thinking some kind of flow like:

  • FloatTracker runs for a bit
  • We get a bug
  • Jump to where the NaN was injected
  • Move the injection location around a bit and retry (<- or something like that)

How's my understanding?

@bennn
Copy link
Member Author

bennn commented May 4, 2023

Slicing finds code that's relevant to a point of interest & ignores other code. The wikipedia article has links to the original paper & a few others. (The original at least is great.) Flowistry is a nice recent application (github, paper).

A language server tool would be excellent. There might already be one.

Move the injection location around a bit and retry (<- or something like that)

No. The goal is to understand the injection. Could any real input lead to a NaN in the same place?

The tool doesn't need to be float-tracker specific. FloatTracker points us to a line of code. The tool needs to work backwards to find all inputs to that line.

(Moving around might be useful, but we can try that manually first.)

@ashton314
Copy link
Member

ashton314 commented May 5, 2023

Language server

For your convenience, here's how to get the language server going with Neovim: https://github.com/julia-vscode/LanguageServer.jl/wiki/Vim-and-Neovim

We'll have to dig in more to see how to extend/develop plugins for the lang server if that's a route we want to go down.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants