JuliaGPU / JuliaGPU/GPUCompiler.jl

Feature request: ability to specify method table in `methodinstance`

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

Description

It'd be useful if `methodinstance` could work with any method table, not just the global default one.

The version that takes a worldage is easy, it just needs to become
```julia
function methodinstance(ft::Type, tt::Type, world::Integer; methodtable=nothing)
sig = typed_signature(ft, tt)

match, _ = CC._findsup(sig, methodtable, world)
match === nothing && throw(MethodError(ft, tt, world))

mi = CC.specialize_method(match)

return mi::MethodInstance
end
```
but I tried to do it in the generated function version and I couldn't figure out how to get it to work properly without segfaulting, so any hints or help on making that work would be much appreciated.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the existing `methodinstance` overloads and compare the worldage version with the generated-function version. Read the uses of `typed_signature`, `CC._findsup`, and `CC.specialize_method`; the work is complete when a supplied method table works for both forms without segfaulting and returns the expected `MethodInstance`.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.