Closed albop closed 3 months ago
Actually, I have just found a way:
@kernel function round_kernel(A,B)
I = @index(Global)
v = trunc(B[I])
A[I] = (v::Int8)
end
Not sure what to do with this issue. I guess the GPU definitions of trunc, round, ceil, could potentially be enhanced.
The comment above is wrong: the kernel above doesn' t raise an exception but doesn' t do anything either. I guess the instruction v::Int8
is just an assertion, which invalidates silently the whole kernel.
This is a known limitation, tracked in https://github.com/JuliaGPU/oneAPI.jl/issues/65.
In your case, use unsafe_trunc
instead, which doesn't generate an exception (and thus doesn't require an allocation). It's unfortunate, but adding overlay definitions to trunc
is much too invasive, so time is better spent working on a device-side allocator fixing https://github.com/JuliaGPU/oneAPI.jl/issues/65.
Thank you !
Le jeu. 23 mai 2024, 10:27, Tim Besard @.***> a écrit :
This is a known limitation, tracked in #65 https://github.com/JuliaGPU/oneAPI.jl/issues/65. In your case, use unsafe_trunc instead, which doesn't generate an exception (and thus doesn't require an allocation). It's unfortunate, but adding overlay definitions to trunc is much too invasive, so time is better spent working on a device-side allocator fixing #65 https://github.com/JuliaGPU/oneAPI.jl/issues/65.
— Reply to this email directly, view it on GitHub https://github.com/JuliaGPU/oneAPI.jl/issues/441#issuecomment-2126525940, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACDSKJM2TKXKDW5PL3K2M3ZDWSAPAVCNFSM6AAAAABIEYBLTGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMRWGUZDKOJUGA . You are receiving this because you authored the thread.Message ID: @.***>
It currently seems impossible (to me?) to convert a float into an integer inside a oneapi kernel. I tried with several functions like
round(Int, ...)
,trunc(Int, ...)
and also withconvert(Int(rount(...)))
but I always get a compilation error.Here is a self contained example with the corresponding error log.