Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LLVM error when emitting PTX code with debuginfo #38785

Open
japaric opened this issue Jan 2, 2017 · 1 comment
Open

LLVM error when emitting PTX code with debuginfo #38785

japaric opened this issue Jan 2, 2017 · 1 comment
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. C-bug Category: This is a bug. O-NVPTX Target: the NVPTX LLVM backend for running rust on GPUs, https://llvm.org/docs/NVPTXUsage.html T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@japaric
Copy link
Member

japaric commented Jan 2, 2017

STR

$ cargo new --lib kernel && cd $_

$ edit src/lib.rs && cat $_
#![feature(lang_items)]
#![feature(no_core)]
#![no_core]  // Just to avoid using Xargo

fn foo() {}

#[lang = "copy"]
trait Copy {}

#[lang = "sized"]
trait Sized {}
$ edit nvptx64-nvidia-cuda.json && cat $_
{
  "arch": "nvptx64",
  "cpu": "sm_20",
  "data-layout": "e-i64:64-v16:16-v32:32-n16:32:64",
  "llvm-target": "nvptx64-nvidia-cuda",
  "max-atomic-width": 0,
  "os": "cuda",
  "panic-strategy": "abort",
  "target-endian": "little",
  "target-pointer-width": "64"
}
$ cargo rustc --target nvptx64-nvidia-cuda -- --emit=asm
   Compiling kernel v0.1.0 (file:///home/japaric/tmp/kernel)
warning: function is never used: `foo`, #[warn(dead_code)] on by default
 --> src/lib.rs:5:1
  |
5 | fn foo() {}
  | ^^^^^^^^^^^

All DICompileUnits must be listed in llvm.dbg.cu
LLVM ERROR: Broken module found, compilation aborted!
error: Could not compile `kernel`.

Workaround

Don't try to emit debuginfo:

# Cargo.toml
[profile.dev]
debug = false
@japaric japaric added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. O-NVPTX Target: the NVPTX LLVM backend for running rust on GPUs, https://llvm.org/docs/NVPTXUsage.html labels Jan 2, 2017
@Mark-Simulacrum Mark-Simulacrum added the C-bug Category: This is a bug. label Jul 26, 2017
@evanjs
Copy link

evanjs commented Jan 18, 2019

Is this still an issue? I got some helpful error messages telling me to add target-c-int-width and linker-flavor, and after adding "target-c-int-width": "32" and "linker-flavor": "ld" it seems to compile fine.

@Nilstrieb Nilstrieb added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Apr 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. C-bug Category: This is a bug. O-NVPTX Target: the NVPTX LLVM backend for running rust on GPUs, https://llvm.org/docs/NVPTXUsage.html T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants