JuliaGPU / JuliaGPU/GPUCompiler.jl

Handle ExceptionStack in `code_typed(err)`

Open
#558 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Julia
Stars
187
Forks
68
Avg merge
1d 12h
Merged PRs (30d)
28

Description

```
julia> @cuda demo(A)
ERROR: InvalidIRError: compiling MethodInstance for demo(::CuDeviceVector{Float32, 1}) resulted in invalid LLVM IR
Reason: unsupported call to an unknown function (call to julia.new_gc_frame)
Reason: unsupported call to an unknown function (call to julia.push_gc_frame)
Reason: unsupported call to an unknown function (call to julia.get_gc_frame_slot)
Reason: unsupported call to an unknown function (call to julia.pop_gc_frame)
Hint: catch this exception as `err` and call `code_typed(err; interactive = true)` to introspect the erronous code with Cthulhu.j
```

Nowadays in the REPL the last error is in `err` (Not sure when that was added)

```
julia> err
1-element ExceptionStack:
InvalidIRError: compiling MethodInstance for demo(::CuDeviceVector{Float32, 1}) resulted in invalid LLVM IR
```

```
julia> code_typed(err; interactive = true)
ERROR: MethodError: no method matching code_typed_by_type(::Type{Tuple{Base.ExceptionStack, Vararg{Any}}}; interactive::Bool)

Closest candidates are:
code_typed_by_type(::Type; optimize, debuginfo, world, interp) got unsupported keyword argument "interactive"
@ Base reflection.jl:1381
```

Works:
```
code_typed(first(err.stack).exception; interactive = true)
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the failure with `code_typed(err; interactive = true)` and compare it with `code_typed(first(err.stack).exception; interactive = true)`. Trace the `code_typed` entry point and its handling of `ExceptionStack`; done when the former handles the stack as the latter does without the MethodError.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.