<feed xmlns='http://www.w3.org/2005/Atom'>
<title>slang.git/tests/slang-extension/atomic-float-byte-address-buffer-cross.slang.glsl, branch master</title>
<subtitle>Making it easier to work with shaders</subtitle>
<id>https://git.yummers.dev/slang.git/atom?h=master</id>
<link rel='self' href='https://git.yummers.dev/slang.git/atom?h=master'/>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/'/>
<updated>2023-08-22T00:07:34+00:00</updated>
<entry>
<title>Compile append and consume structured buffers to glsl. (#3142)</title>
<updated>2023-08-22T00:07:34+00:00</updated>
<author>
<name>Yong He</name>
<email>yonghe@outlook.com</email>
</author>
<published>2023-08-22T00:07:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=bd6dbaf7c3ea720b4ed39904fe08878f9dcbd947'/>
<id>urn:sha1:bd6dbaf7c3ea720b4ed39904fe08878f9dcbd947</id>
<content type='text'>
* Compile append and consume structured buffers to glsl.

* Fix.

* Update CI config.

---------

Co-authored-by: Yong He &lt;yhe@nvidia.com&gt;</content>
</entry>
<entry>
<title>Fix optimization pass not converging. (#2725)</title>
<updated>2023-03-23T23:59:02+00:00</updated>
<author>
<name>Yong He</name>
<email>yonghe@outlook.com</email>
</author>
<published>2023-03-23T23:59:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=50e7d9797d9bf4b98a056d5df128c24dde6e78bd'/>
<id>urn:sha1:50e7d9797d9bf4b98a056d5df128c24dde6e78bd</id>
<content type='text'>
* Fix optimization pass not converging.

* Fix.

* Fix tests.

---------

Co-authored-by: Yong He &lt;yhe@nvidia.com&gt;</content>
</entry>
<entry>
<title>More control flow simplifications. (#2673)</title>
<updated>2023-02-24T18:01:47+00:00</updated>
<author>
<name>Yong He</name>
<email>yonghe@outlook.com</email>
</author>
<published>2023-02-24T18:01:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=bd6306cdaa4a49344658bd026721b6532e103d09'/>
<id>urn:sha1:bd6306cdaa4a49344658bd026721b6532e103d09</id>
<content type='text'>
* More control flow and Phi param simplifications.

* Fix.

* Fix gcc error.

* Fix.

* More IR cleanup.

* Fix bug in phi param dce + ifelse simplify.

* Propagate and DCE side-effect-free functions.

* Enhance CFG simplifcation to remove loops with no side effects.

* Fix.

* Fixes.

* Fix tests. Add [__AlwaysFoldIntoUseSite] for rayPayloadLocation.

* More cleanup.

* Fixes.

* Fix.

---------

Co-authored-by: Yong He &lt;yhe@nvidia.com&gt;</content>
</entry>
<entry>
<title>Work to mitigate SPIR-V bloat (#1914)</title>
<updated>2021-07-21T19:52:08+00:00</updated>
<author>
<name>Theresa Foley</name>
<email>tfoleyNV@users.noreply.github.com</email>
</author>
<published>2021-07-21T19:52:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=23d406f8a3b325f91fecd9ad52bd510ded5f49a7'/>
<id>urn:sha1:23d406f8a3b325f91fecd9ad52bd510ded5f49a7</id>
<content type='text'>
* Work to mitigate SPIR-V bloat

SPIR-V is not an especially compact format, but some patterns in how Slang generates code and then runs it through `spirv-opt` lead to many redundant field-by-field copy operations being emitted. This change attempts to address some of the resulting bloat from the Slang side of things.

Note: experimentation shows that the bloat is less pronounced when running either *no* SPIR-V optimizations or *full* SPIR-V optimizations, so it is also likely that the bloat should be addressed by changing which `spirv-opt` passes the Slang compiler runs in default (`-O1`) builds. Such changes should come as a distinct pull request.

This change primarily does two things:

First, the code generation strategy for passing arguments to `out` and `inout` parameters has been changed. In the past, the compiler would *always* copy the argument value into a temporary, then pass the address of the temporary, and then write back the value after the call. The new code generation strategy attempts to identify when an argument value already has a simple address in memory and passes that address directly when possible. This eliminates many copy operations that occur before/after calls to functions with `out`/`inout` parameters.

Second, we introduce an IR optimization pass that detects call sites where the entire contents of a buffer (usually a constant buffer) is being passed to a callee function, such that many bytes are loaded and then passed even if only very few are used in the callee. The pass moves the load operations from the caller to a specialized version of the the callee where possible (e.g., when the constant buffer in question is a global shader parameter). Doing this eliminates another major category of copies.

Notes:

* The IR lowering logic is complicated by the fact that several kinds of l-values (values that are usable as the desitnation of assignment, or for `out`/`inout` arguments) are not actually addressable. An easy example is a non-contiguous swizzle like `v.xwz` on a `float4`, where the value occupies 12 bytes, but not 12 consecutive bytes with a single address. There are many more corner cases like that and the IR lowering pass carries a lot of complexity to deal with them. A more systematic overhaul is due some time soon.

* The IR representation of `out` and `inout` parameters deserves some careful scrutiny when making these kinds of changes. The official semantics of `inout` in HLSL has been "copy in copy out" (and `out` is just "copy out") which is observably different from any solution that passes in the address of an l-value directly. By making this change we are saying that Slang's semantics are not precisely those of legacy HLSL, and that our semantics for `inout` parameters are closer to those of `inout` in Swift or of a mutable borrow in Rust. In the Swift case the implementation can freely pass the underlying storage of an l-value or the address of a temporary, and valid programs may not observe the different. It is thus illegal to observe the value in a storage local while a mutation to that location is "in flight." All of this is way more detailed and technical than 99% of Slang users will ever care about, but importantly it gives us semantic cover to eliminate these copies in the IR, and also to emit output C++ code that implements `out` and `inout` as by-reference parameter passing.

* There was an exsting generic pass for specializing functions based on call sites that uses a "template method" style of pattern to customize its behavior. That pass needed to be generalized to handle this use case because it had previously operated on the assumption that the "desire" to specialize a callee function must be driven by the parameter declarations of that function, and not on the argument values passed in. The code has been slightly refactored to allow the policy for specialization to consider both parameters and arguments.

* Unsurprisingly, a bunch of the GLSL (and thus SPIR-V) generated has changed with this work, so several baseline `.slang.glsl` files needed to be updated.

* This change is incomplete in that it does not address broader cases of buffer loads, including both partial loads from constant buffers (just loading one field, but a field that uses a "large" structure type), and loads from multi-element buffers (a lot from a structured buffer where the element type is "large"). The main question in each of those cases is how to define how "large" a structure needs to be before we decide to try and sink loads into callee functions like this. In the worst case, sinking loads in this way may actually create *more* memory traffic (because the same values get loaded in multiple callee functions).

* fixup: run premake

* fixup: typo</content>
</entry>
<entry>
<title>Enable all dynamic dispatch tests on CUDA. (#1552)</title>
<updated>2020-09-21T15:27:10+00:00</updated>
<author>
<name>Yong He</name>
<email>yonghe@outlook.com</email>
</author>
<published>2020-09-21T15:27:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=83514bd25160a9af91abc1b9acd7e44657447526'/>
<id>urn:sha1:83514bd25160a9af91abc1b9acd7e44657447526</id>
<content type='text'>
* Enable all dynamic dispatch tests on CUDA.

* Fix expected cross-compile test results.</content>
</entry>
<entry>
<title>RWByteAddressBuffer::InterlockedCompareExchangeU64 (#1513)</title>
<updated>2020-08-24T19:23:40+00:00</updated>
<author>
<name>jsmall-nvidia</name>
<email>jsmall@nvidia.com</email>
</author>
<published>2020-08-24T19:23:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=4804753d4a2ec389cc6ecd759f7ea712848fddf0'/>
<id>urn:sha1:4804753d4a2ec389cc6ecd759f7ea712848fddf0</id>
<content type='text'>
* First pass at incorporating nvapi into test harness.

* D3d12 Atomic Float Add via NVAPI working

* Dx12 atomic float appears to work.

* Atomic float add on Dx12.

* Added atomic64 feature addition to vk.
Fix correct output for atomic-float-byte-address.slang

* Disable atomic float failing tests.

* Upgraded VK headers.

* Detect atomic float availability on VK.

* Try to get test working for in64 atomic.

* Made HLSL prelude controlled via the render-test requirements.

* Added -enable-nvapi to premake.

* Fix D3D12Renderer when NVAPI is not available.

* Small improvements to VKRenderer.

* Improve atomic documentation in target-compatibility.md.

* Fixed NVAPI working on D3D12.

* Test for specific NVAPI features.

* Remove requiredFeatures from Renderer::Desc as was ignored. Tried to document more around nvapiExtnSlot.

* Readded requiredFeatures to Renderer::Desc

* Improve comments in the tests.

* Rename Fp32 -&gt; F32
Added cas-int64-byte-address-buffer.slang test

Co-authored-by: Tim Foley &lt;tfoleyNV@users.noreply.github.com&gt;</content>
</entry>
<entry>
<title>Support for float atomics on RWByteAddressBuffer (#1502)</title>
<updated>2020-08-18T17:42:46+00:00</updated>
<author>
<name>jsmall-nvidia</name>
<email>jsmall@nvidia.com</email>
</author>
<published>2020-08-18T17:42:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=9abcb6ea24dbc7184c3a2ad9f4458f63f8901928'/>
<id>urn:sha1:9abcb6ea24dbc7184c3a2ad9f4458f63f8901928</id>
<content type='text'>
* Fix premake5.lua so it uses the new path needed for OpenCLDebugInfo100.h

* Keep including the includes directory.

* Added the spirv-tools-generated files.

* We don't need to include the spirv/unified1 path because the files needed are actually in the spirv-tools-generated folder.

* Put the build_info.h glslang generated files in external/glslang-generated. Alter premake5.lua to pick up that header.

* First pass at documenting how to build glslang and spirv-tools.

* Improved glsl/spir-v tools README.md

* Added revision.h

* Change how gResources is calculated.
Update about revision.h

* Update docs a little.

* Split out spirv-tools into a separate project for building glslang. This was not necessary on linux, but *is* necessary on windows, because there is a file disassemble.cpp in spirv-tools and in glslang, and this leads to VS choosing only one. With the separate library, the problem is resolved.

* Fix direct-spirv-emit output.

* Update to latest version of spirv headers and spirv-tools.

* Upgrade submodule version of glslang in external.

* Add fPIC to build options of slang-spirv-tools

* WIP adding support for InterlockedAddFp32

* Upgrade slang-binaries to have new glslang.

* Fix issues with Windows slang-glslang binaries, via update of slang-binaries used.

* WIP - atomicAdd. This solution can't work as we can't do (float*) in glsl.

* WIP on atomic float ops.

* Added checking for multiple decls that takes into account __target_intrinsic and __specialized_for_target.
First pass impl of atomic add on float for glsl.

* Split __atomicAdd so extensions are applied appropriately.

* Made Dxc/Fxc support includes.
Use HLSL prelude to pass the path to nvapi
Added -nv-api-path

* Refactor around IncludeHandler and impl of IncludeSystem

* slang-include-handler -&gt; slang-include-system
Have IncludeHandler/Impl defined in slang-preprocessor

* Small comment improvements.

* Document atomic float add addition in target-compatibility.md.

* CUDA float atomic support on RWByteAddressBuffer.

* Add atomic-float-byte-address-buffer-cross.slang

* Removed inappropriate-once.slang - the test is no longer valid when a file is loaded and has a unique identity by default. A test could be made, but would require an API call to create the file (so no unique id).
Improved handling of loadFile - uses uniqueId if has one.

* Work around for testing target overlaps - to avoid exceptions on adding targets.
Simplify PathInfo setup.
Modify single-target-intrinsic.slang - it no longer failed because there were no longer multiple definitions for the same target.

Co-authored-by: Tim Foley &lt;tfoleyNV@users.noreply.github.com&gt;</content>
</entry>
</feed>
