Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
omlins opened this issue Feb 27, 2025 · 5 comments · Fixed by #737
Closed

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

omlins opened this issue Feb 27, 2025 · 5 comments · Fixed by #737
Assignees
Labels
bug Something isn't working

Comments

@omlins
Copy link
Contributor

omlins commented Feb 27, 2025

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
@omlins
Copy link
Contributor Author

omlins commented Feb 28, 2025

@pxl-th the equivalent works in CUDA.jl

@pxl-th pxl-th added the bug Something isn't working label Feb 28, 2025
@pxl-th pxl-th self-assigned this Feb 28, 2025
@pxl-th
Copy link
Member

pxl-th commented Feb 28, 2025

@omlins I'll take a look

@omlins
Copy link
Contributor Author

omlins commented Feb 28, 2025

@omlins I'll take a look

Thanks!

@omlins
Copy link
Contributor Author

omlins commented Mar 14, 2025

@pxl-th Could you please tag a new release soon?

@pxl-th
Copy link
Member

pxl-th commented Mar 14, 2025

Yeah, I'll tag right after #740

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants