Skip to content

VectorCombinePass in buildScalarOptimizerPipeline produces invalid SPIR-V on OpenCLBackend #813

@michel2323

Description

@michel2323

Since v1.12.0, kernels compiled for SPIRVCompilerTarget (OpenCL.jl + pocl_jll) (KA on CPU) can produce SPIR-V that spirv-val rejects with:

error: line 0: The following forward referenced IDs have not been defined:
'308[%308]'

git bisect between v1.11.1 (good) and v1.13.2 (bad) identifies commit c095147 ("Align optimization pipeline with Julia's") as the first bad commit. A sub-bisection within c095147 narrows the cause to a single newly-added pass in buildScalarOptimizerPipeline:

# src/optim.jl, in the opt_level >= 2 branch
add!(fpm, VectorCombinePass())

Maybe guarding it like this is fine?

if can_vectorize(job)
  add!(fpm, VectorCombinePass())
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions