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

[goal] Support loop unrolling with :unroll factor #3449

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Brent-Hickey
Copy link
Contributor

Not sure if this will actually be useful but thought it'd be cool to support

Supports optional loop unrolling with :unroll factor
Supports (_ x) syntax to unroll without binding and incrementing a variable when fully unrolled. Otherwise uses gensym var to iterate.

Could add to countdown as well

Examples:

 (dotimes (_ 4) :unroll 4
    (print "hi")
  )

(begin (print "hi") (print "hi") (print "hi") (print "hi"))

(unchanged)

(dotimes (i 4)
    (format #t "i: ~D~%" i)
  )

((lambda :immediate #t (i) (while (< i 4)
                             :label #f
                             (block continue (format #t "i: ~D~%" i) (1+! i))
                             )
         )
 0
 )
(dotimes (_ 4) :unroll 2
    (print "hi")
  )

((lambda :immediate
   #t
   (gensym20077)
   (while (< gensym20077 4)
     :label #f
     (block continue (print "hi") (1+! gensym20077) (print "hi") (1+! gensym20077))
     )
   )
 0
 )
(dotimes (i 4) :unroll 4
    (format #t "i: ~D~%" i)
  )

((lambda :immediate
   #t
   (i)
   (format #t "i: ~D~%" i)
   (1+! i)
   (format #t "i: ~D~%" i)
   (1+! i)
   (format #t "i: ~D~%" i)
   (1+! i)
   (format #t "i: ~D~%" i)
   (1+! i)
   )
 0
 )

@xTVaser xTVaser added this to the July 2024 milestone May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

None yet

2 participants