tra added inline comments.
================ Comment at: clang/lib/Driver/ToolChains/Cuda.cpp:161 + if (FS.exists(LibDevicePath + "/libdevice.10.bc")) { + Version = CudaVersion::LATEST; + DetectedVersionIsNotSupported = Version > CudaVersion::LATEST_SUPPORTED; ---------------- emankov wrote: > tra wrote: > > emankov wrote: > > > Do we have any other mechanism besides version.txt for determining an > > > exact CUDA version? Setting the latest version in case of absence of > > > version.txt doesn't suit all the needs: sometimes the exact version is > > > taken into account, for instance in [[ > > > https://github.com/ROCm-Developer-Tools/HIPIFY#clang | hipify-clang ]]. > > Not easily. > > > > We could try running one of SDK binaries with `--version`. This would be > > fragile as the tool version does not necessarily match the SDK's and > > NVIDIA has already started versioning elements per-component. E.g. some > > shared libraries in 11.1 are already versioned as 10.2, 11.0, 11.1 and > > 11.2. There are also situations when we had to cherry-pick a tool from a > > different release in order to work around a critical bug. We don't want to > > change compiler's idea of CUDA version based on that. > > > > We could parse CUDA headers and try finding CUDA_VERSION macro. That's > > feasible. It may be somewhat fragile if we just search for a text string > > '#define CUDA_VERSION XXXX' -- nvidia may change it. On the other hand it's > > not that much worse than relying on version.txt. It also does not carry > > complete version, only major.minor, so we will not be able to tell `11.0 > > `apart from `11.0 update 1`. Probably not a big deal. I don't think we've > > needed it so far. > > > > We could do something like this: > > * if version.txt is there -- use it > > * otherwise if cuda.h is found, extract version from CUDA_VERSION macro > > * if that failed, use libdevice bitcode format to detect CUDA-7.0 > > * fall back to "last supported version" otherwise > > > I'd appreciate the appearance of the step with a version extraction from > CUDA_VERSION macro. D89832 does exactly that. PTAL. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D89752/new/ https://reviews.llvm.org/D89752 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits