Skip to content

[NVPTX] generated debug info uses features not available in older PTX versions #112998

New issue

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

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

Already on GitHub? # to your account

Open
Artem-B opened this issue Oct 18, 2024 · 1 comment
Open

Comments

@Artem-B
Copy link
Member

Artem-B commented Oct 18, 2024

Reproducer:

LLVM_PTXAS_EXECUTABLE=$HOME/local/cuda-11.8.0/bin/ptxas bin/llvm-lit -av $HOME/work/llvm/repo/llvm/test/DebugInfo/NVPTX/dbg-value-const-byref.ll
+ bin/llc -mtriple=nvptx64-nvidia-cuda
+ local/cuda-11.8.0/bin/ptxas -arch=sm_60 -c -
ptxas /tmp/lit-tmp-3piyjb1a/tmpxft_00096c16_00000000-0_stdin, line 91; error   : Feature 'Defining labels in .section' requires PTX ISA .version 7.0 or later
ptxas fatal   : Ptx assembly aborted due to errors

The label ptxas is unhappy about:

     88         .file   1 "dbg-value-const-byref.c"
     89         .section        .debug_loc
     90         {
     91 $L__debug_loc0:
     92 .b64 $L__tmp0
     93 .b64 $L__tmp1
@llvmbot
Copy link
Member

llvmbot commented Oct 18, 2024

@llvm/issue-subscribers-debuginfo

Author: Artem Belevich (Artem-B)

Reproducer: ``` LLVM_PTXAS_EXECUTABLE=$HOME/local/cuda-11.8.0/bin/ptxas bin/llvm-lit -av $HOME/work/llvm/repo/llvm/test/DebugInfo/NVPTX/dbg-value-const-byref.ll + bin/llc -mtriple=nvptx64-nvidia-cuda + local/cuda-11.8.0/bin/ptxas -arch=sm_60 -c - ptxas /tmp/lit-tmp-3piyjb1a/tmpxft_00096c16_00000000-0_stdin, line 91; error : Feature 'Defining labels in .section' requires PTX ISA .version 7.0 or later ptxas fatal : Ptx assembly aborted due to errors

The label ptxas is unhappy about:
 88         .file   1 "dbg-value-const-byref.c"
 89         .section        .debug_loc
 90         {
 91 $L__debug_loc0:
 92 .b64 $L__tmp0
 93 .b64 $L__tmp1
</details>

workingjubilee added a commit to workingjubilee/rustc that referenced this issue Feb 20, 2025
Pass through of target features to llvm-bitcode-linker and handling them

When using the llvm-bitcode-linker (`linker-flavor=llbc`) target-features are not passed through and are not handled by it.
The llvm-bitcode-linker is mainly used as a self contained linker to link llvm bitcode for the nvptx64 target. It uses `llvm-link`, `opt` and `llc` internally. To produce a `.ptx` file of a specific ptx-version it is necessary to pass the version to llc with the `--mattr` option. Without explicitly setting it, the emitted `.ptx`-version is the minimum supported version of the `--target-cpu`.

I would like to be able to explicitly set the ptx version as [some llvm problems only occur in earlier `.ptx`-versions](llvm/llvm-project#112998).

Therefore this pull request adds support for passing target features to llvm-bitcode-linker and handling them.
I was not quite sure if adding these features to `rustc_target/src/target_features.rs` is necessary or not. If so I will gladly add these.

    r? `@kjetilkjeka`
workingjubilee added a commit to workingjubilee/rustc that referenced this issue Feb 20, 2025
Pass through of target features to llvm-bitcode-linker and handling them

When using the llvm-bitcode-linker (`linker-flavor=llbc`) target-features are not passed through and are not handled by it.
The llvm-bitcode-linker is mainly used as a self contained linker to link llvm bitcode for the nvptx64 target. It uses `llvm-link`, `opt` and `llc` internally. To produce a `.ptx` file of a specific ptx-version it is necessary to pass the version to llc with the `--mattr` option. Without explicitly setting it, the emitted `.ptx`-version is the minimum supported version of the `--target-cpu`.

I would like to be able to explicitly set the ptx version as [some llvm problems only occur in earlier `.ptx`-versions](llvm/llvm-project#112998).

Therefore this pull request adds support for passing target features to llvm-bitcode-linker and handling them.
I was not quite sure if adding these features to `rustc_target/src/target_features.rs` is necessary or not. If so I will gladly add these.

    r? ``@kjetilkjeka``
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Feb 21, 2025
Rollup merge of rust-lang#136608 - kulst:ptx_target_features, r=bjorn3

Pass through of target features to llvm-bitcode-linker and handling them

When using the llvm-bitcode-linker (`linker-flavor=llbc`) target-features are not passed through and are not handled by it.
The llvm-bitcode-linker is mainly used as a self contained linker to link llvm bitcode for the nvptx64 target. It uses `llvm-link`, `opt` and `llc` internally. To produce a `.ptx` file of a specific ptx-version it is necessary to pass the version to llc with the `--mattr` option. Without explicitly setting it, the emitted `.ptx`-version is the minimum supported version of the `--target-cpu`.

I would like to be able to explicitly set the ptx version as [some llvm problems only occur in earlier `.ptx`-versions](llvm/llvm-project#112998).

Therefore this pull request adds support for passing target features to llvm-bitcode-linker and handling them.
I was not quite sure if adding these features to `rustc_target/src/target_features.rs` is necessary or not. If so I will gladly add these.

    r? ``@kjetilkjeka``
github-merge-queue bot pushed a commit to rust-lang/rust-analyzer that referenced this issue Feb 24, 2025
Pass through of target features to llvm-bitcode-linker and handling them

When using the llvm-bitcode-linker (`linker-flavor=llbc`) target-features are not passed through and are not handled by it.
The llvm-bitcode-linker is mainly used as a self contained linker to link llvm bitcode for the nvptx64 target. It uses `llvm-link`, `opt` and `llc` internally. To produce a `.ptx` file of a specific ptx-version it is necessary to pass the version to llc with the `--mattr` option. Without explicitly setting it, the emitted `.ptx`-version is the minimum supported version of the `--target-cpu`.

I would like to be able to explicitly set the ptx version as [some llvm problems only occur in earlier `.ptx`-versions](llvm/llvm-project#112998).

Therefore this pull request adds support for passing target features to llvm-bitcode-linker and handling them.
I was not quite sure if adding these features to `rustc_target/src/target_features.rs` is necessary or not. If so I will gladly add these.

    r? ``@kjetilkjeka``
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

3 participants