| Age | Commit message (Collapse) | Author |
|
* Fix name mangling of modified types.
* Add `InterlockedAdd(__ref uint, int)` overload.
* Fix.
* Fix type error in ImageStore legalization.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
|
|
* Clean up and improve Val deuplication performance.
* Fix.
* Fix.
* Fix.
* Fix.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
|
|
* Support `-fvk-use-gl-layout` for ByteAddressBuffer load/store.
* Fix.
* Fix.
* Add test for unaligned load.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
|
|
By default, function parameters in HLSL are mutable, but any changes to a parameter do not affect the values of the arguments after a call:
void f(int a)
{
a++; // allowed, but kind of useless
}
...
int b = 0;
f(b);
// b is still zero
Because the above behavior is a part of HLSL, we cannot easily diagnose such cases as errors without breaking backward compatibility with existing code.
This change makes it an error to invoke a `[mutating]` method on a function parameter, which cannot affect backward compatibility since the notion of `[mutating]` methods is not present in existing HLSL code:
struct Counter
{
int _state;
[mutating] void increment() { _state++; }
}
void f(Counter a)
{
a.increment(); // ERROR
}
...
Counter b = { 0 };
f(b);
// b is still zero
The compiler will also diagnose calls to `[mutating]` methods on a field or array element extracted out of a function parameter.
This change does not affect code that directly mutates a function parameter via assignment, or via passing the parameter onward as an argument to an `out` or `inout` call (or, equivalently, as the left-hand operand to a compound assignment operator).
This is a breaking change to existing Slang code, since it could diagnose an error on code that used to be allowed.
Indeed, two tests in the Slang test suite had to be updated to avoid such errors.
It would be possible to turn this diagnostic into a warning, and simply encourage users to enable it as an error.
On balance, though, it seems best to not allow this idiom since it has such a high probability to be an error.
Note: the specific case that motivated this change is use of `RayQuery` values as function parameters.
The root of the problem there is that dxc treats `RayQuery` values as copyable handles to mutable state, while Slang prefers to capture the mutation that occurs through marking the appropriate methods as `[mutating]`.
The Slang approach makes portable codegen for D3D/Vulkan simpler, but requires that we *also* treat a type like `RayQuery` as non-copyable.
This change does not address the problem that the Slang compiler does not enforce the requirement that values of non-copyable types do not get copied.
Instead, the diagnostic here just happens to issue a diagnostic in one important case where a copy would typically occur.
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
* Add spirv-dis as a downstream compiler
* Add TODO for spirv-dis downstream compiler
* Do not use SpirvDis by default
* tabs to spaces
* regenerate vs projects
* correct test
* correct calling convention
---------
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
* Default target intrinsic should not apply to SPIR-V
* CapabilitySet is a conjunction
* Add TEXTUAL_SOURCE capability class
|
|
* Fix -fvk-use-entrypoint-name.
* Remove irrelevant changes.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
|
|
* Validate generated SPIR-V
* regenerate vs projects
* Do not fail compiles if spirv-val is not available
---------
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
Types can depend on constants (for example fixed sized arrays)
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
* types for cast instructions
* Information getting functions for int and float types
* Implement spirv casting
* Broadcast operands for SPIR-V arithmetic
SPIR-V doesn't allow vector/sclar arithmetic ops
* Simplify spirv int/float type generation
---------
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
Required for memcpy (not sure why this has started being important, but it is the correct thing to do)
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
* Fail on an unhandled spv operand
* Diagnose on emitting a function with no definition or intrinsic
* clearer error message
* Add assert
* Add assert
* remove unused assert
* Disagnostic on snippet parsing failure
* Mention unimplemented instruction in error message
* mention unhandled local instruction for spirv in error message
* Allow specifying dump options in dumpIRToString
---------
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
* Fix `Val` deduplication bug.
* Fix
* Concat stdlib files into a single module.
* Remove unnecessary logic in `resolve`.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
|
|
|
|
* Add TokenReader::AdvanceIf overlaod for TokenType
* Add some spirv defs to parser
* Add comment
|
|
|
|
|
|
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
|
|
* Add option to use original entrypoint in spirv output.
* Fix.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
|
|
* Redesign DeclRef + Deduplicate Val.
* Update project files
* Fix warning.
* Fix.
* Fix.
* Remove `Val::_equalsImplOverride`.
* Rmove `Val::_getHashCodeOverride`.
* Remove `semanticVisitor` param from `resolve`.
* Cleanups.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
|
|
|
|
* Disable code motion for expensive insts (call & div)
The current redundancy removal pass does not consider control-flow within loops and as a result can sometimes move dynamic dispatch code outside their switch blocks, if they are nested in a single-iter-loop.
* Update liveness.slang.expected
|
|
* Cast integer literals.
* Fix expected output.
* For CUDA, search global instructions to see what types are used.
Improve lookup for fp16 header in CUDA.
* Fix issue with f16tof32
* Small improvement around finding used base types.
|
|
* Generalize collectInductionValues
* Support affine transformations of loop index as induction variables
* Test for generalized induction value collection
* Neaten inductive variable finding
* Store the type of implication success when finding inductive variables
* Test that loop induction finding does not alway succeed
* Support chains of additions and branches of additions in induction variable finding
* Use c++17 for downstream compilers
|
|
* A more way robust way to handle resource consumption might use multiple `kind`s on GLSL emit.
* Improve method naming and some comments.
* Small consistency fix.
* Fix issue with #elif evaluation.
* Add a test.
|
|
Co-authored-by: Yong He <yhe@nvidia.com>
|
|
* Fix -fvk-u-shift not applying to global constant buffer.
* Fix test.
* Fix.
* Fix.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
|
|
Co-authored-by: Yong He <yhe@nvidia.com>
|
|
* Refactor `dmul(This, Differential)` to `dmul<T:Real>(T, Differential)`
- Add AST synthesis support for generic containers
- Refactor relevant tests
* Merge dmul synthesis with dadd and dzero, and disambiguate using an enum
* Fix trailing spaces
|
|
* Fix -fvk-u-shift not applying to RWStructuredBuffer on glsl output.
* Add `transpose` to `ObjectToWorld4x3`.
* Fix scalar swizzle causes invalid glsl output.
Fixes #3026.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
|
|
* Fix -fvk-u-shift not applying to RWStructuredBuffer on glsl output.
* Add `transpose` to `ObjectToWorld4x3`.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
|
|
Translates to textureQueryLod().x (with the Unclameped variant being returned in the .y component)
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
The translation to GLSL is incomplete as intrinsics only exist for some combination of comparison and channel (just channel 0)
Closes https://github.com/shader-slang/slang/issues/3021
|
|
This allows Visual Studio debugger to skip over AST visitor dispatch functions and stop directly at the `visit*` functions when stepping into a `dispatch*` call.
Co-authored-by: Yong He <yhe@nvidia.com>
|
|
|
|
Co-authored-by: Yong He <yhe@nvidia.com>
|
|
Co-authored-by: Yong He <yhe@nvidia.com>
|
|
Co-authored-by: Yong He <yhe@nvidia.com>
|
|
Co-authored-by: Yong He <yhe@nvidia.com>
|
|
calls (#3010)
* Add test for nodiff diagnostic for non-diff call propagated through diff call
* Add logic to disambiguate calls to differentiable and non-differentiable methods
* Add expected results for test
* Simplify test
* Update slang-ir-check-differentiability.cpp
* Added comments for TreatAsDifferentiableExpr flavors
---------
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
emit (#3009)
* A more way robust way to handle resource consumption might use multiple `kind`s on GLSL emit.
* Improve method naming and some comments.
* Small consistency fix.
|
|
loops (#3005)
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
* Handle different resource kinds that can appear via the vk-shift-* allowing some HLSL kinds in GLSL emit.
* Determine the used kind for emit.
* Added vk-shift-uniform-issue.slang
* Use a better function name.
Improve comments.
|
|
* Add `sampleCount` parameter for MS textures.
* Fix test.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
|
|
* Improvements to HLSLToVulkanLayoutOptions.
* WIP vk-shift-* with HLSL like binding.
Detecting clashes.
* Shift example seems to be working correctly.
One oddness is that "used" data is now reflected, as we only enable for D3D shader resource types. Now we use those with inferred VK mode they appear.
* Implicit seems to work.
* Disable inference with Sampler/CombinedTextureSampler.
I guess? we could just use the HLSL texture register binding to infer.
* Report overlapping ranges in diagnostic.
The hlsl-to-vulkan-shift-diagnostic result might be surprising but it is correct, because u is automatically laid out so consumes DescriptorSlot 0, but that's already consumed by c.
* First attempt at array layout with infer on Vulkan.
* Fix the vulkan shift output.
* Array example.
|
|
* Remove unneccessary calls to `simplifyIR`.
* fix.
* Delete obsolete hoistConst pass.
* Fix.
* Small improvements.
* Fix.
* Fix enum lowering.
* fix
* tweaks.
* tweaks.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
|
|
* Small fixes and improvements around reflection tool.
* Make PrettyWriter printing a class.
* Aftermath crash demo WIP.
* Enable aftermath in test project.
* Setting failCount.
* Dumping out of source maps.
* Improve comments.
Simplify handling of compile products.
* Other small fixes to aftermath example.
* Added Emit SourceLocType.
Track sourcemap association meaning.
Improved documentation.
* Small improvements.
* Capture debug information for D3D11/D3D12/Vulkan.
* Enable debug info.
* Small improvements.
* Improve aftermath example README.md.
|
|
* Simplify lookup.
* Various bug fixes.
* Report type dictionary size in perf benchmark.
* Remove type duplication.
* increase initial dict size.
* Bug fix.
* Fix bugs.
* Fixup.
* Revert type legalization looping.
* Fix specialization pass.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
|
|
* Fix vk-shift-* mappings.
* Add some doc info about vk-shift.
* Fix diagnostic test.
|