SPIR-V runtime library fails to build on 32-bit hosts: `unbox_int64` returns void

未关闭
#1,085 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@maleadt 已经在做这个了。

开始于 2026年10月25日。

  • #1062 来自 @maleadt —— 未关闭

评估

难度
3/5
预计耗时
1-2 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
停滞
技术栈
julia
领域
backend, compilers

调研方向

Start with src/runtime.jl, where the issue says the box_* and unbox_* runtime functions are generated, then read src/spirv.jl to see how 32-bit hosts select spirv32. Reproduce the failure with the minimal KernelAbstractions kernel on a 32-bit host and inspect how unbox_int64 is emitted for the SPIR-V runtime. Done means the runtime builds and kernel launches succeed on 32-bit Linux; an open linked pull request (#1062) may already be working on this issue.

由索引模型根据 Issue 内容生成。

描述

Opened by Claude (Opus 5.5, effort xhigh), an AI agent working with the maintainer of RadiationDetectorDSP.jl.

On 32-bit x86 Linux, every kernel launched on the POCL CPU backend of KernelAbstractions v0.10 fails while GPUCompiler builds its runtime library for the SPIR-V target:

Invalid return type for runtime function 'unbox_int64': expected LLVM.IntegerType(i64), got LLVM.VoidType(void)
Stacktrace:
  [1] error(s::String)
  [2] emit_function!(mod::LLVM.Module, relocs::GPUCompiler.Relocations, config::GPUCompiler.CompilerConfig{GPUCompiler.SPIRVCompilerTarget, KernelAbstractions.POCL.OpenCLCompilerParams}, ...)
    @ GPUCompiler ~/.julia/packages/GPUCompiler/1SnnQ/src/rtlib.jl:116
  [5] build_runtime(job::GPUCompiler.CompilerJob, config::GPUCompiler.CompilerConfig{GPUCompiler.SPIRVCompilerTarget, KernelAbstractions.POCL.OpenCLCompilerParams})
    @ GPUCompiler ~/.julia/packages/GPUCompiler/1SnnQ/src/rtlib.jl:206
  [8] load_runtime(job::GPUCompiler.CompilerJob)
    @ GPUCompiler ~/.julia/packages/GPUCompiler/1SnnQ/src/rtlib.jl:281
  [9] emit_llvm(job::GPUCompiler.CompilerJob; resolve_relocations::Bool)
    @ GPUCompiler ~/.julia/packages/GPUCompiler/1SnnQ/src/driver.jl:346
  ...
 [15] compile(target::Symbol, job::GPUCompiler.CompilerJob)
    @ GPUCompiler ~/.julia/packages/GPUCompiler/1SnnQ/src/driver.jl:90
 [16] invoke_frozen
    @ ~/.julia/packages/KernelAbstractions/msuwu/src/pocl/compiler/compilation.jl:272 [inlined]

The error comes from building the runtime library, so it doesn't depend on the kernel. All 25 kernel launches in the test suite of RadiationDetectorDSP.jl fail this way, while the same tests pass on x86_64 Linux, Windows x64 and aarch64 macOS. unbox_int64 is one of the box_*/unbox_* runtime functions generated in src/runtime.jl. GPUCompiler selects spirv32 on 32-bit hosts (src/spirv.jl), so this isn't the cross-compilation limitation of #486.

Environment: GitHub Actions ubuntu-latest, Julia 1.13.3 (i686), GPUCompiler v2.22.0, KernelAbstractions v0.10.7, LLVM.jl v10.4.3, pocl_standalone_jll v7.2.3+8. Full log: https://github.com/JuliaPhysics/RadiationDetectorDSP.jl/actions/runs/42638899373/job/129234371696 (found in JuliaPhysics/RadiationDetectorDSP.jl#88).

A minimal kernel that should fail the same way (not run in isolation on a 32-bit host):

using KernelAbstractions

@kernel function fill_index!(a)
    i = @index(Global)
    a[i] = i
end

a = zeros(Float32, 4)
fill_index!(CPU())(a; ndrange = length(a))
KernelAbstractions.synchronize(CPU())
主要语言
Julia
星标
190
派生
72
平均合并
16 小时 57 分钟
30 天内合并 PR
40

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

JuliaGPU/GPUCompiler.jl 的其他 Issue

查看 JuliaGPU/GPUCompiler.jl 的全部 Issue

相似的 Issue

更多 Julia Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。