| Age | Commit message (Collapse) | Author |
|
Resolves #3951
This adds a few atomic functions for SM6.6.
The spec can be found from here:
https://microsoft.github.io/DirectX-Specs/d3d/HLSL_SM_6_6_Int64_and_Float_Atomics.html
The new functions are:
void InterlockedAdd(inout XXX dest, in int64_t value, out int64_t original_value);
void InterlockedAdd(inout XXX dest, in uint64_t value, out uint64_t original_value);
void InterlockedAnd(inout XXX dest, in uint64_t value, out uint64_t original_value);
void InterlockedOr(inout XXX dest, in uint64_t value, out uint64_t original_value);
void InterlockedXor(inout XXX dest, in uint64_t value, out uint64_t original_value);
void InterlockedMin(inout XXX dest, in int64_t value, out int64_t original_value);
void InterlockedMin(inout XXX dest, in uint64_t value, out uint64_t original_value);
void InterlockedMax(inout XXX dest, in int64_t value, out int64_t original_value);
void InterlockedMax(inout XXX dest, in uint64_t value, out uint64_t original_value);
void InterlockedExchange(inout XXX dest, in float value, out float original_value);
void InterlockedExchange(inout XXX dest, in int64_t value, out int64_t original_value);
void InterlockedExchange(inout XXX dest, in uint64_t value, out uint64_t original_value);
void InterlockedCompareStore(inout XXX dest, in int64_t compare_value, in int64_t value);
void InterlockedCompareStore(inout XXX dest, in uint64_t compare_value, in uint64_t value);
void InterlockedCompareStoreFloatBitwise(inout XXX dest, in float compare_value, in float value);
void InterlockedCompareExchange(inout XXX dest, in int64_t compare_value, in int64_t value, out int64_t original_value);
void InterlockedCompareExchange(inout XXX dest, in uint64_t compare_value, in uint64_t value, out uint64_t original_value);
void InterlockedCompareExchangeFloatBitwise(inout XXX dest, in float compare_value, in float value, out float original_value);
void RWByteAddressBuffer::InterlockedAnd64(in uint dest_offset, in uint64_t value, out uint64_t original_value);
void RWByteAddressBuffer::InterlockedOr64(in uint dest_offset, in uint64_t value, out uint64_t original_value);
void RWByteAddressBuffer::InterlockedXor64(in uint dest_offset, in uint64_t value, out uint64_t original_value);
void RWByteAddressBuffer::InterlockedMin64(in uint dest_offset, in int64_t value, out int64_t original_value);
void RWByteAddressBuffer::InterlockedMin64(in uint dest_offset, in uint64_t value, out uint64_t original_value);
void RWByteAddressBuffer::InterlockedMax64(in uint dest_offset, in int64_t value, out int64_t original_value);
void RWByteAddressBuffer::InterlockedMax64(in uint dest_offset, in uint64_t value, out uint64_t original_value);
void RWByteAddressBuffer::InterlockedExchangeFloat(in uint dest_offset, in float value, out float original_value);
void RWByteAddressBuffer::InterlockedExchange64(in uint dest_offset, in int64_t value, out int64_t original_value);
void RWByteAddressBuffer::InterlockedExchange64(in uint dest_offset, in uint64_t value, out uint64_t original_value);
void RWByteAddressBuffer::InterlockedCompareStore64(in uint dest_offset, in int64_t compare_value, in int64_t value);
void RWByteAddressBuffer::InterlockedCompareStore64(in uint dest_offset, in uint64_t compare_value, in uint64_t value);
void RWByteAddressBuffer::InterlockedCompareStoreFloatBitwise(in uint dest_offset, in float compare_value, in float value);
void RWByteAddressBuffer::InterlockedCompareExchangeFloatBitwise(in uint dest_offset, in float compare_value, in float value, out float original_value);
|
|
|
|
|
|
|
|
Fix the issue that 'spGetDependencyFilePath' will report "unknown"
for the source code is from string. We only reported valid file path
when the source code is file a file, so we change that to report a valid
file name even when the source code is from the string.
|
|
|
|
|
|
The timestamped caches were filling up the 10GB max cache size, removing the timestamps allows older ones to be overwritten instead
|
|
|
|
* Fix the variable scope issue (#3838)
In the IR optimization pass, we turn all the loop to do-while loop form.
But in the do-while loop form, the loop body block is dominating the
blocks after the loop break block. This assumption is fine for SPIRV and
IR code, however, it's incorrect for all the other language target (e.g.
c/c++/cuda/glsl/hlsl) because the instructions defined in the loop body
is invisible from outside of the loop. Therefore, when translating to
other textual language, there could be issue for the variables scope.
To fix this issue, we first detect the instructions that are defined
inside the loop block, then check if these instructions are used after
the break block. If so, we duplicate these instructions right before
their users such that we can make those instructions available globally.
* Update slang vcxproj file because of add new source files
* Minor fix
- Update the method to get the block of an instruction
- Avoid query the hash-map twice by using "add" method directly.
* Reduce complexity
In searching loop region blocks, we don't actually need to traverse the
instructions. Instead, we only have to check each block to see if it's
in a loop region, and hash such block for later on processing.
So we can remove one level of loop.
In the second pass, we can use that hash to filter out the blocks that
are not in the loop region, and only process the instructions inside the
loop region.
Add description for the new fix-up pass declared in
slang-ir-variable-scope-correction.h.
* Categorize the unstorable and storable instructs
1. When checking the loop regions, there could be multi-levels nested
loops, so we should use a list to store the loopHeaders.
2. Categorize the instructs based on storable and non-storable, because
we only have to duplicate the non-storable instructs. Note pointer
type instruct is also belonged to non-storable class because we can
not store a pointer in local variable.
* Fix some test failure
* Fix test failures
* Recursively process the operands
Besides process the out-of-scope instruction, we have to also process
all the operands of this instructions. Therefore, we have to make the
process logic recursive until all the involved instructions are
accessible.
* Change how to check storable type
* Add target checking for CPP/CUDA
In decide whether the type is storable, add target checking for CPP/CUDA
as they can store any types.
Cleanup the code to remove those debug log prints.
* Addressing feedbacks
Address some feedbacks.
Change the depth-first traverse to breadth-first traverse when
processing instruction and its operands.
* Minor fix for the variable names
|
|
* HLSL RT pipeline compile-only tests
* fix issues with chit,ahit,int due to using a too old version of slangc
* change to SIMPLE and filecheck type of test
* remove unneeded glsl and hlsl files
* Add more filecheck checks
* Fix copy paste mistake in intersection shader
|
|
|
|
* Properly compile `gl_WorkgroupSize`.
* Update source/slang/slang-ir-translate-glsl-global-var.cpp
Co-authored-by: ArielG-NV <159081215+ArielG-NV@users.noreply.github.com>
---------
Co-authored-by: ArielG-NV <159081215+ArielG-NV@users.noreply.github.com>
|
|
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
|
|
|
|
|
|
|
|
|
|
spirv-tools is updated to upstream/main: 3983d15
spirv-headers is updated to vulkan-sdk-1.3.280.0
spirv-tools-generated is updated based on spirv-tool build
|
|
attribute. (#3914)
* Allow COM based API to discover and check entrypoints without [shader] attribute.
* Undo changes.
* More comments.
|
|
|
|
|
|
|
|
Fixes the issue #3671
* The __init constructors are not expected to return a value like other member
functions, but must construct a new value and return the struct type or none.
* This patch enables this behavior in the IR lowering without complaining about
illegal situations where the user returns an invalid type or none at all.
Translate ordinary struct `return ...;` to `this = ...; return this;`
Translate NonCopyableType struct `return ...;` to `return this;`
* This patch also fixes the issue with type checking when __init()
returns a void that mismatches the base type of the struct/ class
Translate ordinary struct `return;` to `return this;`
Translate NonCopyableType struct `return;` to `return;`
* Add end-to-end test and compile only tests to check the above behavior.
|
|
PrimitiveID (#3895)
Fixes bug 3872
|
|
|
|
* Legalization of non-struct when expects struct.
`__forceVarIntoStructTemporarily()` solves the issue of passing "non-struct type's" into a parameter that only accepts "struct type's".
The intrinsic solves the issue through checking the parameter of the intrinsic:
If the parameter is a "struct type"
* Return a reference to the parameter
else
* a "struct type" Temporary variable is made and the "non struct type" parameter is copied to a member of this struct. This struct is then returned by `__forceVarIntoStructTemporarily()`. Optionally if the use location of this call is a argument which can have side effects (out, inout, ref, etc.) the temporary struct variable is copied into the original "non struct type" parameter.
Testing code has "addComplexity" functions to avoid optimizations through forcing side effects so we can predict the code output.
* Address review comments
- ForceInline ray functions
- fix testing
- adjust how we replace operands in senarios to avoid unexpected side effects of replacing operands without any explicit checks
* Adjust nv test slightly and remove .glsl file
* Remove implicit LOD sampling & test additions
- Implicit LOD sampling is not allowed in a raygen. Implicit LOD sampling requires depth (from a fragment shader) to sample. Raygen does not have the depth, so this function was replaced.
- Changed other tests for correctness/clarity
* Test if Falcor breaks through use of ForceInline
* Add back force inline
may need to look at how Falcor wrote its slang shaders. This will be done if ForceInline causes issues since ForceInline should not affect code gen in an impactable way.
|
|
* Fix assertions due to malformed switch statements
Fixes the issue #2955
* Checks for multiple case statements with same values
* Checks for multiple default cases
* Constant-folds case exprs into an Integer value
* fix the comments, and updated error code
* one-line comment on diagnostic code
|
|
|
|
We support partial generic parameter inference today.
|
|
|
|
* Update glsl intrinsic for `GroupMemoryBarrierWithGroupSync`,
* Add spirv tests for `GroupMemoryBarrierWithGroupSync`.
|
|
(#3881)
* Refactor memory qualifier decorators to be a bit-flag set.
replace GloballyCoherent, ReadOnly, WriteOnly, Volatile, and Restrict memory modifiers and decorations with a bit flag set to more efficiently manage memory qualifiers.
added `restrict` modifier to test to ensure the code works when dropping a `restrict` memory qualifier
* Refine tests & add SSBO memory qualifer support
add CHECK's to tests to ensure memory qualifiers emit as intended
added tests and changed code to ensure memory qualifiers work on SSBO objects (SPIR-V & GLSL)
* add memory qualifiers & fixes.
Add to StructuredBuffer & ByteAddressBuffer `ReadOnly`/NonWritable qualifier.
* Memory qualifiers must be decorated on a variable inst. Due to this the qualifier is added after `lowerStructuredBufferType`
Fixed an error where ReadOnly->NonReadable & WriteOnly->NonWritable
* Adjusted tests accordingly
Added back the removed `globallycoherent` memory qualifier emit'ing code in hlsl-emit (was incorrectly removed).
undo hlsl.meta changes
cleanup
|
|
The following PR implements 8.14-8.19 of the [OpenGL-GLSL specification](https://registry.khronos.org/OpenGL/specs/gl/GLSLangSpec.4.60.pdf).
Fully implements all functions and built-in type's, resolves https://github.com/shader-slang/slang/issues/3692 for GLSL & SPRI-V targets.
_Notes:_
Testing Tools:
* Fragment shaders cannot test computational results. Only OpCodes are checked for proper emitting.
Implementation Notes:
* SubpassInput requires an unknown image format.
* SubpassInput is disjoint from TextureType: __SubpassImpl (.slang) & SubpassInputType (Compiler) to reduce code generation required.
* SubpassInput required an additional input layout modifier, input_attachment_index, this was added as a new parameter binding attribute. Since the following qualifiers can overlap with different resources (`layout(input_attachment_index = 0, binding = 0, set = 0)`) input_attachment_index is checked for overlapping resource bindings separately from other qualifiers with `LayoutResourceKind::InputAttachmentIndex`.
* `GLSLInputAttachmentIndexLayoutModifier` was added to enforce function parameters only accepting `in` decorated variables.
* `in` decorated variables needed to have emitting modified to allow directly emitting the variable into function calls if used as a parameter, normally Slang has a "global variable" shadow as a "global parameter" through a copy. This does not work and is solved using `GlobalVariableShadowingGlobalParameterDecoration` to build a relationship of "global variable" to "global parameter", we then resolve this relationship and replace "global variable" uses later in compile.
* `AtomicCounterMemory` memory-constraint requires `OpCapability AtomicStorage`, `AtomicStorage` is invalid for Vulkan targets. glslang outputs for `barrier`, `memoryBarrier`, and `groupMemoryBarrier` `AtomicCounterMemory` as a memory constraint. This compiles as valid SPIR-V for Vulkan since `OpCapability AtomicStorage` is not declared. This behavior of glslang is undefined as per [3.31.Capability of the SPIR-V specification](https://registry.khronos.org/SPIR-V/specs/unified1/SPIRV.html#_capability). We will omit `AtomicCounterMemory` from our barrier calls.
|
|
DepthReplacing. (#3885)
* Fix the erroneous logic of determining whether or not to emit DepthReplacing.
Closes #3884.
* Fix.
* More cleanup.
|
|
|
|
* Allow enum values to be used as generic arguments.
* Fix constant folding.
|
|
Resolves an issue #3385
Shader Model 6.6 added a new keyowrd, "WaveSize". See the following link
for more details:
https://microsoft.github.io/DirectX-Specs/d3d/HLSL_SM_6_6_WaveSize.html
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
|
|
|
|
* Allow bit operators on enum types.
* Fix.
|
|
Closes #3861.
|
|
this case (#3864)
CullPrimitive [follows capabilities to emit as per SPIR-V specification](https://registry.khronos.org/SPIR-V/specs/unified1/SPIRV.html#_capability)
|
|
|
|
* Fix incorrect SPV stride for unsized array (#3825)
In '-emit-spirv-directly' mode, slang generates the stride 0
for unsized array in `OpDecorate` instructions.
For unsized array, the stride is invalid, but we need to provide
a non-zero value to pass the spirv validator.
* Decorate struct with unsized array field as 'Block'
For the struct having unsized array fields, it has to be decorated
as "Block", otherwise it will fails the spirv-val.
So we add a check at in 'emitGlobalInst' when emitting spirv for
'kIROp_StructType', where if there is unsized array field inside
the struct, emit a decorate instruction for above purpose.
* Update decoration for kIROp_SizeAndAlignmentDecoration
When add a decoration node for kIROp_SizeAndAlignmentDecoration,
we implicitly convert the 64 bit size to 32 bit. In most cases, this
should not be a problem because we won't have that large data type.
However, we use 64-bit -1 to represent the size of unsized-array,
so in that case, the conversion will change the size to 0, which is
incorrect. So change that decoration to use 64-bit size.
---------
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
|
|
|
|
Adds tables to README.md for quick reference of which platforms and targets are supported. Links to detailed information in user guide.
Bug Id: shader-slang/slang #3667
|
|
|