@kernel function naive_chaos_kernel!(points, n, H_fxs, H_kwargs,
H_clrs, H_clr_kwargs,
H_probs, H_fnums,
layer_values, layer_reds, layer_greens,
layer_blues, layer_alphas, frame, bounds,
bin_widths, num_ignore, max_range)
tid = @index(Global,Linear)
pt = Ref(point(0.0,0.0))
pt[] = points[tid]
dims = Fae.dims(pt[])
clr = Ref(RGBA{Float32}(0,0,0,0))
seed = quick_seed(tid)
fid = create_fid(H_probs, H_fnums, seed)
for i = 1:n
# quick way to tell if in range to be calculated or not
sketchy_sum = absum(pt[])
if sketchy_sum < max_range
if length(H_fnums) > 1 || H_fnums[1] > 1
seed = simple_rand(seed)
fid = create_fid(H_probs, H_fnums, seed)
else
fid = UInt(1)
end
choices = find_random_fxs(fid, H_fnums, H_probs)
#ntuple(Val(choices)) do k
for k in NTuple(Val.(choices))
Base.@_inline_meta
pt[] = H_fxs[k](pt[].y, pt[].x, frame; H_kwargs[k]...)
clr[] = H_clrs[k](pt[].y, pt[].x, clr[], frame; H_clr_kwargs[k]...)
end
histogram_output!(layer_values, layer_reds, layer_greens,
layer_blues, layer_alphas, pt[], clr[],
bounds, dims, bin_widths, i, num_ignore)
end
end
@inbounds points[tid] = pt[]
end
I couldn't quite figure out how to go from the tuple of ints to an ntuple of vals.
The core issue is that LLVM cannot optimize on the tuple of functions because each function is a unique type, so it cannot be stored as an ntuple to begin with.
Right now, there is a mess of
@generatedfunctions inrun/fractal_flame.jl. In principle, these can be removed by...ie, finding some way to iterate through known values with
ntuple, like: https://github.com/CliMA/ClimateMachine.jl/blob/2e0b6b7d97719e410d12a8596c98d5db7f891dbf/src/Numerics/DGMethods/remainder.jl#L510I couldn't quite figure out how to go from the tuple of ints to an ntuple of vals.
The core issue is that LLVM cannot optimize on the tuple of functions because each function is a unique type, so it cannot be stored as an ntuple to begin with.
This discussion was introduced in #64