-
Couldn't load subscription status.
- Fork 38
Storage type promotion #382
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
base: main
Are you sure you want to change the base?
Conversation
|
@tmigot please review this pr. |
|
What does the example in the issue do with this PR? |
|
@tmigot julia> using CUDA, NLPModels, NLPModelsTest, LinearOperators julia> V = CuArray{Float64, 1, CUDA.Mem.DeviceBuffer} julia> nlp = BROWNDEN(V) julia> nvar = nlp.meta.nvar julia> xc = V(undef, nvar) julia> Hs = V(undef, nvar) julia> H = hess_op!(nlp, xc, Hs) julia> cg_op_diag = V(undef, nvar) julia> cg_op = opDiagonal(cg_op_diag) julia> ZHZ = cg_op' * H * cg_op julia> size(ZHZ) julia> typeof(ZHZ) julia> v = V(undef, nvar); v .= 1.0; julia> result = ZHZ * v |
…at.jl consistently (tests still pass functionally; only the known two tiny allocation assertions remain).
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #382 +/- ##
==========================================
- Coverage 95.00% 93.77% -1.23%
==========================================
Files 17 20 +3
Lines 1100 1156 +56
==========================================
+ Hits 1045 1084 +39
- Misses 55 72 +17 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
I fixed the "storage types cannot be promoted to a concrete type" error (issue #329) by making the code robust when promote_type(storage_type(op1), storage_type(op2)) yields a non-concrete type. The fix:
In [operations.jl] : (operator * and +)
In [cat.jl] : (operator hcat and vcat)
Falls back to a concrete operand storage type if promotion yields an abstract type, or uses Vector{T} as a last resort.
This allows GPU-backed operators and mixed-storage scenarios to work without hard failures.
Closes #329