<feed xmlns='http://www.w3.org/2005/Atom'>
<title>slang.git/source/core/slang-uint-set.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-01-29T01:21:57+00:00</updated>
<entry>
<title>Fix UIntSet calcSubtract to handle mismatched buffer sizes (#6205)</title>
<updated>2025-01-29T01:21:57+00:00</updated>
<author>
<name>Darren Wihandi</name>
<email>65404740+fairywreath@users.noreply.github.com</email>
</author>
<published>2025-01-29T01:21:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=1f99c2086cab3a259c786373ba8d5608e0e1f430'/>
<id>urn:sha1:1f99c2086cab3a259c786373ba8d5608e0e1f430</id>
<content type='text'>
* fix calcSubtract on UIntSet

* add test

---------

Co-authored-by: Yong He &lt;yonghe@outlook.com&gt;</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>Fix Varying Variable Location Assignments With Hull Shaders (#4915)</title>
<updated>2024-08-26T23:07:10+00:00</updated>
<author>
<name>ArielG-NV</name>
<email>159081215+ArielG-NV@users.noreply.github.com</email>
</author>
<published>2024-08-26T23:07:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=f0ba756c2f982aac8095ff0928d048fc97548315'/>
<id>urn:sha1:f0ba756c2f982aac8095ff0928d048fc97548315</id>
<content type='text'>
* Fix Varying Variable Location Assignments With Hull Shaders

Fixes: #4913
Fixes: #4540

Changes:
1. Added `kIROp_ControlBarrier` to HLSL/GLSL emitting.
2. Added a method to track 'used' and 'unused' varyings for when legalizing GLSL. This allows us to assign correct offsets to automatically added varyings
    * Added a `ZeroLSB` check to UIntSet for this purpose

* add missing return

* code comment adjustment

* cleanup

* comment and HLSL controlBarrier mistake

* assume space for glsl/spriv varying is irrelevant</content>
</entry>
<entry>
<title>Capability System: Implicit capability upgrade warning/error (#4241)</title>
<updated>2024-06-12T20:38:23+00:00</updated>
<author>
<name>ArielG-NV</name>
<email>159081215+ArielG-NV@users.noreply.github.com</email>
</author>
<published>2024-06-12T20:38:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=8813c610562b1c30222ec3ef0734ef601d43b617'/>
<id>urn:sha1:8813c610562b1c30222ec3ef0734ef601d43b617</id>
<content type='text'>
* capability upgrade warning/error

adjusted implementation + tests to support a warning/error if capabilities are implicitly upgraded and test accordingly.

* add glsl profile caps

* add GLSL and HLSL capabilities to the associated capability

* syntax error in capdef

* only error if user explicitly enables capabilities

1. changed testing infrastructure to not set a `profile` explicitly,
2. Added tests to be sure this works as intended with user API and with slangc command line

* Change capability atom definitions and how Slang manages them to fix errors

1. most `glsl_spirv` version atoms have been removed from `.capdef`, instead we will translate `spirv` version atoms into `glsl_spirv` since there is no point in writing the same code twice in `.capdef` files to define `spirv` versions.
2. add spirv version, and hlsl sm version (and equivlent) capability dependencies
3. removed some stage requirments which were set on objects, keep the wrapper capabilities. I am keeping the wrapper capabilities since I am unaware on if there are stage limitations (spec says code in practice does not work).

* check internal version instead of version profile (_spirv_1_5 vs. spirv_1_5)

* remove unused OpCapability. adjust SPIRV version'ing again for glsl_spirv

* apply workaround for glslang bug with rayquery usage

* ensure capabilities targetted by a profile and added together by a user are valid

* remove additions to `spirv_1_*` wrapper

* spirv_* -&gt; glsl_spirv fix

* fix bug where incompatable profiles would cause invalid target caps

* try to avoid joining invalid capabilities

* fix the warning/error &amp; printing

* run through tests to fix capability system and test mistakes

many mistakes were mesh shaders doing `-profile glsl_450+spirv_1_4`. This is not allowed for a few reasons
1. the test tooling does not handle arguments the same as `slangc`
2. glsl_450 core profile does not support mesh shaders, nor does spirv_1_4. sm_6_5 does work in this senario

* set some sm_4_1 intrinsics to sm_4_0

* replace `GLSL_` defs with `glsl_`

* swap the unsupported render-test syntax for working syntax

* set d3d11/d3d12 profile defaults

this is required since sm version changes compiled code &amp; behavior

* adjusted nvapi capabilities with atomics + d3d11 set to use sm_5_0 as per default

* cleanup

* address review

* incorrect styling

* change `bitscanForward` to work as intended on 32 bit targets

---------

Co-authored-by: Yong He &lt;yonghe@outlook.com&gt;</content>
</entry>
<entry>
<title>Capabilities System, CapabilitySet Logic Overhaul (#4145)</title>
<updated>2024-05-16T04:04:12+00:00</updated>
<author>
<name>ArielG-NV</name>
<email>159081215+ArielG-NV@users.noreply.github.com</email>
</author>
<published>2024-05-16T04:04:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=1b89f78cd1762aa08402bd656e807b66833b11d0'/>
<id>urn:sha1:1b89f78cd1762aa08402bd656e807b66833b11d0</id>
<content type='text'>
* Capabilities System, Backing Logic Overhaul

Fixes #4015

Problems to address:
1. Currently the capabilities system spends anywhere from 25-50% of compile time on the CapabilityVisitor. Most of this time is spent on join logic: 1. Finding abstract atoms 2. Comparing list1&lt;-&gt;list2. This should and can be made significantly faster.
2. Error system does not produce errors with auxiliary information. This will require a partial redesign to provide more useful semantic information for debugging.

What was addressed:
1. Array backed `CapabilityConjunctionSet` was replaced in-favor for a `UIntSet` backed `CapabilityTargetSets`. The design is described below.
Design:
* `CapabilityTargetSets` is a `Dictionary&lt;targetAtom, CapabilityTargetSet&gt;`. This is not an array for 2 reasons: 1. Easy to figure out which target is missing between two `CapabilityTargetSets` 2. To statically allocate an array requires the preprocessor to manually annotate which Capability is a target and link that Capability to an index. This means a dictionary is required for lookup regardless of implementation.
* `CapabilityTargetSet` is an intermediate representation of all capabilities for a singular `target` atom (`glsl`, `hlsl`, `metal`, ...). This structure contains a dictionary to all stage specific capability sets for fast lookup of stage capabilities supported by a `CapabilitySet` for a `target` atom. This reduces number of sets searched.
* `CapabilityStageSet` is an intermediate representation of all capabilities for a singular `stage` atom (`vertex`, `fragment`, ...). This structure holds all disjoint capability sets for a `stage`. A disjoint set is rare, but may exist in some scenarios (as an example): `{glsl, EXT_GL_FOO}{glsl, _GLSL_130, _GLSL_150}`. This reduces the number of sets searched.
* `UIntSet` is the main reason for the redesign for better performance and memory usage. All set operations only require a few operations, making all set logic trivial and with minimal cost to run. All algorithms were modified to focus around `UIntSet` operations.

2. Errors
* Semantic information are now better linked to the calling function to provide a connection of function&lt;-&gt;function_body for when saving semantic information for errors.
* Missing targets now print errors much like other error code by finding code which could be a cause of incompatibility.

What is missing:
1. Add non naive support for non-stage specific capabilities such as `{hlsl, _sm_5_0}`. Currently non stage specific targets emulate the behavior through assigning such capabilities to every stage: `{hlsl, _sm_5_0, vertex} {hlsl, _sm_5_0, fragment}...`. Removal of this behavior would remove redundant shader stage sets being made at construction time (~80% of new implementation runtime). This is an addition, not an overhaul.
2. Optionally: `UIntSet` should be modified to support SIMD operations for significantly faster operations. This is not required immediately since `UIntSet` is already not a performance constraint.

Notes:
* UIntSet had implementation bugs which were fixed in this PR.
* The old capabilities system had bugs which were fixed in this PR when transforming to the new implementation.

* fix .natvis debug view

* Small optimizations I found while working on the addition

the AST building pass looks like so now:
1% = ~capabilitySet
2% = capabilitySet()
1.5% capabilitySet::unionWith()
0.8% capabilitySet::join()
1.5% auxillary info for debugging
~0.5-1% extra visitor overhead

~5% total for the visitor
~6.5% for total runtime costs

* fix caps which were wrong but worked

* push minor syntax fix (still looking for why other tests fail)

* perf &amp; bug fixes

1. did not properly remake isBetterForTarget for this-&gt;empty case with that as Invalid. This is best case in this senario.
2. Remade seralizer for stdlib generation. Faster (more direct) &amp; cleaner code.

NOTE: did not address review comments

* fix glsl.meta caps error

* fixing findBest logic again &amp; UIntSet wrapper

findBest was not checking for 'more specialized' targets &amp; was element counter was flawed

* faster getElements algorithm + natvis for UIntSet + wrong warning

* type incompatability of bitscanForward implementations

* try to fix warnings again

* remove ptr for clang intrinsic

* add missing header

* ifdef to allow clang compile

* compiler hackery to fix up platform/type independent operations

* bracket

* fix MSVC error

* missing template

* change types out again

* changes to fix compiling

* adjustment to parameter for Clang/GCC

* added iterator to delay processing all atomSets of a CapabilitySet

* add a few missing consts's

* ensure we never have more than 1 disjointSet

Added a wrapper + assert + union functionality to all possible disjoint sets. This was done in favor of a removal of the LinkedList for 2 reasons:
1. We still need 0-1 set functionality.
2. Might as well keep the code, just disallow the problematic functionality.

* address review comments

non linked-list refactor review comments addressed; add doc comments + remove redundant code

* comments + remove isValid for bool operator

* push removal of linkedlist for capabilities

* add missing break

* address review comments

minor adjustments of syntax

* push a fix to the `CapabilitySet({shader, missing target})` code

* quality + error

1. add iterator to UIntSet
2. do not specialize target_switch if profile is derived from case (GLSL_150 is not compatable with GLSL_400)

* fix target_switch erroring + temporarily remove UIntSet::Interator

temporarily remove UIntSet::Interator. It will be added after, testing code on CI first so I can multi-task fixing the UIntSet Iterator

* fix the UIntSet iterator

* Revert "fix the UIntSet iterator" temporarily to pull from master

* add metal error as per texture.slang

(took a while I realize this was why things were breaking, likely should adjust errors to reflect this)

* Rework UIntSet to have a template for output type

This is done so it is reasonable to debug the iterator output and not just dealing with messy int's

Fix problems with the iterators implemented + invalid capabilities handling

* removed incorrect `__target_switch` capability

barycentric was being used with anticipation of `profile glsl450`, this does not expand into `GL_EXT_fragment_shader_barycentric`, this instead caused an error which is hidden during cross-compile.

* remove some uses of getElements

* remove undeclared_stage for now

* remove redundant code associated with `undeclared_stage`

* remove unused variable

* address review

specifically to note removed static in a thread dangerous scope. Now using a `const static` for read only (thread safe) which precompile steps generate

* move GLSL_150 capdef change to sm_4_1 (more accurate)

* address most review comments

did not address: https://github.com/shader-slang/slang/pull/4145#discussion_r1602256776

* revert incorrect code review suggestion

* push changes for all code review suggestions</content>
</entry>
<entry>
<title>Uniformity analysis. (#3704)</title>
<updated>2024-03-07T21:19:44+00:00</updated>
<author>
<name>Yong He</name>
<email>yonghe@outlook.com</email>
</author>
<published>2024-03-07T21:19:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=240727db40552180446c1f14acc371f690db10e4'/>
<id>urn:sha1:240727db40552180446c1f14acc371f690db10e4</id>
<content type='text'>
* Uniformity analysis.

* Add [NonUniformReturn] decorations to some hlsl intrinsic functions.</content>
</entry>
<entry>
<title>Bug fixes: Memory leak/off by one on UIntSet (#1616)</title>
<updated>2020-11-20T22:24:35+00:00</updated>
<author>
<name>jsmall-nvidia</name>
<email>jsmall@nvidia.com</email>
</author>
<published>2020-11-20T22:24:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=c0fab438a565cb2134679af8830d11644668d6a2'/>
<id>urn:sha1:c0fab438a565cb2134679af8830d11644668d6a2</id>
<content type='text'>
* #include an absolute path didn't work - because paths were taken to always be relative.

* Fix memory leak on ScopedAllocation.
Fix off by one bug on UIntSet</content>
</entry>
<entry>
<title>Improvements around hashing (#1355)</title>
<updated>2020-05-26T17:53:10+00:00</updated>
<author>
<name>jsmall-nvidia</name>
<email>jsmall@nvidia.com</email>
</author>
<published>2020-05-26T17:53:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=b1369040c3d6d6a8704bdb17d9de99f36a108e07'/>
<id>urn:sha1:b1369040c3d6d6a8704bdb17d9de99f36a108e07</id>
<content type='text'>
* Fields from upper to lower case in slang-ast-decl.h

* Lower camel field names in slang-ast-stmt.h

* Fix fields in slang-ast-expr.h

* slang-ast-type.h make fields lowerCamel.

* slang-ast-base.h members functions lowerCamel.

* Method names in slang-ast-type.h to lowerCamel.

* GetCanonicalType -&gt; getCanonicalType

* Substitute -&gt; substitute

* Equals -&gt; equals
ToString -&gt; toString

* ParentDecl -&gt; parentDecl
Members -&gt; members

* * Make hash code types explicit
* Use HashCode as return type of GetHashCode
* Added conversion from double to int64_t
* Split Stable from other hash functions

* toHash32/64 to convert a HashCode to the other styles.
GetHashCode32/64 -&gt; getHashCode32/64
GetStableHashCode32/64 -&gt; getStableHashCode32/64

* Other Get/Stable/HashCode32/64 fixes

* GetHashCode -&gt; getHashCode

* Equals -&gt; equals

* CreateCanonicalType -&gt; createCanonicalType

* Catches of polymorphic types should be through references otherwise slicing can occur.

* Fixes for newer verison of gcc.
Fix hashing problem on gcc for Dictionary.

* Another fix for GetHashPos

* Fix signed issue around GetHashPos</content>
</entry>
<entry>
<title>IntSet -&gt; UIntSet (#961)</title>
<updated>2019-05-09T18:08:29+00:00</updated>
<author>
<name>jsmall-nvidia</name>
<email>jsmall@nvidia.com</email>
</author>
<published>2019-05-09T18:08:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=30eee05f3f809e3950c8d8463ecdd9807c943692'/>
<id>urn:sha1:30eee05f3f809e3950c8d8463ecdd9807c943692</id>
<content type='text'>
* * Fix warning in vk-swap-chain around use of Index. Rename _indexOf to _indexOfFormat.
* Rename IntSet to UIntSet and put in own files slang-uint-set.h.cpp. Use UInt as the held type.
* On UintSet setMax -&gt; resizeAndClear. Doing so revealed bug in add.
* Closer following of conventions - use kPrefix for constants (even though held in 'enum')
* Small fixes/improvements

* * Add some documentation to UIntSet methods
* Use memset to set/reset bits

* Fix some tabbing.
Rename oldBufferSize -&gt; oldCount

* Fix tabs.
</content>
</entry>
</feed>
