<feed xmlns='http://www.w3.org/2005/Atom'>
<title>slang.git/source/slang-glslang, 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>export fewer things from module targets (#8089)</title>
<updated>2025-08-07T06:06:18+00:00</updated>
<author>
<name>Ellie Hermaszewska</name>
<email>ellieh@nvidia.com</email>
</author>
<published>2025-08-07T06:06:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=9e2685853033f4286feaf22d04a755a7395d95ce'/>
<id>urn:sha1:9e2685853033f4286feaf22d04a755a7395d95ce</id>
<content type='text'>
Closes https://github.com/shader-slang/slang/issues/7722 without adding
SONAME

```
e@light-hope in ~/work/slang on HEAD (68b0125) [nix-shell] [direnv]
$ nm -DC --defined-only build/Debug/lib/libslang-llvm.so
0000000001a4b637 T createLLVMDownstreamCompiler_V4
0000000001a427ed T createLLVMFileCheck_V1
0000000001a4b91e W std::type_info::operator==(std::type_info const&amp;) const
0000000001a4bb07 W std::_Sp_make_shared_tag::_S_ti()
0000000001059165 u std::ranges::_Cpo::iter_move
0000000005f92ac0 V typeinfo for std::_Sp_make_shared_tag
0000000005f92938 V vtable for std::_Sp_counted_base&lt;(__gnu_cxx::_Lock_policy)2&gt;

e@light-hope in ~/work/slang on HEAD (68b0125) [nix-shell] [direnv]
$ nm -DC --defined-only build/Debug/lib/libslang-glslang.so
00000000004701a2 T glslang_compile
000000000047012b T glslang_compile_1_1
000000000046ffd9 T glslang_compile_1_2
000000000046db75 T glslang_disassembleSPIRV
000000000046da42 T glslang_disassembleSPIRVWithResult
000000000047028b T glslang_linkSPIRV
000000000046d8fa T glslang_validateSPIRV

e@light-hope in ~/work/slang on HEAD (68b0125) [nix-shell] [direnv]
$ nm -DC --defined-only build/Debug/lib/libslang-glsl-module.so
0000000000135bf9 T slang_getEmbeddedModule
```

I think that the exports from libslang-llvm are unavoidable I believe,
however these are weak exports so should exhibit the same problem.

@NBickford-NV does this look good for you?</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>Fix build on GCC 15 (#6971)</title>
<updated>2025-05-02T23:00:42+00:00</updated>
<author>
<name>Julius Ikkala</name>
<email>julius.ikkala@gmail.com</email>
</author>
<published>2025-05-02T23:00:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=6104a55548133f936b189fad011f90f067fe725b'/>
<id>urn:sha1:6104a55548133f936b189fad011f90f067fe725b</id>
<content type='text'>
* Fix build on GCC 15

* format code

---------

Co-authored-by: slangbot &lt;186143334+slangbot@users.noreply.github.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>
</feed>
