Hacker News new | ask | show | jobs
by daveedvdv 60 days ago
Several of our customers instrument the AST to add security-probing and/or other dynamic-analysis features. NVCC uses it to separate out "device" constructs.
2 comments

That is quite interesting. I haven't thought much about source-to-source transformation within C++.

Do you have any articles/papers/books/etc. you can point us to for understanding this better?

Two usecases i have in mind are;

1) Transforming legacy C++98/C++03 codebases into "modern" C++11/14/17/20/23/26. Is this possible with current edg?

2) Adding verification conditions based on code analysis; both runtime contract asserts and compile time proofs (possible?) so as to convert "normal" C++ code into "somewhat verified" C++ code.

Some resources that Google brought up;

Challenges and Opportunities in C/C++ Source-To-Source Compilation - https://drops.dagstuhl.de/entities/document/10.4230/OASIcs.P...

C++ Insights - See your source code with the eyes of a compiler - https://github.com/andreasfertig/cppinsights Tool at https://cppinsights.io/

Wait, nvcc uses EDG?
Yes. And this is why the nvcc preprocessor is so effective at working with the various host compilers. It emulates properties of the host compiler so that the device code and host agree on things.

You can see some discussion here:

https://forums.developer.nvidia.com/t/nvcc-preprocessing/649...

Thank you.

But i could not find Thibaut Lutz's presentation slides linked to in the above discussion. Any idea where i can find it?

I presume the control flow in the above presentation is the same as found in "The CUDA Compilation Trajectory" chapter in the NVCC documentation (cudafe++ is EDG) - https://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index...