-
Notifications
You must be signed in to change notification settings - Fork 178
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
Add WGSL support for slang-test #5174
base: master
Are you sure you want to change the base?
Conversation
@csyonghe Should I use the |
There are some things that seem a bit strange about this: I have added "WGSL SPIR-V" and "WGSL SPIR-V assembly" targets in a bunch of places just to be able to express that I want Tint to produce the SPIR-V. @csyonghe |
9d470a5
to
983d6fa
Compare
To answer your questions: all enums need to be added at the end to avoid binary breakage. Defining wasm-spirv and wasm-spirv-asm as separate targets is fine. |
983d6fa
to
3139299
Compare
Instead of adding |
I can do that, but these tests are asserting which seems to interrupt the test run a lot. Disabling gets rid of that problem. Do you still think I should just mark these as test failures? |
As discussed on Slack I will keep these disabled and then also add to the expected-failure list. |
sourceArtifact->loadBlob(ArtifactKeep::Yes, sourceBlob.writeRef()) | ||
); | ||
|
||
std::string |
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.
Use String instead of std::string.
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.
Done
|
||
tint_CompileResult result = {}; | ||
int const resultCode {m_compile(&req, &result)}; | ||
if (resultCode != 0) |
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.
Leaking memory on tint_compileResult.
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.
Use SLANG_DEFER to ensure things are freed:
auto rs = m_compile(&result);
SLANG_DEFER(m_free(&result));
if (rs != 0) ...
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.
Do you mean m_compile fails? A common convention (which is followed in this case) is to make sure that no resources are actually returned if the call fails.
extern "C"
SLANG_SHARED_LIB_EXPORT
int tint_compile(tint_CompileRequest* request, tint_CompileResult* result)
{
///...
uint8_t *const resultBuffer {static_cast<uint8_t*>(::malloc(resultBufferSize))};
if(resultBuffer == nullptr)
return 1;
::memcpy(resultBuffer, spirvCode.data(), resultBufferSize);
result->buffer = resultBuffer;
result->bufferSize = resultBufferSize;
return 0;
}
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.
(But of course I may as well add a DEFER anyway.)
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.
How do we report back diagnostics returned by tint?
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.
Done. I added an error field to the slang-tint result struct.
https://github.com/shader-slang/dawn/blob/slang-tint/src/slang-tint/slang-tint.cpp#L62
On coding style: Long function signature should either be
Or
|
415aff1
to
77ed29d
Compare
I believe this is a bugfix. It seems to have worked before because up until the WGSL case, the disassembler has been the same executable as the one producing the binary to be disassembled.
This closes issue shader-slang#5104. * Add downstream compiler for Tint. * Tint is wrapped in a shared library, 'slang-tint' available from [1]. * The header file for slang-tint.dll is added in external/slang-tint-headers. * Add some boilerplate for WGSL targets. * Add an entry point test for WGSL. [1] https://github.com/shader-slang/dawn/releases/tag/slang-tint-0
This helps to address issue shader-slang#5051.
This closes issue shader-slang#5051.
Reading the ci log it doesn't seem wgpu is reported as supported and no tests are run for wgpu. I merged Simon's and see if ci can pick up the tests this time. |
slang-test
to target WebGPU and WGSL using the newly added RHI supportslang-test
tests intests/compute