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

generator redesign #99

Draft
wants to merge 14 commits into
base: main
Choose a base branch
from
Draft

generator redesign #99

wants to merge 14 commits into from

Conversation

leios
Copy link
Owner

@leios leios commented Jul 12, 2024

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
  • 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
Copy link
Owner Author

leios commented Jul 15, 2024

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
Copy link
Owner Author

leios commented Jul 15, 2024

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