AnyDSL / thorin

The Higher-Order Intermediate Representation

Home Page:https://anydsl.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

amdgpu requires private addrspace annotations

richardmembarth opened this issue · comments

LLVM annotates the private address space for amdgpu (but not for nvptx).
This triggers the assertion "Calling a function with a bad signature!" when generating amdgpu code for the following code:

#[import(cc = "thorin")] fn amdgpu(_dev: i32, _grid: (i32, i32, i32), _block: (i32, i32, i32), _body: fn() -> ()) -> ();
#[import(cc = "device")] fn foo(&A) -> ();

struct A {
    a : i32,
}

fn noinline(a: &A) -> () {
    foo(a)
}

#[export]
fn test(a: A) -> () {
    amdgpu(0, (1, 1, 1), (1, 1, 1), || {
        let ptr = &a;
        noinline(ptr);
    });
}

While (%"type 0x555555674340"*) is the parameter type for noinline, the argument has "type 0x555555674340" addrspace(5)*