Skip to content

generator redesign#99

Draft
leios wants to merge 16 commits into
mainfrom
remove_points
Draft

generator redesign#99
leios wants to merge 16 commits into
mainfrom
remove_points

Conversation

@leios

@leios leios commented Jul 12, 2024

Copy link
Copy Markdown
Owner

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...

  • 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 return on @fums and we can @splat whenever in the @fum
  • Create an AbstractGenerator, where one of them is RandomGenerator (1)
  • FractalObjects now define generators
    • 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 leios marked this pull request as draft July 12, 2024 14:12
@leios

leios commented Jul 15, 2024

Copy link
Copy Markdown
Owner Author

Thinking on this more, I think...

  1. All primitivs are still FableOperators
  2. the generator should create a specific @generated template to follow, so we can still do chaos game for as many steps as we want
  3. multiple Fable objects still compose into an executable by following the generator templates

@leios

leios commented Jul 15, 2024

Copy link
Copy Markdown
Owner Author

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 #99 here (remember to color 1st and then move!).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant