-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[WGSL] Add support for calls with simple built-in types #14076
[WGSL] Add support for calls with simple built-in types #14076
Conversation
EWS run on current version of this PR (hash 650d0c5) |
static constexpr std::pair<ComparableASCIILiteral, ASCIILiteral> baseTypesMappings[] { | ||
{ "f32", "float"_s }, | ||
{ "i32", "int"_s }, | ||
{ "u32", "unsigned"_s } | ||
}; |
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.
Is this really the right way to do it? Users can create their own types, and their own types will have these kind of constructors too - but we can't literally list the user-defined types inside our WGSL compiler. I'd imagine both the user-defined type constructors and the primitive type constructors would be handled with the same infrastructure.
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.
No, this is isn't the right way to do it. But as I mentioned in the changelog, our whole definition of CallExpression
needs to change, as we currently only allow types as the target, so this will all need to be refactored. I'm thinking that later we'll distinguish whether we're constructing a type or calling a function, and if we're constructing a type we can use the inferred type which would already account for any aliasing.
https://bugs.webkit.org/show_bug.cgi?id=257028 rdar://109564906 Reviewed by Myles C. Maxfield. Allow function calls with simple built-in types (i.e. function-style cast) such as `f32(x)`. The way we currently handle it is not great, since we treat type names as keywords in the lexer, but all of this will have to be refactored soon when we update the parser to solve the template ambiguity. For now, this unblocks a few more CTS tests to pass. * Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp: (WGSL::Metal::FunctionDefinitionWriter::visit): * Source/WebGPU/WGSL/Parser.cpp: (WGSL::Parser<Lexer>::parsePrimaryExpression): Canonical link: https://commits.webkit.org/264314@main
650d0c5
to
e511c23
Compare
Committed 264314@main (e511c23): https://commits.webkit.org/264314@main Reviewed commits have been landed. Closing PR #14076 and removing active labels. |
e511c23
650d0c5