Is there a way to inspect the generated LLVM and PTX code?

28 views
Skip to first unread message

Wiebe-Marten Wijnja

unread,
May 29, 2020, 2:16:49 PM5/29/20
to Accelerate
Hello there!

Out of curiosity what kind of code Accelerate actually ends up creating, I would like to look at the intermediate LLVM and final PTX code that Accelerate might create for a given `Acc a` program.
I have already installed Accelerate with the `debug` flag enabled, so I am able to run `-ddump-dot`, but it would be nice to look at the final bytecode/assembly that ends up being built as well.

How can this be done?

Thank you for your time,

~Marten / Qqwy

Trevor McDonell

unread,
May 29, 2020, 2:21:34 PM5/29/20
to Accelerate
Hi Marten,

Welcome to the mailing list. The flags you need are `-dverbose`, and then `-ddump-cc` to see the intermediate LLVM IR, and `-ddump-asm` to see the PTX assembly.

Hope that helps!

Cheers,
-Trevor


--
You received this message because you are subscribed to the Google Groups "Accelerate" group.
To unsubscribe from this group and stop receiving emails from it, send an email to accelerate-hask...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/accelerate-haskell/6b1faa6f-2e66-4b24-a0c6-c93f2721196e%40googlegroups.com.

Wiebe-Marten Wijnja

unread,
May 30, 2020, 7:21:19 AM5/30/20
to accelerat...@googlegroups.com

Thank you!

I have added `dverbose` to my Stack.yaml's configure-options, as follows:

```

configure-options:
  accelerate:
    - -fdebug
    - -fdverbose
```

this however does not seem to work; when then running the generated program using `stack run -- +ACC -ddump-cc -ddump-asm -ACC` it does not seem like any information is printed to STDOUT/STERR or any new files are written.
What did I do wrong?

~Marten

signature.asc

Tom Smeding

unread,
May 30, 2020, 1:27:52 PM5/30/20
to Accelerate
I think `-dverbose` is also an ACC flag, so you'd pass `+ACC -dverbose -ddump-cc -ddump-asm` to your program. Personally I don't trust stack with my flags, so I locate my executable in the .stack-work directory and run it manually from there, but YMMV.

Also note that Accelerate caches already-compiled code in ~/.cache/accelerate; to force a re-compile (and actual output from dump-cc and friends), rm -rf that folder. It's safe as far as I know, as is usual with caches.

Wiebe-Marten Wijnja

unread,
Jun 3, 2020, 4:28:02 AM6/3/20
to accelerat...@googlegroups.com

I just wanted to follow up on this to let you know that I was able to follow your instructions and get the nice output I was looking for.
Thank you very much for your help! :-)

--
You received this message because you are subscribed to the Google Groups "Accelerate" group.
To unsubscribe from this group and stop receiving emails from it, send an email to accelerate-hask...@googlegroups.com.
signature.asc
Reply all
Reply to author
Forward
0 new messages