utahplt / FloatTrackerExamples

Examples for the FloatTracker.jl repository
MIT License
1 stars 1 forks source link

Existing slicing / jump to definition tools? #7

Open bennn opened 1 year ago

bennn commented 1 year ago

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 commented 1 year ago

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:

How's my understanding?

bennn commented 1 year ago

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 commented 1 year ago

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.