<feed xmlns='http://www.w3.org/2005/Atom'>
<title>slang.git/source/slang-glslang/slang-glslang.cpp, 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>2025-10-01T02:55:25+00:00</updated>
<entry>
<title>Use glslang public API (#8369)</title>
<updated>2025-10-01T02:55:25+00:00</updated>
<author>
<name>Jeremy Hayes</name>
<email>jeremy-lunarg@users.noreply.github.com</email>
</author>
<published>2025-10-01T02:55:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=134c4c8db260979e2467153621d6f6a7ff1cddc7'/>
<id>urn:sha1:134c4c8db260979e2467153621d6f6a7ff1cddc7</id>
<content type='text'>
Stop including private header (see #8333).

Co-authored-by: Yong He &lt;yonghe@outlook.com&gt;</content>
</entry>
<entry>
<title>Rewriting the lower-buffer-element-type pass to avoid unnecessary packing/unpacking. (#8526)</title>
<updated>2025-09-30T00:45:08+00:00</updated>
<author>
<name>Yong He</name>
<email>yonghe@outlook.com</email>
</author>
<published>2025-09-30T00:45:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=a6deb5ed82cb8fc6b4f4c5c5fee264e09f97ff89'/>
<id>urn:sha1:a6deb5ed82cb8fc6b4f4c5c5fee264e09f97ff89</id>
<content type='text'>
Part of the effort to improve the performance of generated SPIRV code.

The existing lower-buffer-element-type pass works by loading the entire
buffer element content from memory, and translate it to logical type
stored in a local variable at the earliest reference of a buffer handle.
This means that is can generate inefficient code that reads more than
necessary.

Consider this example:
```
struct BigStruct { bool values[1024]; }
ConstantBuffer&lt;BigStruct&gt; cb;

void test(BigStruct v)
{
      if (v.values[0]) { printf("ok"); }
}

[numthreads(1,1,1)]
void computeMain()
{
    test(cb);
}
```

In IR, the `computeMain` function before lower-buffer-element-type pass
is something like following:
```
func test:
   %v = param : BigStruct
   %barr = fieldExtract(%v, "values")
   %element = elementExtract(%barr, 0)
    ... // uses %element 

func computeMain:
  %v = load(cb)
  call %test %v
```

The existing lower-buffer-element-type pass will rewrite the bool array
in `BigStruct` into `int` array so it is legal in SPIRV. However, it
does so by inserting the translation on the first `load` of the constant
buffer:

```
struct BigStruct_std430 {
    int values[1024];
}
var cb : ConstantBuffer&lt;BigStruct_std430&gt;;
func computeMain:
   %tmpVar : var&lt;BigStruct&gt;
    call %unpackStorage(%tmpVar, cb)
   %v : BigStruct = load %tmpVar
   call %test %v
```

This means that the entire array will be loaded and translated to int,
before calling `test`, which only uses one element. It turns out that
the downstream compiler isn't always able to optimize out this
inefficient translation/copy.

This PR completely rewrites the way buffer-element-type lowering is
handled to avoid producing this inefficient code. It works in two parts:
first we turn on the `transformParamsToConstRef` pass for SPIRV target
as well, so we will translate the `test` function to take the `v`
parameter as `constref`. The second part is a redesigned
buffer-element-type pass that defers the storage-type to logical-type
translation until a value is actually used by a `load` instruction.

In this example, after `transformParamsToConstRef`, the IR is:

```
func test:
   %v = param : ConstRef&lt;BigStruct&gt;
   %barr = fieldAddr(%v, "values")
   %elementPtr = elementAddr(%barr, 0)
   %element = load(%elementPtr)
    ... // uses %element 

func computeMain:
  call %test %cb
```

The new `buffer-element-type-lowering` pass will take this IR, and
insert translation at latest possible time across the entire call graph,
and translate the IR into:

```
func test:
   %v = param : ConstRef&lt;BigStruct_std430&gt;
   %barr = fieldAddr(%v, "values")
   %elementPtr : ptr&lt;int&gt; = elementAddr(%barr, 0)
   %element_int = load(%elementPtr)
    %element = cast(%element_int) : %bool
    ... // uses %element 

func computeMain:
  call %test %cb
```

In this new IR, there is no longer a load and conversion of the entire
array.

See new comment in `slang-ir-lower-buffer-element-type.cpp` for more
details of how the pass works.

This PR also address many other issues surfaced by turning on
`transformParamsToConstRef` pass on SPIRV backend.

---------

Co-authored-by: slangbot &lt;186143334+slangbot@users.noreply.github.com&gt;</content>
</entry>
<entry>
<title>Fix spurious vk::binding warnings when attribute is present (#7581)</title>
<updated>2025-07-02T17:44:43+00:00</updated>
<author>
<name>Copilot</name>
<email>198982749+Copilot@users.noreply.github.com</email>
</author>
<published>2025-07-02T17:44:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=cd28357bbeb56427032fd1e56c8b3749bcfeb854'/>
<id>urn:sha1:cd28357bbeb56427032fd1e56c8b3749bcfeb854</id>
<content type='text'>
* Initial plan

* Fix spurious vk::binding warnings when attribute is present

- Modified _maybeDiagnoseMissingVulkanLayoutModifier to check for GLSLBindingAttribute before warning
- Changed function to return bool indicating if warning was actually issued
- Updated call sites to properly track warning state to reduce duplicates
- Tested fix resolves the issue while preserving correct warnings when needed

Co-authored-by: csyonghe &lt;2652293+csyonghe@users.noreply.github.com&gt;

* Add test case for vk::binding spurious warning fix

Co-authored-by: csyonghe &lt;2652293+csyonghe@users.noreply.github.com&gt;

* Update test to use filecheck format as requested

Co-authored-by: csyonghe &lt;2652293+csyonghe@users.noreply.github.com&gt;

* Remove full file path from CHECK directives as requested

Co-authored-by: csyonghe &lt;2652293+csyonghe@users.noreply.github.com&gt;

* Fix code formatting with clang-format

Co-authored-by: csyonghe &lt;2652293+csyonghe@users.noreply.github.com&gt;

* Fix behavioral regression in vk-bindings test caused by warning flag logic

Co-authored-by: csyonghe &lt;2652293+csyonghe@users.noreply.github.com&gt;

---------

Co-authored-by: copilot-swe-agent[bot] &lt;198982749+Copilot@users.noreply.github.com&gt;
Co-authored-by: csyonghe &lt;2652293+csyonghe@users.noreply.github.com&gt;
Co-authored-by: Yong He &lt;yonghe@outlook.com&gt;</content>
</entry>
<entry>
<title>Update spirv-tools to for SDK v2025.2 (#6893)</title>
<updated>2025-04-25T17:39:45+00:00</updated>
<author>
<name>Gangzheng Tong</name>
<email>tonggangzheng@gmail.com</email>
</author>
<published>2025-04-25T17:39:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=d84aeeffdba388aec7a781c35973bf404d37fe80'/>
<id>urn:sha1:d84aeeffdba388aec7a781c35973bf404d37fe80</id>
<content type='text'>
* Update spirv-tools to for SDK v2025.2

Fixes: #6850

* bump spirv version to 1.4 for op linkage

* skip-spirv-validation for coop mat

* add skip-spirv-validation option to slang session desc

* use SPV_ENV_UNIVERSAL_1_6 for spirv-tool env target

Co-authored-by: slangbot &lt;186143334+slangbot@users.noreply.github.com&gt;

---------

Co-authored-by: slangbot &lt;ellieh+slangbot@nvidia.com&gt;
Co-authored-by: slangbot &lt;186143334+slangbot@users.noreply.github.com&gt;</content>
</entry>
<entry>
<title>IR: Add SPIR-V disassembly for embedded downstream IR dumps (#6529)</title>
<updated>2025-03-11T16:10:05+00:00</updated>
<author>
<name>Mukund Keshava</name>
<email>mkeshava@nvidia.com</email>
</author>
<published>2025-03-11T16:10:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=f59e0ef409844f2514435a8df8ceeff3663e5db3'/>
<id>urn:sha1:f59e0ef409844f2514435a8df8ceeff3663e5db3</id>
<content type='text'>
* IR: Add SPIR-V disassembly for embedded downstream IR dumps

When dumping IR that contains embedded downstream SPIR-V code (via
EmbeddedDownstreamIR instructions), display the disassembled SPIR-V
instead of just showing "&lt;binary blob&gt;".

This CL also does:
- Adds a new interface for disassembly and get result.
- Modify export-library-generics.slang test test to check for the
  disassembled SPIR-V

Fixes #6513

* Add module-dual-target-verify test

Fixes #6517
Adds a new test to verify that dxil and spirv targets are stored
separately in the precompiled blob.

* Fix review comments from cheneym2

* format code

---------

Co-authored-by: slangbot &lt;186143334+slangbot@users.noreply.github.com&gt;</content>
</entry>
<entry>
<title>UseHighestVersion when calling spirv-link (#6559)</title>
<updated>2025-03-10T19:57:49+00:00</updated>
<author>
<name>cheneym2</name>
<email>acheney@nvidia.com</email>
</author>
<published>2025-03-10T19:57:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=3058a5881aa9393573847229f77442d244655292'/>
<id>urn:sha1:3058a5881aa9393573847229f77442d244655292</id>
<content type='text'>
Precompiled SPIR-V bits can independently resolve to different
versions of SPIR-V.

To avoid a linker error about mismatched versions, use a linker
feature to automatically use the highest version listed in
the modules.

Fixes #6548</content>
</entry>
<entry>
<title>Support SPIR-V deferred linking option (#6500)</title>
<updated>2025-03-05T21:45:03+00:00</updated>
<author>
<name>cheneym2</name>
<email>acheney@nvidia.com</email>
</author>
<published>2025-03-05T21:45:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=0634684495f709fe3594fdcd483cfce7933e54eb'/>
<id>urn:sha1:0634684495f709fe3594fdcd483cfce7933e54eb</id>
<content type='text'>
The new option "SkipDownstreamLinking" will defer final downstream IR
linking to the user application. This option only has an effect if
there are modules that were precompiled to the target IR using
precompileForTarget().

Until now, the default behavior for SPIR-V was to use deferred linking, and
the default behavior for DXIL was to use immediate/internal linking in Slang.

This change only affects the SPIR-V behavior such that both deferred and
non-deferred linking is supported based on the new option.

To support the non-deferred option, Slang will internally call into
SPIRV-Tools-link to reconstitute a complete SPIR-V shader program when
necessary (due to modules having been precompiled to target IR).
Otherwise, if SkipDownstreamLinking is enabled, the shader returned by
e.g. getTargetCode() or getEntryPointCode() may have import linkage to
the SPIR-V embedded in the constituent modules.

Closes #4994

Co-authored-by: slangbot &lt;186143334+slangbot@users.noreply.github.com&gt;</content>
</entry>
<entry>
<title>Fix precompiledTargetModule tests (#6455)</title>
<updated>2025-02-27T02:20:29+00:00</updated>
<author>
<name>cheneym2</name>
<email>acheney@nvidia.com</email>
</author>
<published>2025-02-27T02:20:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=02706dfc5f0526f4f8ca337be16d7b00640ba168'/>
<id>urn:sha1:02706dfc5f0526f4f8ca337be16d7b00640ba168</id>
<content type='text'>
* Fix precompiledTargetModule tests

Add SPIRV-Tool linker support to gfx unit tests
and use the linker in precompileModule tests
that use precompiled modules to reconstitute
SPIRV shaders that were modularly compiled.

Fix a Slang reference count bug in the
precompile service.

* Use sm_6_6

New DXC requires higher version
for linkability.

* Rename helper function, pass by reference

* Link through slang-glslang

* Add missing files

* Fix metal

* format code

---------

Co-authored-by: slangbot &lt;186143334+slangbot@users.noreply.github.com&gt;
Co-authored-by: Yong He &lt;yonghe@outlook.com&gt;</content>
</entry>
<entry>
<title>Enable friendly-name option for SPIRV dump and validation (#6465)</title>
<updated>2025-02-26T21:03:06+00:00</updated>
<author>
<name>Jay Kwak</name>
<email>82421531+jkwak-work@users.noreply.github.com</email>
</author>
<published>2025-02-26T21:03:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=519e866ff44ec728f95c191fff8a200b66a5377e'/>
<id>urn:sha1:519e866ff44ec728f95c191fff8a200b66a5377e</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Use disassemble API from SPIRV-Tools (#6001)</title>
<updated>2025-01-07T09:35:47+00:00</updated>
<author>
<name>Jay Kwak</name>
<email>82421531+jkwak-work@users.noreply.github.com</email>
</author>
<published>2025-01-07T09:35:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=5621ace93b7665051f7e7c8a2fa68ceaf285ff8d'/>
<id>urn:sha1:5621ace93b7665051f7e7c8a2fa68ceaf285ff8d</id>
<content type='text'>
* Use disassemble API from SPIRV-Tools

This commit uses C API version of SPIRV disassemble function rather than
calling spirv-dis.exe.

This allows us to use a correct version of SPIRV disassble function that
Slangc.exe is using.

The implementation is mostly copied from external/spirv-tools/tools/dis/dis.cpp, which is a source file for building spirv-dis.exe.

This commit also includes a fix for a bug in RPC communication to `test-server`.

When an RPC connection to `test-server.exe` is reused and the second
test abruptly fails due to a compile error or SPIRV validation error,
the output from the first test run was incorrectly reused as the output
for the second test.

This commit resets the RPC result before waiting for the response so
that even when the RPC connection is erratically disconnected, the
result from the previous run will not be reused incorrectly.

Some of the tests appear to be relying on this type of behavior. By
using an option, `-skip-spirv-validation`, the RPC connection will
continue without an interruption.</content>
</entry>
</feed>
