Skip to content

Switch to the LLVM SPIR-V back-end. #285

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

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from
Draft

Conversation

maleadt
Copy link
Member

@maleadt maleadt commented Feb 13, 2025

Same as JuliaGPU/oneAPI.jl#491, but I figured it's easier to do the experimentation here as the SPIRVIntrinsics submodule is part of this repository.

@maleadt
Copy link
Member Author

maleadt commented Feb 18, 2025

Currently blocked on pocl/pocl#1799.

MWE:

function double_print_kernel()
    OpenCL.@print "foo"
    OpenCL.@print "barbar"
    return
end

function main()
    @opencl double_print_kernel()
end

Reduced from:

function orig()
    x = CLArray(zeros(Float32, (1, 1)))
    y = CLArray(rand(Float32, (1)))
    x[:, 1] = y
end

EDIT: upstream argued that this is an LLVM bug.

@maleadt
Copy link
Member Author

maleadt commented Feb 20, 2025

Also blocked on llvm/llvm-project#127977

MWE: CLArray{Float32}(undef, 5, 5) + 1f0 * I

Reduced from:

function orig()
    T1 = T2 = Float32
    AT = CLArray
    f = identity
    x = ones(T1, 5, 5)
    y = AT(x)

    xw = f(x)
    yw = f(y)

    J = one(T2) * I

    @allowscalar collect(xw + J)  collect(yw + J)
end

@maleadt maleadt force-pushed the tb/llvm_spirv_backend branch from 52bc6cf to fdc1656 Compare May 20, 2025 07:43
@maleadt
Copy link
Member Author

maleadt commented May 20, 2025

Rebased and updated the JLL. On 7.0 the printf failure has disappeared, but another issue (which I didn't reduce yet) remains:

Call parameter type does not match function signature!
  %192 = call i32 @llvm.spv.track.constant.i32.i32(i32 undef, metadata i32 undef)
 ptr  %194 = call i32 (i32, ptr, ...) @llvm.spv.insertv.p0(i32 %191, i32 %192, i32 %193)
in function julia_ArgumentError_91762

Copy link

codecov bot commented May 20, 2025

Codecov Report

Attention: Patch coverage is 20.00000% with 4 lines in your changes missing coverage. Please review.

Project coverage is 32.51%. Comparing base (4103739) to head (fdc1656).

Files with missing lines Patch % Lines
src/array.jl 0.00% 2 Missing ⚠️
src/compiler/compilation.jl 0.00% 1 Missing ⚠️
src/compiler/execution.jl 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           master     #285       +/-   ##
===========================================
- Coverage   73.82%   32.51%   -41.31%     
===========================================
  Files          12       11        -1     
  Lines         615      572       -43     
===========================================
- Hits          454      186      -268     
- Misses        161      386      +225     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant