Hi! Using the vtune integration in our embedding, it works great! I can now see rust functions compiled to wasm and marked as [Dynamic code
\o/
I had one question about the way vtune displays the information: it seems that Vtune manages to parse the fully qualified Rust function name, and extracts the last bit of this path as the short function name. This last part appears to me as pretty random (it's a hex string), and it's used as the main display everywhere (leftmost column in Bottom up tab, everywhere in flame graph, etc.). See for instance:
Screenshot-from-2022-01-12-18-46-00.png
Any idea what goes wrong here? Could it be that the name demangler doesn't properly support Rust names?
ping @Alex Crichton who would know about Rust compiler internals and this sort of things probably, and @Andrew Brown @Johnnie Birch from Intel as I might just be misusing Vtune. Thanks :smile:
what's probably going on there is that wasmtime is forwarding the mangled name to vtune raw (from the wasm file itself) and then vtune applies C++ demangling which helps a bit but isn't rust demangling
we could update wasmtime to probably forward the unmangled name to vtune instead
basically applying cpp_demangle
and rust_demangle
here -- https://github.com/bytecodealliance/wasmtime/blob/7454f1f3af05ff27bbe3c1392a0957ac1d4e0fab/crates/jit/src/profiling.rs#L64-L71
cool idea. Is a C++ demangler a no-op on an already demangled name, or would it just display Bad Stuff?
are you saying we should call them both, since we can't know what's the origin language?
We would want to do something like demangle(&name).unwrap_or(&name)
Benjamin Bouvier said:
are you saying we should call them both, since we can't know what's the origin language?
Yes, I think we would want to. They should bail out pretty quickly when given symbols from other languages, so it shouldn't be too much wasted work. worst case scenario, we can implement a checker that returns a language hint, if we really need to
Cool, let me try that!
(I just pinged @Johnnie Birch internally to see what he thinks)
Doing that, I get the fully qualified name as the function name displayed in Vtune, which is very workable! So calling it great enough :-) Screenshot-from-2022-01-12-19-15-53.png
will make a PR
(deleted)
@Johnnie Birch I was using the Bottom/up view, or the flamegraph view. Weirdly, it seemed that in your picture, the main display name (leftmost column) wasn't the last part of the fully qualified name, but just the whole name. Could be platform differences? I'm on Linux, using the latest version of intel-basekit as downloaded from Intel's website.
also I think the hex strings at the end appear because those are generic functions, but not sure
@Benjamin Bouvier Well I deleted because I realized my comment was already obsolete after posting but I think what I saw was consistent with what you were showing in the leftmost column? I did also see the mangled name issue that you've confirmed has a solution now.
Benjamin Bouvier has marked this topic as resolved.
Last updated: Dec 23 2024 at 13:07 UTC