llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Aaron Jomy (aaronj0) <details> <summary>Changes</summary> The host path sets the bootstrap module aside with CacheCodeGenModule() once the initial action has run, so the first PTU starts from a fresh module. The CUDA device path skipped this step. The device module that HandleTranslationUnit had already finalized during bootstrap stayed current, and the first device PTU finalized it a second time, resulting in CodeGen adding every module flag twice. The IR verifier then rejects the module. To reproduce, on a build with assertions, or with `-fverify-intermediate-code` (hidden on release builds since the driver disables the verifier there), the first input to `clang-repl --cuda` fails: ``` module flag identifiers must be unique (or of 'require' type) !"nvvm-reflect-ftz" module flag identifiers must be unique (or of 'require' type) !"PIC Level" module flag identifiers must be unique (or of 'require' type) !"frame-pointer" fatal error: error in backend: Broken module found, compilation aborted! ``` Tested on 22.x and main. The `host-supports-cuda` lit probe also hits this: clang/test/Interpreter/CUDA reports UNSUPPORTED instead of failing. After, the first device module carries each flag once and the verifier accepts it. The probe passes and the CUDA tests run on an assertions build. --- Full diff: https://github.com/llvm/llvm-project/pull/226975.diff 1 Files Affected: - (modified) clang/lib/Interpreter/Interpreter.cpp (+3) ``````````diff diff --git a/clang/lib/Interpreter/Interpreter.cpp b/clang/lib/Interpreter/Interpreter.cpp index 512b28be5a544..40fbc83db9107 100644 --- a/clang/lib/Interpreter/Interpreter.cpp +++ b/clang/lib/Interpreter/Interpreter.cpp @@ -507,6 +507,9 @@ Interpreter::createWithCUDA(std::unique_ptr<CompilerInstance> CI, if (llvm::Error E = ExecuteIncrementalAction(*DCI, *Interp->DeviceAct)) return std::move(E); + // Set the finalized initial device module aside, as the host path does. + Interp->DeviceAct->CacheCodeGenModule(); + Interp->DeviceCI = std::move(DCI); auto DeviceParser = std::make_unique<IncrementalCUDADeviceParser>( `````````` </details> https://github.com/llvm/llvm-project/pull/226975 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
