WebKit Bugzilla
Attachment 343824 Details for
Bug 187147
: [WSL] Adding MSL generation notes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-187147-20180628114713.patch (text/plain), 3.99 KB, created by
Thomas Denney
on 2018-06-28 11:47:14 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Thomas Denney
Created:
2018-06-28 11:47:14 PDT
Size:
3.99 KB
patch
obsolete
>Index: Tools/ChangeLog >=================================================================== >--- Tools/ChangeLog (revision 233314) >+++ Tools/ChangeLog (working copy) >@@ -1,3 +1,15 @@ >+2018-06-28 Thomas Denney <tdenney@apple.com> >+ >+ [WSL] Adding MSL generation notes >+ https://bugs.webkit.org/show_bug.cgi?id=187147 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Added my notes on how MSL is generated from WSL and corrected typo in evaluator. >+ >+ * WebGPUShadingLanguageRI/Evaluator.js: >+ * WebGPUShadingLanguageRI/MetalCodeGenNotes.md: Added. >+ > 2018-06-28 Daniel Bates <dabates@apple.com> > > Fix the iOS build following r233299 >Index: Tools/WebGPUShadingLanguageRI/Evaluator.js >=================================================================== >--- Tools/WebGPUShadingLanguageRI/Evaluator.js (revision 233307) >+++ Tools/WebGPUShadingLanguageRI/Evaluator.js (working copy) >@@ -33,7 +33,7 @@ class Evaluator extends Visitor { > } > > // You must snapshot if you use a value in rvalue context. For example, a call expression will >- // snapshot all of its arguments immedaitely upon executing them. In general, it should not be >+ // snapshot all of its arguments immediately upon executing them. In general, it should not be > // possible for a pointer returned from a visit method in rvalue context to live across any effects. > _snapshot(type, dstPtr, srcPtr) > { >Index: Tools/WebGPUShadingLanguageRI/MetalCodeGenNotes.md >=================================================================== >--- Tools/WebGPUShadingLanguageRI/MetalCodeGenNotes.md (nonexistent) >+++ Tools/WebGPUShadingLanguageRI/MetalCodeGenNotes.md (working copy) >@@ -0,0 +1,55 @@ >+# Metal Shader Language code generation >+ >+This document contains general notes on the translation of WSL to MSL. >+ >+## TODO list/current plan >+ >+* Correct mapping types like `vecN<float32>` to types `floatN` >+* Handling of special WSL attribtues, e.g. `wsl_Position`, `wsl_Color`, `wsl_vertexID` and others >+* Translation of reference types, including array references >+* Translation of function declarations >+* Translation of function definitions >+* Correct handlign of operator declarations. I think all operators in the standard library can be mapped to operators in MSL, but I need to be careful >+* Bounds checks >+ >+## Type translation >+ >+* All native scalar types are mapped to their obvious MSL equivalent. A potential issue with this mapping is that `float64` in WSL is mapped to `double` in MSL, which Metal doesn't natively support. In Xcode it is possible to compile shaders that use `double` with the `-fnative-double` flag at compile time but this option **is not** available when compiling with [makeLibrary(source:options:completitionHandler:)][makeLibrary], see [MTLCompileOptions][] >+* Enum types are also translated in the obvious way --- **recurison in enum declarations is not checked due to a bug in the existing parser** >+* Structure types are currently translated directly to C++ structures. In the long term this will not be necessary as all operations on structures can be desugared to operations on local variables >+* Forward declarations are inserted for *all* user-defined types >+* Structure declarations are re-ordered so that if a type `B` (structurally) depends on type `A` then `A` is defined before `B` >+ >+[makeLibrary]: https://developer.apple.com/documentation/metal/mtldevice/1433351-makelibrary >+[MTLCompileOptions]: https://developer.apple.com/documentation/metal/mtlcompileoptions >+ >+### Reference types >+ >+* References are mapped directly to C++ pointers >+* Array references are compiled to a generic structure: >+ >+```cpp >+template<typename T> >+struct ArrayRefThread { >+ thread T* ptr; >+ size_t length; >+}; >+ >+template<typename T> >+struct ArrayRefThreadgroup { >+ threadgroup T* ptr; >+ size_t length; >+}; >+ >+template<typename T> >+struct ArrayRefDevice { >+ device T* ptr; >+ size_t length; >+}; >+ >+template<typename T> >+struct ArrayRefConst { >+ device T* ptr; >+ size_t length; >+}; >+``` >\ No newline at end of file
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 187147
:
343824
|
343990
|
343997
|
344255
|
344396
|
344505
|
344512
|
344522
|
344707
|
344866