| Age | Commit message (Collapse) | Author |
|
* Fix crash when handling uninitialized resource type
close #6328.
When declare a var with struct type, if the struct has a resource
type field and it doesn't provide explicit constructor, because
slang won't implicit construct such variable at declare site if user
doesn't explicitly call the initializer list, we should report the
resource type field uninitialized as an error to prevent future possible
crash when legalize any use of such variable.
|
|
Co-authored-by: Yong He <yonghe@outlook.com>
Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
|
|
* SP004: implement initialize list translation to ctor
- We synthesize a member-wise constructor for each struct follow
the rules described in SP004.
- Add logic to translate the initialize list to constructor invoke
- Add cuda-host decoration for the synthesized constructor
- Remove the default constructor when we have a valid member init constructor
- Disable -zero-initialize option, will re-implement it in followup (#6109).
- Fix the overload lookup issue
When creating invoke expression for ctor, we need to call
ResolveInvoke() to find us the best candidates, however
the existing lookup logic could find us the base constructor
for child struct, we should eliminate this case by providing
the LookupOptions::IgnoreInheritance to lookup, this requires
us to create a subcontext on SemanticsVisitor to indicate that
we only want to use this option on looking the constructor.
- Do not implicit initialize a struct that doesn't have explicit default
constructor.
Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
|
|
* Fix warning about push constants, shaderRecordEXT
These resources should not warn about missing vk::binding.
* format code
---------
Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
|
|
* Fix combined sampler documentation and warning
* Update comment, show detailed '-fvk-t-shift' message in warning instead of generic '-fvk-xxx-shift'
* format code
---------
Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
|
|
* add brga8 format
* add tests
* minor fixes
* cleanup
* maybe fix broken quad control test
* add missing xslang flag on test
---------
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
* Fix incorrect resolve of specialization instance
While checking the uninitialized variables, we were not resolving the
specialized instance correctly. This commit repeats the resolve while
the result is a specialization instance. A new test is added for this:
tests/diagnostics/uninitialized-generic.slang
After the problem is fixed, it revealed another problem in existing
tests:
tests/compute/nested-generics2.slang
tests/diagnostics/uninitialized-local-variables.slang
When a struct has a member variable whose type is a generic type,
we cannot iterate over its member variables yet, because the type
is unknown until the generic function/struct is specialized. We will
have to give up checking for these cases.
|
|
* Refactor _Texture to constrain on texel types.
* Fix tests.
* Fix.
* Disable glsl texture test because rhi can't run it correctly.
|
|
* Inline global constants that contains opaque handles for legalization.
* Add diagnostics on opaque type global variables.
* Fix.
* Fix test.
|
|
test (#6067)
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
There are a few tests that are currently passing but could fail when
conditions change little bit.
When slang-test runs with `test-server`, the spirv validation fails and
the test gets reported as failed even though they are actually passing.
To avoid the potential problem, this commit adds an empty entry point.
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
* Use disassemble API from SPIRV-Tools
This commit uses C API version of SPIRV disassemble function rather than
calling spirv-dis.exe.
This allows us to use a correct version of SPIRV disassble function that
Slangc.exe is using.
The implementation is mostly copied from external/spirv-tools/tools/dis/dis.cpp, which is a source file for building spirv-dis.exe.
This commit also includes a fix for a bug in RPC communication to `test-server`.
When an RPC connection to `test-server.exe` is reused and the second
test abruptly fails due to a compile error or SPIRV validation error,
the output from the first test run was incorrectly reused as the output
for the second test.
This commit resets the RPC result before waiting for the response so
that even when the RPC connection is erratically disconnected, the
result from the previous run will not be reused incorrectly.
Some of the tests appear to be relying on this type of behavior. By
using an option, `-skip-spirv-validation`, the RPC connection will
continue without an interruption.
|
|
|
|
(#5964)
|
|
|
|
* Add verification logic on push and specialization constants.
* format code
---------
Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
|
|
* Allow glsl set and binding layout qualifiers to be compile time integer exprs
* add new tests
* add comments
* cleanup on asserts
* addressed review comments and cleanup
* fix missing set expr in test
* fixed tests and cleanup
---------
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
* Report error on nested functions.
* Fix.
---------
Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
|
|
Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
|
|
* Make non-suffixed integer literal type resolution conform to C
* Update integer literal tests
* Clean up integer literal implementation a bit
* Update docs on integer literals
* Clean up docs update
* Clean up docs update
* Add comment on INT64_MIN edge case
* Fixed failing test, fixed formatting and cleaned up code
---------
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
can't be automatically inferred (#5630)
* [AD] Add support for resolving custom derivatives where generic parameters can't be automatically inferred
* Fix failing tests
* Update custom-derivative-generic.slang
|
|
* Change how DeclRef::toText works
We now ignore the decl-ref heirarchy since that only includes nodes with specialization info & simply walk up the tree of decls, while emitting any specializations present in the decl-ref.
* Update some tests. Add cases for direct refs to generic params & Lookup decl refs
|
|
|
|
(#5415)
This commit changes the word "stdlib" or "standard library" to "core module" in the source code.
|
|
|
|
* Add diagnostic to verify the left hand side of a generic constraint.
* Fix comment.
|
|
* Lower the priority of looking up the rank of scope
In the previous change of #5060, we propose a way to resolve
the ambiguous call when considering the scope of a function.
But this rule should be considered as a low priority than "specialized
candidate", aka. we should consider more "specialized candiate" first.
* Count distance between reference site to declaration site
Compare the candidate by calculating distance
from reference site to declaration site via nearest common prefix
in the scope tree.
This will involve finding the common parent node of two child nodes
and how sum the distance from the common parent to the two child nodes.
* Change the priority higher than 'getOverloadRank'
* Don't evaluate the scope rank algorithm on generic
If the candidate is generic function, the function parameters
won't be checked before 'CompareOverloadCandidates', so it will
results in that the candidates this function could be invalid.
We should not evaluate the distance algorithm in this case, instead
we will evaluate later when the candidate is in flavor of Func or Expr
since then all the type checks for the function will be done.
|
|
* Add `IRWArray` interface, and make StructuredBuffer conform to them.
* Update user guide.
* Fix.
* Fixes.
|
|
|
|
* Support entrypoints defined in a namespace.
* Fix test.
|
|
(#4977)
* Add a test to ensure extension does not override existing conformance.
* Fix doc.
* Update documentation.
* Fix doc.
* Add diagnostic test.
|
|
* Ignoring construct field warnings on delegatory methods
* Generalizing instruction usage type interface
* Skip collection when searching for stores
* Adding separate construct delegation tests
* Treating differentiable functions as stores
|
|
Previously, the warnings were:
```
environment.slang(22): warning 41022: inout parameter 'seed' is never written to
public float3 environment_sample(StructuredBuffer <Environment_sample_data> sample_buffer, inout int seed)
^~~~~~~~~~~~~~~~~~
hit.slang(5): warning 41022: inout parameter 'seed' is never written to
float3 sample_lights(inout uint seed)
^~~~~~~~~~~~~
```
With this commit they should not be emitted.
|
|
* Do not zero-initialize groupshared and rayquery variables
Fixes: #4824
`-zero-initialize` option will explicitly not:
1. Set any groupshared values to defaults
2. Set any rayQuery object to a default state (currently invalid code generation)
* grammer
* disallow groupshared initializers
disallow groupshared initializers & adjust tests accordingly
* remove disallowed groupshared-init expression
* do not default init if non-copyable
---------
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
Addresses #4698 as one approach to diagnose the potential problem.
Emit warnings when a user marks a parameter as `inout` but never writes to it in the function. A new intrinsic function `unmodified(out T)` has been added to explicitly indicate that an `inout` variable will not be modified in the function.
This is only one way to address the specific validation error in #4698. In general it seems that DXC does some more extensive checks on actual struct fields (as opposed to observing arbitrary struct writes), so that will be the next step.
|
|
* Proper warning generation for target switches and intrinsic asm
* Relaxing terminators
* Fix compiler warnings
* Rectified target switch reachability check
* Simplify target switch reachability check
* Refactoring variable names
* Using getBlocks
* Moving ad hoc special case to diagnostics source
* Using the LINE directive for testing
* Simplifying reliance on target switches
* Skipping IR generation for empty target switches
---------
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
|
|
* Disable warnings for input global variables
* Update comment to reflect actual check
Co-authored-by: ArielG-NV <159081215+ArielG-NV@users.noreply.github.com>
* Update comments in uninitialized-globals.slang
* Update uninitialized-globals.slang
* Refactoring test variable
* Typo in test
---------
Co-authored-by: ArielG-NV <159081215+ArielG-NV@users.noreply.github.com>
|
|
* Fix the issue of name mangle
During our name mangling, we should add the direction of the parameter
in the name, otherwise it could have the name collision which will
result in invalid code generation:
e.g.
// in slang-module.slang
export func(float a) { ...}
// in test.slang
extern func(inout float a);
when we compile test.slang, slang will pass a pointer type to the
'func', however, in the slang-module.slang, `func` expects a value
instead of pointer. This will lead the wrong spirv code.
So we should add the parameter direction into the mangle name such
that above two symbols will have the different mangled names, and
we will catch this during IR-link stage.
* Change to use to get param direction
* Address few comments
|
|
* Detect uninitialized fields in constructors
* Reachability check for early returns
* Specialized warnings for synthesized default initializers
* Handling quirks with constructors
* Addressing review comments
* Ignore synthesized constructors if they are not used
|
|
Previously the warning system ignores undefined variables in nested scopes (blocks in IR).
|
|
* Add unexpected end of input error to lexer
* Add end of input test
* Simplify testcase
|
|
* Handle out/inout functions with separate consideration
* Fixing bug with passing aliasable instructions
* Handle autodiff functions (fwd and rev) in warning system
* Handling interface methods
* Handling ref parameters like out/inout
* Temporary fix to remaining bugs
* Refactoring methods and tests
* Recursive check for empty structs
* Using default initializable interface in tests
* Resolving CI fail
|
|
This extends the code for handling uninitialized output parameters.
Still needs to handle generic templates and assignment of uninitialized
values more carefully.
The file containing the relevant code are now in
source/slang/slang-ir-use-uninitialized-values.cpp
rather than the previous
source/slang/slang-ir-use-uninitialized-out-param.h
and the top-level function is now checkForUsingUinitializedValues.
Additionally a rudimentary test shader has been added for this case, which replaces the old file for out params only; tests/diagnositcs/uninitialized-out.slang becomes tests/diagnositcs/uninitialized.slang.
What this does not implement (could be future PRs):
* Checking uninitialized fields within constructors
* Partially uninitialized values with respect to data structure (e.g. arrays/structs/vector types)
* Partially uninitialized values with respect to control flow (e.g. if/else/loop)
|
|
* Support integer typed textures for GLSL
This commit re-enables the ability to sample from an integer typed
texture for GLSL functions while keeping it unavailable for HLSL target.
|
|
|
|
* SPIRV `Block` decoration fixes.
- SPIRV does not allow duplicate `Block` decorations. So we shouldn't be generating them.
- Also fixes duplication of OpName.
- SPIRV and HLSL do not allow ConstantBuffer with trailing unsized arrays. Added a check in the front-end against such code.
* Convert failing cross-compile tests to filecheck.
---------
Co-authored-by: Jay Kwak <82421531+jkwak-work@users.noreply.github.com>
|
|
* Print warning when operator<< shifting too much
Closes #3944
For the given type of the left side operand to `operator<<` is not big
enough for the right side operand, print a warning that the result will
be always zero.
|
|
* Add diagnostic to prevent defining unsized static variables.
* Fix tests.
* Add more tests.
* Fix to allow defining variables of link-time size.
* update diagnostic message.
* Fix tests.
* Simplify code.
|