| Age | Commit message (Collapse) | Author |
|
|
|
* Fix a bug in default ctor synthesizing
- This is fix for the implementation bug, when a struct has explicit ctor
we should not synthesize the default ctor anymore.
- When invoke the synthesized ctor converted from initializer list, we should
check if the struct is a c-style type if it struct has no synthesized ctor. In this
case we should report error because it's invalid to use initializer list here.
- The only exception is the unsized array, we still have to fall back to use the
legacy initializer list logic to initialize the unsized array until we formalize a
proper solution.
- update test.
|
|
* Update build to allow setting external paths
Update the build to allow setting user-specific paths for the external modules.
This allows building Slang without also fetching the external modules, assuming
they are already present elsewhere locally.
|
|
* Fix lowering of `extern` types with defaults.
* Fix test.
* Fix test.
|
|
* Update SPIRV-Tools and fix new validation errors.
* Implement pointers for glsl target.
* Reworked packStorage/unpackStorage code gen to operate on pointers rather than values.
|
|
This helps to address issue #4760.
The particular issue motivating this fix is that
IGlobalSession::parseCommandLineArguments uses a temporary compile request to parse
options.
The compile request only adds the OptionKind::ForceDXLayout (-fvk-use-dx-layout) to the
"current target" which may be the default target, which
IGlobalSession::parseCommandLineArguments didn't look for, meaning that options like
ForceDXLayout were just ignored.
This leads to test failures in tests that rely on this option, e.g.
tests/spirv/cbuffer-dx-layout-1.slang.
|
|
The new option "SkipDownstreamLinking" will defer final downstream IR
linking to the user application. This option only has an effect if
there are modules that were precompiled to the target IR using
precompileForTarget().
Until now, the default behavior for SPIR-V was to use deferred linking, and
the default behavior for DXIL was to use immediate/internal linking in Slang.
This change only affects the SPIR-V behavior such that both deferred and
non-deferred linking is supported based on the new option.
To support the non-deferred option, Slang will internally call into
SPIRV-Tools-link to reconstitute a complete SPIR-V shader program when
necessary (due to modules having been precompiled to target IR).
Otherwise, if SkipDownstreamLinking is enabled, the shader returned by
e.g. getTargetCode() or getEntryPointCode() may have import linkage to
the SPIR-V embedded in the constituent modules.
Closes #4994
Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
|
|
* Add cuda codegen bug repro
This just compiles tests/compute/simlpe.slang for PTX with the new compilation API, in
order to reproduce a code generation bug.
* Detect entrypoint more robustly when applying ConstRef hack during lowring
For shaders like tests/compute/simple.slang, which have a 'numthreads' attribute but no
'shader' attribute, the old compile request API would add an EntryPointAttribute to the
AST node of the entry point. However, the new API doesn't, and so a certain ConstRef hack
doesn't get applied when using the new API, leading to subsequent code generation issues.
This patch also checks for a 'numthreads' attribute when deciding whether to apply the
ConstRef hack.
This closes issue #6507 and helps to resolve issue #4760.
* Add expected failure list for GitHub runners
Our GitHub runners don't have the CUDA toolkits installed, so they can't run all tests.
|
|
This helps to address issue #4760.
|
|
* Consolidate multiple inout/outs into struct
Fixes #5121
VUID-StandaloneSpirv-IncomingRayPayloadKHR-04700 requires that there be
only one IncomingRayPayloadKHR per entry point. This change does two
things:
1. If an entry point has the one inout or out, or has only ins, then
stay with current implementation.
2. If there are multiple outs/inouts, then create a new structure to
consolidate these fields and emit this structure.
These two code paths are split into two separate functions for clarity.
This patch also adds a new test: multipleinout.slang to test this.
* Address review comments
* Refactor code as per review comments
* format code
* fix failing tests
---------
Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
* Allow partial specialization of existential arguments.
* Fix.
* Add test case for improved diagnostics.
* Fix compile error.
* Fix tests.
* Fix.
* Fix test.
* Fix compile issue.
* Fix typo.
* Address comment.
|
|
* implement sparse residency samples for spirv
* udpate test
* separate tests to non-combined and combined sampler
* remove expected failure
* add expected failure for dx12 combined sampler test
* remove expected failure
* fix submodule merge
* add back dx12 test failure
---------
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
* update hlsl meta
* update test
* use slang syntax in meta file
* improve meta file
* fix pack clamp u8
* remove builtin packed types, use typealias instead
* fix wgsl pack clamp
* fix formatting
---------
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
* Resolve 'extern' types during type layout generation if possible
Closes https://github.com/shader-slang/slang/issues/5994
Closes https://github.com/shader-slang/slang/issues/6437
* format code
---------
Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
* support WaveGetLane* for WGSL and Metal
* update test and glsl support
* address review comments and fix metal test
* add missing pragma guard
* update test
* Revert "update test"
This reverts commit f2b97e91c29de154190710580c343bd0764aedbb.
* update failing glsl metal test and added new test
* make hlsl and glsl outputs similar
* update test
* disable tests for Metal and cleanup
* comment fix
* add expected failures
* correct expected failures list
* remove expected failure
* add tests to expected failure
---------
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
|
|
|
|
The default matrix layout mode was applied in addition to any related options, and this
caused the wrong matrix layout mode to be used.
For example, tests/compute/column-major was failing when attempting to migrate to the new
compilation API.
This helps to address issue #4760
|
|
This helps to address issue #4760.
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
* Add inner texture type to reflection json
* Add expected result of test
* Adjust test expected results
* Fix ci test result
---------
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
* Map `SV_InstanceID` to `gl_InstanceIndex-gl_BaseInstance`
* Fix ci.
|
|
* Make capability diagnostic message more friendly.
* Fix.
* Fix.
* Fix.
* Fix test.
* Update expected fail setting for aarch64/linux
* Fix.
|
|
* Allow `.member` syntax on vector and scalars.
* Fix.
* fix.
* Fix.
* update comment.
* Fix tests.
* Fix warning.
* Add more tests.
|
|
* Fix overload resolution for `MemberExp`r's base expression
Also fixed an issue where `ModuleDeclarationDecl` priority during overload resolution was inverted.
* Made the fix slightly simpler..
* Update overload-resolve.slang
|
|
* hotfix slang-rhi
* Fix missing include
* external/glslang: 15.0.0-37-ga0995c49 -> vulkan-tmp-1.4.309
external/spirv-tools: v2024.4.rc2-44-g3364b982 -> v2024.4.rc2-48-gce37fd67"
|
|
|
|
* Fix precompiledTargetModule tests
Add SPIRV-Tool linker support to gfx unit tests
and use the linker in precompileModule tests
that use precompiled modules to reconstitute
SPIRV shaders that were modularly compiled.
Fix a Slang reference count bug in the
precompile service.
* Use sm_6_6
New DXC requires higher version
for linkability.
* Rename helper function, pass by reference
* Link through slang-glslang
* Add missing files
* Fix metal
* format code
---------
Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
|
|
* Expose value of constant integers in module reflection
This commit adds `VariableReflection::getDefaultValueInt` to get the value of a variable if it is a compile-time constant integer.
TODO: currently it works only if the initializer expression is an integer literal, references to other constant values are not handled.
* Update VarDecl folded constant value during DeclBodyVisitor
Constant folding for integer values is already done internally by _validateCircularVarDefinition, this just reuses the result.
* Address review comments & formatting
* Formatting
---------
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
|
|
* Fix a bug with hoisting 'IRVar' insts that are used outside the loop
- We introduce a 'CheckpointObject' inst and use that to split loop state insts into two pieces (one for within-loop uses and one for outside-loop uses.
- This allows the two kinds of uses to be handled separately by the hoisting mechanism
- CheckpointObject is then lowered to a no-op after hoisting is complete.
* Update slang-ir-autodiff-primal-hoist.cpp
* Update slang-ir-autodiff-primal-hoist.cpp
|
|
* Fix `UseGraph::isTrivial()` test.
* Fix.
* Fix.
* Refactor `UseGraph` and `UseChain`
* Update slang-ir-autodiff-primal-hoist.cpp
* Update all auto-diff locations that handle pointers to treat user pointers as regular values
* Update test to use direct-SPIRV only
---------
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
Closes https://github.com/shader-slang/slang/issues/5751
|
|
* Clone name hint decoration when emiting Undefined
When emiting "Undefined", we lost the information of where it was
synthasized from. This prevents us from providing more helpful error
messages.
The issue was the when we handle "IRLoop", the inputs parameters to the
Phi didn't clone the name hint decoration. This commit clones them when
emiting "Undefined".
* Adding more test case
---------
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
* Legalize array size of SV_TessFactor and SV_InsideTessFactor
When targeting SPIR-V or GLSL, the type for SV_TessFactor must be
float[4]; note that it is not a vector but an array.
Similarly the type of SV_InsideTessFactor has to be an array of
float[2].
When the user shader declare them as arrays smaller than the required
size, Slang will legalize them to the required sizes.
Note that it is not the user mistake to declare floar[3] when the hull
mode is in "tri", as an example. The unused components are expected to
be ignored.
Note also that HLSL allows the type to be float[2|3|4] whereas GLSL and
SPIR-V requires it to be always float[4].
* Change from "quad" domain mode to "tri"
* Handle error case
---------
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
* Fix TypeCheckingCache concurrency.
* Fix.
|
|
noise() is currently marked "unsupported" in Slang documentation, and
has also been unsupported in HLSL since SM 2.0
Until now, noise() was present only to prevent compilation errors, but
not for any actual use since it returns 0.0 always.
Closes #5775
|
|
Improve performance when compiling small shaders.
Avoid copying witness table entries that are not getting used during linking.
Avoid copying auto-diff related decorations and derivative functions during linking, if the user modules doesn't use autodiff.
Cache operator overload resolution results on global session, so each new Session doesn't need to repetitively run through overload resolution from scratch.
|
|
input values are equal, the gradient is split evenly between both inputs. (#6411)
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
Partially fix #6378
* Fix invalid access mode for texture_buffer
* Fix texture view create issue in metal
In newTextureView, levelRange should represent the mipmap level range,
while sliceRange should represent the texture layer range for texture
array. But the implement inverse those two wrongly.
|
|
* Simplify implicit cast ctors for vector & matrix.
* Fix formatting.
* Fix tests.
* Fix Falcor test.
* Mark __builtin_cast as internal.
|
|
* HLSL: Add 'f' suffix to float literals in code generation
Fixes #6078
1) Previously, Slang would emit HLSL float literals without a suffix (e.g.,"1.5"),
which caused DXC to interpret them as 64-bit doubles by default unless
the -HV 202x flag was used. This could cause validation errors when these literals
were used with intrinsics that only accept 32-bit floats (like ddx, ddy).
This change modifies the HLSL emitter to explicitly add 'f' suffix to
32-bit float literals, ensuring they are correctly typed regardless of DXC's version or flags.
For example:
- "1.5" becomes "1.5f"
- "(0.0 / 0.0)" becomes "(0.0f / 0.0f)" for NaN
- "float4(1.0, 2.0, 3.0, 4.0)" becomes "float4(1.0f, 2.0f, 3.0f, 4.0f)"
2) Added a test case to verify the behavior with various float literal scenarios
including basic literals, intrinsic calls, and vector construction.
3) Remove some tests that were marked as known failures
* Add dxil test as suggested by jkwak-work
|
|
* Support for dynamic array of textures access for Texture footprint.
* Do a check for DXIL for dynamic array/footprint.
* format code (#40)
---------
Co-authored-by: jsmall-nvidia <jsmall@nvidia.com>
Co-authored-by: slangbot <ellieh+slangbot@nvidia.com>
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
This commit inlines functions that takes InputPatch and OutputPatch as
the function parameter.
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
|
|
* Fix zero size array handling in slangc
Fixes #2890
1. Fix zero size array handling in slangc
2. Add new zero size array diagnostic test.
* format code
* fix review comments
---------
Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
|
|
|
|
|
|
Fixes #4251
When binding attributes (like [[vk::binding]]) are specified on uniforms
that get packed into the default constant buffer, these binding
attributes are effectively ignored since the uniform will always be
placed at descriptor set 0, binding 0. This can be confusing for users
who expect their explicit bindings to take effect.
This change adds a new warning (71) that informs users when their
binding attributes on uniforms will be ignored, and suggests declaring
the uniform inside a constant buffer to preserve the explicit binding.
The warning helps users understand:
1. Why their binding attribute isn't having the expected effect
2. That the uniform is being packed into the default constant buffer
3. How to fix it by using a constant buffer declaration
Added test case in tests/bugs/binding-attribute-ignored.slang to verify
the warning behavior.
Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
|
|
|