Skip to content

lu_instance fails for JLArray #501

Description

@singhharsh1708

ArrayInterface.lu_instance fails for JLArray:

using JLArrays, ArrayInterface
ArrayInterface.lu_instance(jl(ones(3, 3)))
# ERROR: Illegal conversion of a JLArray to a Ptr

The GPUArraysCore extension builds the instance as
lu(Adapt.adapt(parameterless_type(A), ones(T, 0, 0))), and JLArrays has no lu of its own, so
that lands in LinearAlgebra's generic path. There is no size for which it works:

lu(jl(ones(0, 0)))   # Illegal conversion of a JLArray to a Ptr   (LAPACK getrf!)
lu(jl(ones(3, 3)))   # Scalar indexing is disallowed              (generic fallback)

so the 0x0 is not the issue, routing through lu is.

This bites test suites that use JLArrays as the stand-in for a GPU array on machines without
one. OrdinaryDiffEq reaches it from build_J_W and its GPU autodiff test is currently failing
on Julia 1, lts and pre.

Same shape as #467 for Metal. Would building the LU object directly be acceptable here rather
than calling lu?

ArrayInterface 7.29.0, JLArrays 0.3.2, GPUArraysCore 0.2.0, Julia 1.10.10.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions