Skip to content

reshape(view(...)) inside a GPU kernel triggers InvalidIRError #736

@omlins

Description

@omlins

Description

When calling reshape(view(...)) inside an AMDGPU kernel, it fails with an InvalidIRError.

Minimal Working Example (MWE)

using AMDGPU

function kernel!(A)
    i = workitemIdx().x
    B = reshape(view(A, :, i), (size(A, 1),))  # ❌ This triggers InvalidIRError
    B[1] = 9.0
    return
end

# Create a ROCArray on the host (it will be converted automatically)
A = ROCArray{Float64}(undef, 4, 4)

# Launch kernel
@roc groupsize=4 kernel!(A)
AMDGPU.synchronize()

Expected Behavior

The kernel should execute without errors, and reshape(view(...)) should produce a valid ROCDeviceArray.

Actual Behavior

The following error occurs:

ERROR: InvalidIRError: compiling MethodInstance for kernel!(::ROCDeviceArray{Float64, 2}) resulted in invalid LLVM IR
Reason: unsupported call to an external C function

System Information

  • Julia Version: 1.11.2
  • AMDGPU.jl Version: master

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions