generator redesign
Right now, Fable is reliant on a lot of fractally concepts (Chaos game, Fractal Flame method, etc). This does not need to be the case, and it is better to move all the fractally things out so we can create the FableObjects with other generation functions, so...
- [x] Remove the Global array of points from FableLayer
- [ ] Combine color and pt functions that mutate a point struct with a color already associated with it. That way, there is no
returnon@fums and we can@splatwhenever in the@fum - [ ] Create an
AbstractGenerator, where one of them isRandomGenerator(1) - [ ] FractalObjects now define generators
- [x] Also
define->create
- [x] Also
- [ ] Remove
num_particlesandnum_iterations(2) - [ ] Remove random iteration option and instead find a way to properly iterate (possibly with a stack for recursion?)
- [ ] No moure double-loop structure
- [ ] Still loop over number of generators for multiple objects per kernel run
- [ ] No longer call it
fractal_flame(this method is still possible as a generator)
- [ ]
H_post->transformations - [ ] Performance test to
main - [ ] combine kwargs for final launch, send error if two identical kwargs don't match
- [ ] Document!
- Something like:
abstract type AbstractGenerator end;
struct ChaosGenerator{F, A, I}
f::F
args::A
iterations::I
end
# All generators should create a run function to be called from the kernel
pt = run(gen::AbstractGenerator) = gen.f(tid, gen.args...)
function ChaosGame(tid, bounds, random_function, f_set, dims, n)
pt = randon_function(seed(tid), bounds, dims...)
# now do Chaos Game for n iterations
end
gen = ChaosGenerator(ChaosGame, (bounds, random_function, f_set...), 1000)
- These parameters are not necessary. num_particles is really just limiting the scope of our kernel and causing unnecessary trips to global memory. num_iterations should now be set by the generator and iterated on as an ndrange
Thinking on this more, I think...
- All primitivs are still FableOperators
- the
generatorshould create a specific@generatedtemplate to follow, so we can still do chaos game for as many steps as we want - multiple Fable objects still compose into an executable by following the generator templates
Ok, jotting down some more notes here. The generators should be <: FableOperator. Because we want to minimize the number of @generated functions, we should @generate based on each operator and then loop over them in the main kernel (note that this might need another @generated function at the fee level).
Also, we might as well add in the first part of https://github.com/leios/Fable.jl/pull/99 here (remember to color 1st and then move!).