Fable.jl icon indicating copy to clipboard operation
Fable.jl copied to clipboard

Generator redesign

Open leios opened this issue 7 months ago • 0 comments

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
  • [ ] Create an AbstractGenerator, where one of them is RandomGenerator (1)
  • [ ] FractalObjects now define generators
    • [x] Also define -> create
  • [ ] Remove num_particles and num_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!
  1. 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)
  1. 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

leios avatar May 25 '25 13:05 leios