Skip to content
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

Infinite partial_mapreduce_device recursion #426

Closed
michel2323 opened this issue Apr 18, 2024 · 1 comment
Closed

Infinite partial_mapreduce_device recursion #426

michel2323 opened this issue Apr 18, 2024 · 1 comment
Labels
arrays Things about the array abstraction. bug Something isn't working

Comments

@michel2323
Copy link

michel2323 commented Apr 18, 2024

When running

julia --project -e 'using oneAPI; sum(oneAPI.zeros(30000)) ; sum(oneAPI.zeros(2182))'

the reduction for the 30,000 case runs fine. However, for the 2182 it crashes with an InvalidIRError.

I then added some debug output into

oneAPI.jl/src/mapreduce.jl

Lines 164 to 178 in 7973a89

if reduce_groups == 1
# we can cover the dimensions to reduce using a single group
@oneapi items groups partial_mapreduce_device(
f, op, init, Val(items), Rreduce, Rother, R′, A)
else
# we need multiple steps to cover all values to reduce
partial = similar(R, (size(R)..., reduce_groups))
if init === nothing
# without an explicit initializer we need to copy from the output container
partial .= R
end
@oneapi items groups partial_mapreduce_device(
f, op, init, Val(items), Rreduce, Rother, partial, A)
GPUArrays.mapreducedim!(identity, op, R′, partial; init=init)
.

It seems the recursion for the 2182 is infinite. I would suspect it to be shallower than for the 30000 case. I attached a log with some debug output. Maybe there is something obvious to you @maleadt .

out.log

@maleadt
Copy link
Member

maleadt commented Apr 19, 2024

Looks like Level Zero's zeKernelSuggestGroupSize doesn't like prime-sized global sizes:

julia> k = @oneapi launch=false identity(nothing)

julia> oneL0.suggest_groupsize(k.fun, 521)
oneAPI.oneL0.ZeDim3(1, 1, 1)

julia> oneL0.suggest_groupsize(k.fun, 7877)
oneAPI.oneL0.ZeDim3(1, 1, 1)

julia> oneL0.suggest_groupsize(k.fun, 7919)
oneAPI.oneL0.ZeDim3(1, 1, 1)

These are really bad launch configurations... Maybe I'm misinterpreting the API?

EDIT: it seems to suggest really bad configurations for non-prime inputs too:

julia> oneL0.suggest_groupsize(k.fun, 8000)
oneAPI.oneL0.ZeDim3(64, 1, 1)

julia> oneL0.suggest_groupsize(k.fun, 512)
oneAPI.oneL0.ZeDim3(512, 1, 1)

@maleadt maleadt added bug Something isn't working arrays Things about the array abstraction. labels Apr 19, 2024
@maleadt maleadt closed this as completed Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrays Things about the array abstraction. bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants