<feed xmlns='http://www.w3.org/2005/Atom'>
<title>slang.git/source/slang/slang-compiler.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-07-24T19:59:58+00:00</updated>
<entry>
<title>Organize code better by splitting some big files (#7890)</title>
<updated>2025-07-24T19:59:58+00:00</updated>
<author>
<name>Theresa Foley</name>
<email>10618364+tangent-vector@users.noreply.github.com</email>
</author>
<published>2025-07-24T19:59:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=8ccd495d5eaa82cb831378c28dd190e657b6c999'/>
<id>urn:sha1:8ccd495d5eaa82cb831378c28dd190e657b6c999</id>
<content type='text'>
* Organize code better by splitting some big files

The basic change here is that the majority of the declarations in `slang-compiler.h` have been split out into a set of smaller and more focused files.
As a result, the implement of those declarations have been moved from `slang-compiler.cpp` and `slang.cpp` over to those new files when the proper home for code is obvious.

I have tried as much as possible to *not* make any edits to the code along the way, and just copy-paste declarations from one place to another as-is.
The exceptions I am aware of are:

* In some cases a function that used to be file-scope `static` was used by code that landed in two or more different `.cpp` files. In these cases, I changed the function to be non-`static` (removing the `_` prefix from its name, if it had one, per our naming conventions), and put a declaration for the function into the most appropriate header I could identify.

* I added a few comments in places where I saw ugly or unfortunate things in the code I was moving, and wanted to tag them with `TODO`s so we can hopefully get to them in the fullness of time.

* I added top-level comments to each of the new `.h` files that was introduced to try to explain the logic for what goes into that file.

* In cases where one of the new header files mostly existed to declare a single type, I sometimes added more detail to the doc comment on that type, to better explain the type and its role in the compiler (this is text that otherwise might have gone into the comment at the top leve lof the file, but I figured that the doc comment would have higher discoverability).

I expect that the most contentious choice here is that the `Session` class lands in `slang-global-session.h` while `slang-session.h` holds the `Linkage` class.
The names used in this change are consistent with how the relevant concepts in the public Slang API are named, and are consistent with how we *intend* to rename the classes themselves in time.

* format code

* fixup

---------

Co-authored-by: slangbot &lt;186143334+slangbot@users.noreply.github.com&gt;</content>
</entry>
<entry>
<title>Fix segfault when using -separate-debug-info with unsupported targets (#7777)</title>
<updated>2025-07-22T16:27:05+00:00</updated>
<author>
<name>Copilot</name>
<email>198982749+Copilot@users.noreply.github.com</email>
</author>
<published>2025-07-22T16:27:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=6e0c63b723cc81efcc82c2af778b26e507c71825'/>
<id>urn:sha1:6e0c63b723cc81efcc82c2af778b26e507c71825</id>
<content type='text'>
* Initial plan

* Fix segfault when using -separate-debug-info with unsupported targets

Add validation to emit a diagnostic error when -separate-debug-info is used
with targets other than SPIR-V binary. Previously, this would cause a segfault
because the separate debug info logic is only implemented for SPIR-V targets.

Changes:
- Added new diagnostic error (ID 18) for unsupported separate debug info usage
- Added validation in OptionsParser::_parse() to check target compatibility
- Created test cases for HLSL and GLSL targets to verify the fix
- Updated error message to clarify only SPIR-V binary targets are supported

The fix prevents segfaults and provides clear feedback to users about
target limitations for the -separate-debug-info option.

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

* Address feedback: fix segfault properly instead of preventing it

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;</content>
</entry>
<entry>
<title>Add arguments for controlling floating point denormal mode  (#7461)</title>
<updated>2025-07-01T07:41:52+00:00</updated>
<author>
<name>aidanfnv</name>
<email>aidanf@nvidia.com</email>
</author>
<published>2025-07-01T07:41:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=d50c3f34a2eda5bf5e278c78d32cc9923fd83b82'/>
<id>urn:sha1:d50c3f34a2eda5bf5e278c78d32cc9923fd83b82</id>
<content type='text'>
* Implement -fp-denorm-mode slangc arg

* Split fp-denorm-mode into 3 args for fp16/32/64

* Remove redundant option categories

* Use emitInst for multiple of the same OpExecutionMode

* Fix formatting

* Remove -denorm any

* Re-add option categories

* emitinst for ftz

* Use enums for type text

* Remove extra categories again

* Add tests for denorm mode

* Move denorm mode to post linking

* format code (#8)

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

* regenerate command line reference (#9)

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

* Clean up tests

* Fix option text

* format code (#10)

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

* Add tests for "any" mode

* Return "any" enum if option not set

* Simplify emission logic

* Add support for generic entrypoints

* Move denorm modes to end of CompilerOptionName enum

* format code (#11)

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

* Move new enum members to before CountOf

* Add not checks to tests, fix generic test, add functionality tests

* Rename denorm to fpDenormal

* Clean up functional test

* Rename denorm test dir

* Fix formatting, regenerate cmdline ref

* Fold simple tests into functional tests, add more dxil checks

* Remove no-op DX tests, make tests more consistent

* Disable VK functionality tests that will fail on the CI configs

* Fix formatting

* Add comments to disabled tests explaining why

---------

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>Remove some cruft/complexity from IR serialization (#7483)</title>
<updated>2025-07-01T01:20:33+00:00</updated>
<author>
<name>Theresa Foley</name>
<email>10618364+tangent-vector@users.noreply.github.com</email>
</author>
<published>2025-07-01T01:20:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=6231a6830880f650e444405b670ed7cc0987184b'/>
<id>urn:sha1:6231a6830880f650e444405b670ed7cc0987184b</id>
<content type='text'>
* Remove some cruft/complexity from IR serialization

This is a very simple cleanup to unnecessary code paths and remove some flexibility that isn't actually needed, to hopefully simplify the task of more completely overhauling the approach to IR serialization in a later change.

The concrete feature that gets removed here is a debug-only feature (which thus shouldn't be affecting any users of Slang) that was added long ago in the life of the compiler as we were working to truly separate the front- and back-ends.
At the time there was a lot of code in the compiler back-end that still made use of AST-level data structures, and thus got in the way of our goal to support separate compilation and linking (such that final code generation can only depend on the IR, and not the AST).
The option was used to cause the Slang IR to be serialized out and then read back in as part of compilation, to try and enforce that only the wanted constructs could pass through that bottleneck.

The idea was only ever half implemented, however, because it made use of a secondary implementation path in IR serialization that supported serializing the "raw" source locations (which are heavily dependent on AST-level information, even down to the number of bytes in source files).
This change removes the feature entirely, since it is no longer useful for its intended purpose, and its presence causes there to be entire second code path for source locations in IR serialization that would need to have test coverage if we wanted to be sure it kept working.

In addition, our pre-existing infrastructure for module serialization had various options that have either stopped being useful, or were not really useful at the time they were introduced.

For example: there are no places in the code today where we attempt to serialize out a module without including both the serialized AST and IR.
If that was a feature that we ever supported, the relevant code got removed at some preceding point without breaking any of our tests or (seemingly) upsetting users.

Similarly, the options being passed into writing of a serialized module included both a flag to control whether source locations should be serialized *and* a pointer to the `SourceManager` to use in that case... but it was only ever meaningful to set both, or neither.
The option has been changed to just be the `SourceManager` pointer, and the name has been updated to reflect its very narrow intended use case.

* format code

* fixup

* regenerate command line reference

---------

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>Allow checking capabilities in specific stages (#7375)</title>
<updated>2025-06-10T16:44:08+00:00</updated>
<author>
<name>jarcherNV</name>
<email>jarcher@nvidia.com</email>
</author>
<published>2025-06-10T16:44:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=3fa382505271834514d47612efee8e51a06204c5'/>
<id>urn:sha1:3fa382505271834514d47612efee8e51a06204c5</id>
<content type='text'>
This allows checking capabilities in any stage, needed specifically for
the hlsl_2018 capability which is defined for sm_5_1 and above. Stage
specific capabilities such as cs_5_1 would not find this in any stage
other than compute, so we need to restrict the check to only desired
stages.</content>
</entry>
<entry>
<title>Mediate access to ContainerDecl members (#7242)</title>
<updated>2025-06-09T18:22:51+00:00</updated>
<author>
<name>Theresa Foley</name>
<email>10618364+tangent-vector@users.noreply.github.com</email>
</author>
<published>2025-06-09T18:22:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=bfae49d853e0f9b6f9de495b13bcd1642ca4a285'/>
<id>urn:sha1:bfae49d853e0f9b6f9de495b13bcd1642ca4a285</id>
<content type='text'>
Most of what this change does is straightforward: take all the places in the code that used to operate directly on `ContainerDecl::members` and related fields, and instead have them call into a smaller set of accessor methods defined on `ContainerDecl`.

The primary motivation for making this change is that in order to implement on-demand loading of members from serialized AST modules, we need a way to identify and intercept the "demand" for those members.

On-demand loading benefits from having all accesses to the members of a `ContainerDecl` be as narrow as possible.
If a part of the code only need a member at a specific index, it should say so.
If it only needs access to members with a specific name, or a given subclass of `Decl`, then it should say so.

A secondary motivation for this change is that there have recently been several changes that added complexity and special cases by introducing code that operated on (and *mutated*) the member list of a container decl in ways that the existing code had never done before.

Any code that mutates the member list of a `ContainerDecl` needs to be sure to not disrupt the invariants that the lookup acceleration structures currently rely on.
One of the recent changes added a declaration-to-index map to the set of acceleration structures (with different validation/invalidation behavior than the others...) while other recent changes would remove or insert declarations in ways that could change the indices of other declarations in the same container.
It is not clear if any of these pieces of code were aware of the others, and the invariants that might be expected or broken along the way.

This change bottlenecks the vast majority of accesses to the members of a `ContainerDecl` through the following operations:

* Getting a `List` of all of the direct member declarations of a container

* Get the number of direct member declarations, and accessing them by index.

* Looking up the list of direct member declarations with a given name.

* Adding a new direct member declaration to the end of the list.

Some other operations are layered on top of those (e.g., getting a list of all the direct member declarations of a given C++ class).
These layered operations are still centralized on the `ContainerDecl`, with the intention that we *can* change them to be non-layered implementations if we ever need to for performance (e.g., by building a lookup structure for finding member declarations by their type).

The exceptional cases of access/mutation on the direct members of a `ContainerDecl` have also been encapsulated, but rather than expose what would risk appearing like general-purpose accessors (e.g., `removeDecl(d)`, `setDecl(index)`, etc.), these operations have been explicitly named after the specific use case that they serve in the codebase today, to discourage others from using them for more kinds of operations we'd rather not support.
These operations have also been given parameter signatures that match their use cases, to make it so that even somebody determined to abuse them would have to invent suitable arguments out of thin air.

In the case of the declaration-to-index mapping, this change eliminates that acceleration structure, in favor or slightly more complicated (and possibly inefficient, yes) code at the use site.

Over time, it would be good to closely scrutinize each of the use cases that requires more complicated interaction with the members of a `ContainerDecl`, to see whether any of them can be reframed in terms of the more basic operations, or if there is some clean abstraction we can introduce to make operations that mutate the member list feel like... hacky.</content>
</entry>
<entry>
<title>Add command line option for separate debug info (#7178)</title>
<updated>2025-06-06T21:30:06+00:00</updated>
<author>
<name>jarcherNV</name>
<email>jarcher@nvidia.com</email>
</author>
<published>2025-06-06T21:30:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=0d16228ae22fa2e1a00e62dc099eea08da7717fe'/>
<id>urn:sha1:0d16228ae22fa2e1a00e62dc099eea08da7717fe</id>
<content type='text'>
* Add command line option for separate debug info

Add command line arg -separate-debug-info which, if provided, produces
both a .spv and a .dbg.spv file. The .dbg.spv file contains full debug
info and the .spv file has all debug info stripped out.

Also add a DebugBuildIdentifier instruction to store a unique hash in
both the output files, so they can be more easily matched together.

A matching API is provided to allow using the Slang API to retrieve a
base and debug SPIRV as well as the debug build identifier string.</content>
</entry>
<entry>
<title>Language version + tuple syntax. (#7230)</title>
<updated>2025-05-29T15:05:57+00:00</updated>
<author>
<name>Yong He</name>
<email>yonghe@outlook.com</email>
</author>
<published>2025-05-29T15:05:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=faf042ecc3e688a1a3ffbe1ac44d18dd7ddf441a'/>
<id>urn:sha1:faf042ecc3e688a1a3ffbe1ac44d18dd7ddf441a</id>
<content type='text'>
* Language version + tuple syntax.

* Fix compile error.

* regenerate documentation Table of Contents

* Fix.

* regenerate command line reference

* Fix.

* Fix.

* Fix more test failures.

* revert empty line change,

* Retrigger CI

* #version-&gt;#lang

* Update source/core/slang-type-text-util.cpp

Co-authored-by: ArielG-NV &lt;159081215+ArielG-NV@users.noreply.github.com&gt;

* Remove comments.

* Fix parsing logic.

* Fix parser.

* Fix parser.

* update test comment

* Update options.

* regenerate documentation Table of Contents

* regenerate command line reference

---------

Co-authored-by: slangbot &lt;186143334+slangbot@users.noreply.github.com&gt;
Co-authored-by: ArielG-NV &lt;159081215+ArielG-NV@users.noreply.github.com&gt;</content>
</entry>
<entry>
<title>Make CUDA version capabilities reach NVRTC (#7074)</title>
<updated>2025-05-12T22:50:32+00:00</updated>
<author>
<name>Theresa Foley</name>
<email>10618364+tangent-vector@users.noreply.github.com</email>
</author>
<published>2025-05-12T22:50:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=b423ea55b4b00004bde1f91d95d9e5161d0ae629'/>
<id>urn:sha1:b423ea55b4b00004bde1f91d95d9e5161d0ae629</id>
<content type='text'>
Fixes #7049

The root cause of the problem in #7049 is simply that newer NVRTC versions produce a warning when asked to generate code for older CUDA SM versions, and the default that Slang was requesting compilation for was old enough to trigger that warning, and thus trip up the test case (which only looks at the first diagnostic produced by the downstream compiler).

Superficially, the fix was easy: change the test case in question (`tests/diagnostics/local-line.slang`) to request `-capability cuda_sm_8_0`, the minimum version supported by current NVRTC.

Unfortunately, the simple fix required some other fixes in order to actually work.

The capability system includes capability names of the form `cuda_sm_*_*`, but specifying such a capability had *no* impact on the CUDA SM version passed in when invoking NVRTC.
Instead, only the CUDA SM versions requested in the implementation of intrinsics in the core module were affecting the version number passed down.

This change adds logic to `slang-compiler.cpp` to take explicitly requested capabilities into account when inferring the CUDA SM version to be passed downstream.
A more complete fix would also add similar logic for all the other targets.

Unfortunately... yet again... that fix wasn't enough to make things work as expect.
Now I had the problem that requesting `-capability cuda_sm_8_0` was actually causing the NVRTC invocation to request CUDA SM version **9.0**!

The underlying problem *there* was that the `slang-capabilities.capdef` file has defined certain capability names in a way that implies atomic capabilities much higher than one would expect.
E.g., the `cuda_sm_8_0` alias was including HLSL `sm_5_0`, but then `sm_5_0` in turn included `_cuda_sm_9_0`.

The fix, for now, is to change the definitions in `slang-capabilities.capdef` to not have the counter-intuitive definitions for `cuda_sm_*_*`.

With this set of fixes, the test failure in the original bug report no longer occurs.

The work that went into this change suggests several larger-scope fixes that would be good to pursue:

* Ideally the capability definitions would have some sort of validation checking to make sure that counter-intuitive results like `cuda_sm_8_0` requesting CUDA SM 9.0 do not occur.

* The translation of capabilities over to version numbers for a downstream compiler should be expanded to cover other targets, and not just CUDA. It might be better/simpler to just pass the capabilities themselves to the downstream compiler, since it is possible that a downstream compiler could have more fine-grained enable/disable options than a simple version number.

* The entire approach to computing version numbers required for downstream compilation should be cleaned up so that we don't have this duplication between the capabilities that represent those versions and separate syntactic constructs that are used to "request" those versions as part of code generation.

* We are very much at the point where we should consider dropping the current behavior where a profile name or capability like `sm_5_0`, that is specific to a single target or a subset of targets, also implies a set of comparable capabilities for other targets.</content>
</entry>
<entry>
<title>Add Slang Byte Code generation and interpreter. (#6896)</title>
<updated>2025-04-28T18:42:22+00:00</updated>
<author>
<name>Yong He</name>
<email>yonghe@outlook.com</email>
</author>
<published>2025-04-28T18:42:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=c39c29bf4c52a85d7c83cc8b66ae45e265f9e078'/>
<id>urn:sha1:c39c29bf4c52a85d7c83cc8b66ae45e265f9e078</id>
<content type='text'>
* Add Slang Byte Code generation and interpreter.

* Fix compile issues.

* format code

* More compile fix.

* Fix clang issue.

* Fix more clang issues.

* Another clang fix.

* Fix clang issues.

* Fix another clang issue.

* Fix wasm build.

* Update building.md

* Fix test-server.

* Fix compile error.

* Fix bug.

---------

Co-authored-by: slangbot &lt;186143334+slangbot@users.noreply.github.com&gt;</content>
</entry>
</feed>
