-
Notifications
You must be signed in to change notification settings - Fork 7
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
Complete Refactor, also add track
macro and ::expr
, .var
commands.
#10
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Thank you! It looks amazing! Let me review the changes and I'll merge if everything looks good. |
shiinamiyuki
approved these changes
Sep 18, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very good.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request does a number of things:
Float4::expr
statements from Replacemake_float4
withFloat4::expr
, etc. #7.luisa_compute
crate, making theluisa_compute::prelude
import suitable for general use, and reducing things exposed at the top level.const_
,var!
,def!
functions, instead replacing them withx.expr()
,Var::<X>::zeroed()
, andx.var()
respectively (x.var()
works for both values and exprs).track
, which significantly simplifies kernel syntax.Refactoring changes:
The primary change made is that after importing
luisa::prelude
, the primitive expression types are hidden behind an import ofluisa::lang::types::core::*
. Similarily,Float4Expr
is behindluisa::lang::types::vector
. This is done as there usually isn't much of a reason to use the directFloat4Expr
,Float
types, and theExpr<f32>
types are easier to keep track of due to their regularity.Additionally,
luisa::lang::printer
was moved toluisa::printer
, most functions were put inluisa::lang::functions
, and control flow inluisa::lang::control_flow
, and the previousKernel
types inluisa::lang
were moved toluisa::runtime::kernel
, which is exported inluisa::runtime
. I also added aluisa::internal_prelude
module, which provides most imports necessary normally.Why remove
const_
?The primary reason I made this change is that the
const_
,var!
,def!
expressions were unnecessarily noisy, and somewhat confusing about their purpose -var!
does not provide an indication anywhere that it fills a place with zeros.track
macro:The
track
macro rewrites the expression within it, replacing comparison and control flow operators (and||
and&&
) with variants that can work either in anExpr
context or outside of it. For example, this allowed converting this section in the mpm example:into
which is significantly easier to read.