rust-lang / rust-lang/rust

std::offload lacks debug locations

Open
#150,391 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-debuginfo C-bug C-enhancement F-gpu_offload
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

I tried this code:

https://rustc-dev-guide.rust-lang.org/offload/usage.html#usage
with LIBOMPTARGET_INFO=-1 ./main
I expected to see this happen: passes or errors, with some debug locations in the info lines:

omptarget device 0 info: Entering OpenMP kernel at unknown:0:0 with 1 arguments:
omptarget device 0 info: tofrom(unknown)[1024] 

This should show the line of the function and argument.

Instead, this happened: returns unknown instead of the lines/columns

Meta

main branch / head

Running: LIBOMPTARGET_INFO=-1 ./main
returns

The first element is zero 0.000000
omptarget device 0 info: Entering OpenMP data region with being_mapper at unknown:0:0 with 1 arguments:
omptarget device 0 info: tofrom(unknown)[1024] 
omptarget device 0 info: Creating new map entry with HstPtrBase=0x000058177095b880, HstPtrBegin=0x000058177095b880, TgtAllocBegin=0x00005817709353b0, TgtPtrBegin=0x00005817709353b0, Size=1024, DynRefCount=1, HoldRefCount=0, Name=unknown
omptarget device 0 info: Copying data from host to device, HstPtr=0x000058177095b880, TgtPtr=0x00005817709353b0, Size=1024, Name=unknown
omptarget device 0 info: OpenMP Host-Device pointer mappings after block at unknown:0:0:
omptarget device 0 info: Host Ptr           Target Ptr         Size (B) DynRefCount HoldRefCount Declaration
omptarget device 0 info: 0x000058177095b880 0x00005817709353b0 1024     1           0            unknown at unknown:0:0
omptarget device 1 info: OpenMP Host-Device pointer mappings table empty
omptarget device 2 info: OpenMP Host-Device pointer mappings table empty
omptarget device 3 info: OpenMP Host-Device pointer mappings table empty
omptarget device 0 info: Entering OpenMP kernel at unknown:0:0 with 1 arguments:
omptarget device 0 info: tofrom(unknown)[1024] 
omptarget error: Host ptr 0x00005817327328f1 does not have a matching target pointer.
omptarget device 0 info: OpenMP Host-Device pointer mappings after block at unknown:0:0:
omptarget device 0 info: Host Ptr           Target Ptr         Size (B) DynRefCount HoldRefCount Declaration
omptarget device 0 info: 0x000058177095b880 0x00005817709353b0 1024     1           0            unknown at unknown:0:0
omptarget device 1 info: OpenMP Host-Device pointer mappings table empty
omptarget device 2 info: OpenMP Host-Device pointer mappings table empty
omptarget device 3 info: OpenMP Host-Device pointer mappings table empty
omptarget error: Source location information not present. Compile with -g or -gline-tables-only.
omptarget fatal error 1: failure of target construct while offloading is mandatory
Aborted (core dumped)

Examples of locations which should be updated:
compiler/rustc_codegen_llvm/src/builder/gpu_offload.rs line 31 and 161.

@ivarflakstad you had asked me to ping you if I encounter issues that aren't blocked. I think this would be a good example if you're still curious about helping offload!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with compiler/rustc_codegen_llvm/src/builder/gpu_offload.rs, especially lines 31 and 161, and reproduce the report using the rustc-dev-guide offload example with LIBOMPTARGET_INFO=-1 ./main. Trace how source locations reach the offload information, and consider the issue done when the output reports the relevant function and line or column locations instead of unknown.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.