<feed xmlns='http://www.w3.org/2005/Atom'>
<title>slang.git/source/slang/slang-ir-link.h, 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-17T23:04:20+00:00</updated>
<entry>
<title>Prelink ForceInlined functions during lowering. (#7812)</title>
<updated>2025-07-17T23:04:20+00:00</updated>
<author>
<name>Yong He</name>
<email>yonghe@outlook.com</email>
</author>
<published>2025-07-17T23:04:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=094d1ba7cd1eb5f09be05b2e57b5fbd3041cca38'/>
<id>urn:sha1:094d1ba7cd1eb5f09be05b2e57b5fbd3041cca38</id>
<content type='text'>
* Prelink ForceInlined functions during lowering.

* Fixes and cleanups.

* Fix warning.

* Fix crash.</content>
</entry>
<entry>
<title>format</title>
<updated>2024-10-29T06:49:26+00:00</updated>
<author>
<name>Ellie Hermaszewska</name>
<email>ellieh@nvidia.com</email>
</author>
<published>2024-10-29T06:49:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=f65d756bff8d4c5cbc15bd0322a2ae8e6b896a21'/>
<id>urn:sha1:f65d756bff8d4c5cbc15bd0322a2ae8e6b896a21</id>
<content type='text'>
* format

* Minor test fixes

* enable checking cpp format in ci</content>
</entry>
<entry>
<title>Replace DownstreamCompileResult with Artifact  (#2369)</title>
<updated>2022-08-22T14:08:25+00:00</updated>
<author>
<name>jsmall-nvidia</name>
<email>jsmall@nvidia.com</email>
</author>
<published>2022-08-22T14:08:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=15055d20c143cb398bd3e269541eebf24777390a'/>
<id>urn:sha1:15055d20c143cb398bd3e269541eebf24777390a</id>
<content type='text'>
* #include an absolute path didn't work - because paths were taken to always be relative.

* WIP replacing DownstreamCompileResult.

* First attempt at replacing DownstreamCompileResult with IArtifact and associated types.

* Small renaming around CharSlice.

* ICastable -&gt; ISlangCastable
Added IClonable
Fix issue with cloning in ArtifactDiagnostics.

* Only add the blob if one is defined in DXC.

* Guard adding blob representation.

* Make cloneInterface available across code base.
Set enums backing type for ArtifactDiagnostic.

* Added ::create for ArtifactDiagnostics.</content>
</entry>
<entry>
<title>Move metadata/diagnostics to associated types (#2358)</title>
<updated>2022-08-16T20:12:45+00:00</updated>
<author>
<name>jsmall-nvidia</name>
<email>jsmall@nvidia.com</email>
</author>
<published>2022-08-16T20:12:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=42de00db3ffe07599fff6d47d0d7228181ee3082'/>
<id>urn:sha1:42de00db3ffe07599fff6d47d0d7228181ee3082</id>
<content type='text'>
* #include an absolute path didn't work - because paths were taken to always be relative.

* WIP with hierarchical enums.

* Some small fixes and improvements around artifact desc related types.

* Improvements around hierarchical enum.

* Fixes to get Artifact types refactor to be able to execute tests.

* Attempt to better categorize PTX.

* Work around for potentially unused function warning.

* Typo fix.

* Simplify Artifact header.

* Small improvements around Artifact kind/payload/style.

* Added IDestroyable/ICastable

* Add IArtifactList.

* First impl of IArtifactUtil.

* Use the ICastable interface for IArtifactRepresentation.

* Added IArtifactRepresentation &amp; IArtifactAssociated.

* Add SLANG_OVERRIDE to avoid gcc/clang warning.

* Fix calling convention issue on win32.

* Fix missing SLANG_OVERRIDE.

* First attempt at file abstraction around Artifact.

* Added creation of lock file.

* Move functionality for determining file paths to the IArtifactUtil.
Add casting to ICastable.

* Added some casting/finding mechanisms.

* Simplify IArtifact interface, and use Items for file reps.

* Fix problem with libraries on DXIL.

* Split out ArtifactRepresentation.

* Move ArtifactDesc functionality to ArtifactDescUtil. ArtifactInfoUtil becomes ArtifactDescUtil.

* Split implementations from the interfaces for Artifact.

* Use TypeTextUtil for target name outputting.

* Add artifact impls.

* Add ICastableList

* Added UnknownCastableAdapter

* Make ISlangSharedLibrary derive from ICastable, and remain backwards compatible with slang-llvm.

* Refactor Representation on Artifact.

* Make our ISlangBlobs also derive from ICastable.
Make ISlangBlob atomic ref counted.

* Split out CastableList and related types, and placed in core.

* Small fixes around IArtifact.
Improve IArtifact docs.
First impl of getChildren for IArtifact.

* Documentation improvements for Artifact related types.

* Fix typo.

* Special case adding a ICastableList to a LazyCastableList.

* Small simplification of LazyCastableList, by adding State member.

* Removed the ILockFile interface because IFileArtifactRepresentation can be used.

* Implement DiagnosticsArtifactRepresentation.

* Added PostEmitMetadataArtifactRepresentation

* Add searching by predicate.
Added handling of accessing Artifact as ISharedLibrary

* Fix typo.

* Add find to IArtifacgtList.
Fix some missing SLANG_NO_THROW.

* Small improvements around ArtifactDesc types.

* Another small change around ArtifactKind.

* Some more shuffling of ArtifactDesc.

* Make IArtifact castable
Remove IArtifactList
Made IArtifactContainer derive from IArtifact
Made ModuleLibrary atomic ref counted/given IModuleLibrary interface.

* Must call _requireChildren before any children access.

* Fix missing SLANG_MCALL on castAs.

* Fix missing SLANG_OVERRIDE.

* Added IArtifactHandler

* Use ICastable for basis of scope/lookup.

* WIP first attempt to remove CompileResult.

* Fix support for for downstream compiler shared library adapter.

* Fix issues found when replacing CompileResult.

* Fix typo.

* Fix getting items form 'significant' member of an Artifact.

* Split out ArtifactUtil &amp; ArtifactHandler.

* Work around for problem on Visual studio.

* Improve searching.

* Add missing files.

* Split out Artifact associated types.
Don't produce a container by default - use associated for 'metadata'.

* Remove no longer used ArtifactPayload type.

* Generalized converting representations.
Small improvements to artifacts.

* Fix intermediate dumping issue.

* Removed #if 0 out CompileResult.
Remove DownstreamCompileResult maybeDumpIntermediate.

* Pull out functionality for dumping artifact output into ArtifactOutputUtil
Fixed a bug in naming files based on ArtifactDesc.

* std::atomic issue.

* Fix outputting as text bug.
Some small improvements.

* Add fix around prefix for dumping.
Improved how handling for extensions work form ArtifactDesc.

* Dump assembly if available.</content>
</entry>
<entry>
<title>Remove CompileResult to use IArtifact (#2357)</title>
<updated>2022-08-16T07:39:41+00:00</updated>
<author>
<name>jsmall-nvidia</name>
<email>jsmall@nvidia.com</email>
</author>
<published>2022-08-16T07:39:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=ac71724c03392b429e44641a3641b2bcf7cc55fc'/>
<id>urn:sha1:ac71724c03392b429e44641a3641b2bcf7cc55fc</id>
<content type='text'>
* #include an absolute path didn't work - because paths were taken to always be relative.

* WIP with hierarchical enums.

* Some small fixes and improvements around artifact desc related types.

* Improvements around hierarchical enum.

* Fixes to get Artifact types refactor to be able to execute tests.

* Attempt to better categorize PTX.

* Work around for potentially unused function warning.

* Typo fix.

* Simplify Artifact header.

* Small improvements around Artifact kind/payload/style.

* Added IDestroyable/ICastable

* Add IArtifactList.

* First impl of IArtifactUtil.

* Use the ICastable interface for IArtifactRepresentation.

* Added IArtifactRepresentation &amp; IArtifactAssociated.

* Add SLANG_OVERRIDE to avoid gcc/clang warning.

* Fix calling convention issue on win32.

* Fix missing SLANG_OVERRIDE.

* First attempt at file abstraction around Artifact.

* Added creation of lock file.

* Move functionality for determining file paths to the IArtifactUtil.
Add casting to ICastable.

* Added some casting/finding mechanisms.

* Simplify IArtifact interface, and use Items for file reps.

* Fix problem with libraries on DXIL.

* Split out ArtifactRepresentation.

* Move ArtifactDesc functionality to ArtifactDescUtil. ArtifactInfoUtil becomes ArtifactDescUtil.

* Split implementations from the interfaces for Artifact.

* Use TypeTextUtil for target name outputting.

* Add artifact impls.

* Add ICastableList

* Added UnknownCastableAdapter

* Make ISlangSharedLibrary derive from ICastable, and remain backwards compatible with slang-llvm.

* Refactor Representation on Artifact.

* Make our ISlangBlobs also derive from ICastable.
Make ISlangBlob atomic ref counted.

* Split out CastableList and related types, and placed in core.

* Small fixes around IArtifact.
Improve IArtifact docs.
First impl of getChildren for IArtifact.

* Documentation improvements for Artifact related types.

* Fix typo.

* Special case adding a ICastableList to a LazyCastableList.

* Small simplification of LazyCastableList, by adding State member.

* Removed the ILockFile interface because IFileArtifactRepresentation can be used.

* Implement DiagnosticsArtifactRepresentation.

* Added PostEmitMetadataArtifactRepresentation

* Add searching by predicate.
Added handling of accessing Artifact as ISharedLibrary

* Fix typo.

* Add find to IArtifacgtList.
Fix some missing SLANG_NO_THROW.

* Small improvements around ArtifactDesc types.

* Another small change around ArtifactKind.

* Some more shuffling of ArtifactDesc.

* Make IArtifact castable
Remove IArtifactList
Made IArtifactContainer derive from IArtifact
Made ModuleLibrary atomic ref counted/given IModuleLibrary interface.

* Must call _requireChildren before any children access.

* Fix missing SLANG_MCALL on castAs.

* Fix missing SLANG_OVERRIDE.

* Added IArtifactHandler

* Use ICastable for basis of scope/lookup.

* WIP first attempt to remove CompileResult.

* Fix support for for downstream compiler shared library adapter.

* Fix issues found when replacing CompileResult.

* Fix typo.

* Fix getting items form 'significant' member of an Artifact.

* Split out ArtifactUtil &amp; ArtifactHandler.

* Work around for problem on Visual studio.

* Improve searching.

* Add missing files.</content>
</entry>
<entry>
<title>Support for querying which parameters are used in emitted code (#2239)</title>
<updated>2022-05-18T17:57:37+00:00</updated>
<author>
<name>Alexey Panteleev</name>
<email>alpanteleev@nvidia.com</email>
</author>
<published>2022-05-18T17:57:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=69cb6e8f300d77e74bd2c7dfe15d12e10b38f512'/>
<id>urn:sha1:69cb6e8f300d77e74bd2c7dfe15d12e10b38f512</id>
<content type='text'>
See https://github.com/shader-slang/slang/issues/2213 </content>
</entry>
<entry>
<title>Refactor: eliminate BackEndCompileRequest (#2178)</title>
<updated>2022-04-11T19:01:31+00:00</updated>
<author>
<name>Theresa Foley</name>
<email>10618364+tangent-vector@users.noreply.github.com</email>
</author>
<published>2022-04-11T19:01:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=1409a5379d38ac153eabb4c19c7f4463a8b030ca'/>
<id>urn:sha1:1409a5379d38ac153eabb4c19c7f4463a8b030ca</id>
<content type='text'>
An earlier refactoring pass over the compiler codebase split the
type that had been called `CompileRequest` into three distinct
pieces:

* `FrontEndCompileRequest` which was supposed to own state and
  options related to running the compiler front end and producing
  IR + reflection (e.g., what translation units and source
  files/strings are included).

* `BackEndCompileRequest` which was supposed to own state and options
  related to running the compiler back end to translate the IR
  for a `ComponentType` (program) into output code. (Note that the
  `BackEndCompileRequest` was conceived of as orthogonal to the
  `TargetRequest`s, which store per-target and target-specific
  options.)

* `EndToEndCompileRequest` which was an umbrella object that owns
  separate front-end and back-end requests, plus any state that is
  only relevant when doing a true end-to-end compile (such as the
  kinds of compiles initiated with `slangc`). As originally conceived,
  the only state that this type was supposed to own was stuff related
  to "pass-through" compilation, as well as state related to writing
  of generated code to output files.

That refactoring work was very useful at the time, because it allowed
us to "scrub" the back end compilation steps to remove all
dependencies on front-end and AST state (this was important for our
goals of enabling linking and codegen from serialized Slang IR).

At this point, however, it is clear that the hierarchy that was built
up serves very little purpose:

* The `BackEndCompileRequest` type is only used in two places:

    * As part of an `EndToEndCompileRequest`, where the settings on
      the `BackEndCompileRequest` can be configured, but only through
      the `EndToEndCompileRequest`

    * As part of on-demand code generation through the `IComponentType`
      APIs. In this case, the settings stored on the
      `BackEndCompileRequest` are not accessible to the application
      at all, and will always use their default values, so that
      instantiating a "request" object doesn't really make any sense.

* The `FrontEndCompileRequest` type has a similar situation:

    * Front-end compilation as part of an `EndToEndCompileRequest`
      supports user configuration of `FrontEndCompileRequest` settings,
      but only through the `EndToEndCompileRequest`

    * Front-end compilation triggered by an `import` or a `loadModule()`
      call does not support user configuration of settings at all. It
      will always derive all relevant settings from thsoe on the
      session ("linkage").

In addition, subsequent changes have been made to the compiler that
show a bit of a "code smell" and/or forward-looking worries for this
decomposition:

* In some cases we've had to add the same setting to multiple types
  in the breakdown (front-end, back-end, end-to-end, linkage, target,
  etc.) which makes it harder for us to validate that all the possible
  mixtures of state work correctly.

* Related to the above, in some cases we have manual logic that copies
  state from one of the objects in the breakdown to another, in order
  to ensure that the user's intention is actually followed.

* As a forward-looking concern, it seems that developers have sometimes
  added new configuration options and state to places that don't really
  make sense according to the rationale of the original decomposition
  (e.g., we probably don't want to have a lot of state that is only
  available via end-to-end requests, given that the API structure is
  meant to push users *away* from end-to-end compiles).

As a result of all of the above, I've been planning a large refactor
with the following big-picture goals:

* Eliminate `BackEndCompileRequest`

    * Move all relevant state/options from the back-end request to
      the end-to-end request, since that is the only place they could
      be set anyway.

    * Introduce a transient "context" type to be used for the duration
      of code generation that serves the main functions that back-end
      requests really served in the codebase

* Make `EndToEndCompileRequest` be a subclass of
  `FrontEndCompileRequest`

    * Consider addding a transient "context" type for front-end
      compiles that can be used in `import`-like cases rather than
      needing a full front-end request object. If this works, then
      eliminate `FrontEndCompileRequest` and be back to world with
      just a single `CompileRequest` type

* Move *all* compiler configuration options to a distinct type (named
  something like `CompilerConfig` or `CompilerOptions` or whatever)
  which stores setting as key-value pairs, and has a notion of
  "inheritance" such that one configuration can extend or build on top
  of another. Make all the relevant types use this catch-all structure
  instead of redundantly storing flags in many places.

This change deals with the first of those bullets: removeal of
`BackEndCompileRequest`. The addition of the `CodeGenContext` type is
perhaps an unncessary additional step, but making that change helps
clean up a bunch of the code related to per-target code generation,
so I think it is the right choice.

Co-authored-by: Yong He &lt;yonghe@outlook.com&gt;</content>
</entry>
<entry>
<title>Multiple Entry Point Backend (#1437)</title>
<updated>2020-07-20T18:53:23+00:00</updated>
<author>
<name>Dietrich Geisler</name>
<email>dag368@cornell.edu</email>
</author>
<published>2020-07-20T18:53:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=115920406ebd747e02e1e6a8e4595f7d88eef0d9'/>
<id>urn:sha1:115920406ebd747e02e1e6a8e4595f7d88eef0d9</id>
<content type='text'>
* Multiple Entry Point Backend

This PR introduces changes to the IR linking, emitting, and options for
multiple entry points.  Specifically, this PR updates several locations
to support a (potentially empty) list of entry points, adding list infrastructure and looping over entry points as appropriate.

* Formatting change

* Updated unknown target case to not require an entry point

* Formatting and list consts updates

Co-authored-by: Tim Foley &lt;tfoleyNV@users.noreply.github.com&gt;</content>
</entry>
<entry>
<title>Add support for global uniform shader parameters (#1433)</title>
<updated>2020-07-08T20:52:40+00:00</updated>
<author>
<name>Tim Foley</name>
<email>tfoleyNV@users.noreply.github.com</email>
</author>
<published>2020-07-08T20:52:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=9590948e075b81fc2bf2d5ce84e9253861080048'/>
<id>urn:sha1:9590948e075b81fc2bf2d5ce84e9253861080048</id>
<content type='text'>
* Adding support for global uniform shader parameters

This change adds support for Slang programmers to declare shader parameters of "ordinary" types at global scope:

```hlsl
uniform float gScaleFactor;

void main() { ... *= gScaleFactor; ... }
```

The generated HLSL/GLSL/DXIL/SPIR-V output will be something along the lines of:

```hlsl
struct GlobalParams
{
    float gScaleFactor;
}

cbuffer globalParams
{
    GlobalParams globalParams;
}

void main() { ... *= globalParams.gScaleFactor; ... }
```

The binding information used for the implicit `globalParams` constant buffer will be determined by the existing implicit parameter binding logic (which already had support for this kind of transformation).

The reason this change is being pursued right now is because it is one step toward removing the implicit `KernelContext` type that is used to wrap the generated code for our CPU and CUDA C++ targets. Handling global-scope parameters of ordinary type requires an IR pass that synthesizes the `GlobalParams` structure type above, and that step ends up removing the need for the similar `UniformState` structure that was being used in the CPU/CUDA emit logic.

A more detailed guide to the changes included follows:

* The diagnostic for a global-scope variable that is implicitly a shader parameter was kept, but changed to a warning. Users can opt out of the warning by decorating their parameter as a `uniform` (since that keyword is already being used to mark entry-point parameters that should be treated as uniform shader parameters).

* To simplify the task of finding the global shader parameters, the `CLikeSourceEmitter` type has been given an `m_irModule` member. The previous emit logic for `UniformState` was having to do a roundabout solution involving the `EmitAction`s to deal with not having direct access to the module.

* Removed a few dead declarations in the emit logic (related to a much earlier point where emit was based on the AST instead of the IR).

* Made the computation of type names in C++ emit take into account `ConstantBuffer&lt;T&gt;` and `ParameterBlock&lt;T&gt;`. As far as I can tell, these were being handled with some special-case hacks in the emit logic instead of being supported more fundamentally. It might actually be good to pass these through as `ConstantBuffer&lt;T&gt;` and `ParameterBlock&lt;T&gt;` in the C++ output, and allow the prelude to customize their translation (defaulting to defining them as `T*`).

* Removed the special-case C++ emit logic for references to global shader parameters. There are now at most two global shader parameters to deal with, and the default emit logic (referring to them by name) does the Right Thing.

* Changed the handling of entry points for C++ (both CPU and CUDA) so that it handles the bundled-up shader paameters for the global and entry-point scopes the same way. The main complication here is OptiX, where parameter data is passed very differently than it is for CUDA compute kernels.

* Reverted changes to `ir-entry-point-uniforms` that had made its logic depend on the compilation target. The parameter binding logic was already responsible for deciding if a given target needed to wrap up its entry-point parameters in a constant buffer, and the IR pass was respecting that layout information. The current workaround had been removing the `ConstantBuffer&lt;T&gt;` indirection from this IR pass for CPU/CUDA, but then reintroducing the same indirection later on in the emit step.

* Added an explicit IR pass with the task of collecting global-scope parameters of uniform/ordinary type and packaging them up into a `struct`, and then optionally packaging that `struct` up in a constant buffer. This pass bases its decisions on the IR layout information that was already computed, so it should match whatever policy choices were made at the layout level.

* Changed the "key" operand on IR `struct` layout information to not assume an `IRStructKey`. The problem here is that the global scope gets a `StructTypeLayout` to represent its members, and this is convenient (rather than having to always special-case logic that handles the global scope), but the "fields" of that struct are global variables which do not have `IRStructKey`s associated with them. The simplest solution is to use the variables themselves as the keys, which required removing the assumption in the IR encoding.

* Updated the IR layout process to compute a layout for the global scope of an entire program, and to attach that to the `IRModule` via a decoration. Updated the IR linking process to carry through that decoration to the linked output. This is necessary so that the IR pass that transforms global parameters can access the global-scope layout information.

An important concern with this approach is that the contents and layout of the monolithic `GlobalParams` structure depends on the exact set of modules that were linked (and the order in which they were specified, in some cases). This isn't really a new thing with this change, but it becomes more important as we start to think of how to generalize things to better support separate compilation and linking.

There are changes that can (and should) be made to the way that IR layouts are computed for programs (e.g., so that we compute layout per-module and then combine them rather than as a whole-program step). In this case, the problem of forming the combined/linked global layout can be moved down the IR level and not be reliant on AST-level information.

Just changing the way layout and linking interact would not change the fundamental problem that global shader parameters as they currently exist in Slang/HLSL/GLSL are not readily compatible with true separate compilation. We either need to find a solution strategy that we can apply to allow existing shaders to work with separate compilation *or* we need to incrementally work toward removing support for global-scope shader parameters in favor of explicit entry-point parameters in all cases.

* fixup: missing files

* fixup: comment the new code</content>
</entry>
<entry>
<title>Fix bug in slang-dxc-support where it didn't get the source path correctly (#1420)</title>
<updated>2020-07-01T18:20:42+00:00</updated>
<author>
<name>jsmall-nvidia</name>
<email>jsmall@nvidia.com</email>
</author>
<published>2020-07-01T18:20:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=5c153295205d2d5d6340f3d569a550f4697946c5'/>
<id>urn:sha1:5c153295205d2d5d6340f3d569a550f4697946c5</id>
<content type='text'>
* Fix handling of UniformState from #1396

* * Fix bug in slang-dxc-support where it didn't get the source path correctly
* Make entryPointIndices const List&lt;Int&gt;&amp;</content>
</entry>
</feed>
