For the record, -keep was great success, I can give it something like:
TORCH_NVCC_FLAGS="-lineinfo -keep -keep-dir (directory to store these files)" \
  python setup.py build develop

One drawback is that this command creates ~5GB of intermediate files, when I need only a few of them.
Also, adding -src-in-ptx could give an even better ptx file (with source lines interspersed with PTX code), but unfortunately it sometimes triggers segfault in nvcc during the build.  (I could still manage to get the PTX file I want by running it several times.  YMMV.)