| Age | Commit message (Collapse) | Author |
|
Fixes #4110.
|
|
* `slangc` tool experience improvements.
Fixes #4123.
Fixes #4127.
* Update doc.
|
|
|
|
Slang crashes during obfuscation because of referencing the nullptr
pointer. Add the checking.
In addition, above situation happens when user provide an empty slang
shader with '-obfuscate' option, we shouldn't do anything in that case.
So add an early return in obfuscateModuleLocs if no IR code is actually
generated.
|
|
* Fix NonUniformResourceIndex legalization for SPIRV.
* Update gh-4131.slang
|
|
* capture/replay: interface implementation 1
- Add global session, filesystem, and session capture interface classes:
GlobalSessionCapture for IGlobalSession
FileSystemCapture for ISlangFileSystemExt
SessionCapture for ISession
- Add environment variables to enable it
The 2 variables are SLANG_CAPTURE_LAYER and SLANG_CAPTURE_LOG_LEVEL
SLANG_CAPTURE_LAYER:
In slang_createGlobalSession(), after the compiling/loading stdlib,
we will check the capture environment variable, if it's set to 1,
we will create a GlobalSessionCapture object and return to user
code.
SLANG_CAPTURE_LOG_LEVEL: This is to set the log level, user can
choose the loglevel to debug. (We can remove this when the feature
is fully implemented).
- Update premake file and cmake file to add the capture/replay source folder
* Fix Windows build error
Fix windows build error by adding the "SLANG_MCALL" keyword.
Change to use Slang::ComPtr for those captured object pointers
to simplify the resource management.
Use __func__ macro to print the function name in the log.
|
|
|
|
* Support Metal math functions
Closes #4024
Note that Metal document says Metal doesn't support "double" type;
"Metal does not support the double, long long, unsigned long long,
and long double data types."
According to Metal document, math functions are not defined for
integer types.
That leaves only two types to test: half and float.
As a code clean up, __floatCast is replaced with __realCast.
But I had to add a new signature that can convert from integer to
float.
Some of GLSL functions are moved to hlsl.meta.slang.
For those functions, there isn't builtin functions for HLSL but
there are for GLSL and Metal.
"nextafter(T,T)" is currently not working because it requires Metal
version 3.1 and we invoke metal compiler with a profile version
lower than 3.1.
* Changes based on review comments.
|
|
|
|
* Delete `wrap-global-context` pass.
The pass was added for the metal backend without realizing that the existing `explicit-global-context` does 99% of the job. Instead of duplicating the logic in a different pass for metal, we extend same explicit-global-context pass to work for metal.
* Fix build.
|
|
|
|
* Add host shared library target.
* Attempt fix.
* Fix warnings.
* try fix.
* Fix test.
* Fix.
|
|
* Don't bottleneck Wave intrinsics through `WaveMask*` for spirv.
* Fix.
|
|
* Fix `Ptr::__subscript` to accept any integer index.
* Fix `Ptr::__subscript` to allow 64bit indices.
|
|
* Utilize vector operations over scalar if possible
Closes #4085
* Fix for the failing CI
[ForceUnroll] is removed because it changed the emitted SPIR-V code a
little differently for half-conversion.slang.
SPIR-V code style is changed to a more preferred style,
from "OpXX $$T result $x"
to "result:$$T = OpXX $x"
|
|
|
|
* Fix unzipping logic for inout non-diff parameters and adjust tests
+ Removed `-g0` from `struct-this-parameter.slang` test. Works correctly with the new unzipping logic.
+ Removed `-g0` from `was/warped-sampling-1d.slang` test. Works correctly with DX12 & CS_5_1. CS_5_0 appears to run into an FXC compiler bug with detecting infinite loops where there don't appear to be any.
* Update slang-ir-autodiff-unzip.h
* Update warped-sampling-1d.slang
|
|
* Avoid synthesis for when types can be used as their own differenial
+ Add test
* Add missing files..
* Fix issue with method synthesis for self-differential types
+ Add a generic test
* Fix
* Fix issue with out-of-date type resolution cache.
Witness tables created during the conformance checking phase not being taken into account during the decl type resolution phase because the epoch is not updated after conformance checking.
This leads to certain complex associated-type lookup chains (such as the one in tests/compute/assoctype-nested-lookup) not resolving properly and causing errors.
* Delete self-differential-type-synthesis-extension.slang
* Quick fix to repopulate stdlib cache for deferred stdlib loading
* Update slang-check-decl.cpp
|
|
The syntax like:
[__AttributeUsage(_AttributeTargets.Var)]
[__AttributeUsage(_AttributeTargets.Param)]
struct DefaultValueAttribute
{
int iParam;
};
is allowed.
For user-defined attribute, we can specify more attribute targets on the
attribute declaration. So one attribute can be used in more than one
situations.
|
|
* Fix fmod behavior targetting GLSL and SPIR-V
The default implementation of fmod was doing "Modulo" operation when
"fmod" in HLSL should do "remainder" operation.
* Fix a mistake in `fmod` GLSL target
When using __intrinsic_asm, the "if" logic wasn't emitted.
"__intrinsic_asm" had to be called from a new function and `fmod` had to
call it.
Alternatively, I am using `operator?()` to workaround.
A similar modification is made to `roundEven()` hoping for a better
performance.
|
|
Fixes #4051
This commit implements SPIR-V target for GLSL functions.
It also fixes a few problesm of GLSL targetting implemention too.
|
|
|
|
* Fix texture capabilities
* Remove more __target_intrinsic and fix capability for texture
Fixes #3906
With this commit, following functions will use __target_switch:
- abs
- asdouble
- clamp
- min
- max
- EvaluateAttributeSnapped
- frexp
- log10
- modf
- __glsl_textureXXX
For an unknown reason, I couldn't get "min(int,int)" working with
__target_switch. It causes a test failure in Falcore unit test.
---------
Co-authored-by: ArielG-NV <159081215+ArielG-NV@users.noreply.github.com>
|
|
In current implementation, the some options will be to added
to the target that is only specified by command line "-target".
But if user specifies the target by just using slang API,
e.g. 'spAddCodeGenTarget', those options will be missed.
To fix the problem, we copy the default target's options to
the code-gen target's option set. The default target will only be
useful when there is no target specified in the command line.
|
|
* Fix compile failures when using debug symbol.
* Various fixes.
* Fix intrinsic.
* Fix test.
|
|
* SPIRV: Fix performance issue when handling large arrays.
* Add test for packing.
* Fix clang.
|
|
In SPIRV legalization, a struct wrapper is created around push constants
but is not itself legalized. Putting the struct type into the work
list causes the storage access of the push constant pointer to be
PhysicalStorageBuffer as expected, instead of Function scope that was
produced without the added struct legalization.
Adds a SPIRV test that exercises the fix.
Fixes #3946
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
Currently we only allow variable, struct, and function as the target
for the user-defined attribute, this change adds the function parameter
to the target as well.
|
|
Adds a member dump() to IRInst that can writes the immediate value or IR
inst value to stdout to help with debugging
|
|
CUDA-related targets (#4063)
|
|
* Added diagnostics & built-in type lowering for `[CUDAKernel]` functions
This PR adds
- Diagnostics for non-void return from a cuda kernel entry point
- Diagnostics for using differentiable types in a differentiable cuda kernel entry point
- Logic for converting built-in types (float3, float3x3, etc..) to portable struct types and unpacks the parameter back into a built-in type on the CUDA side. This is because built-in types have different implementations in CUDA & CPP targets, which causes signature mis-match when linking.
* Fix error codes
* Add ability to lower structs and arrays that contain built-in types.
+ Added tests
+ Fix issue where the host-side was not marshalling data to lowered types.
* Update slang-ir-pytorch-cpp-binding.cpp
---------
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
Fixes #3533
- Add logic to perform aligned memory operations for loading from and storing to composite resources, like vectors within the ByteAddress legalize pass.
- Checks
Added a new test for byte address with/without alignment.
---------
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
Do not use "&&" to implement the intrinsic kIROp_And,
instead define a 'and' function in stdlib. So it will be
up to us to determine whether we want to use 'short-circuit'
behavior in stdlib.
|
|
Add option -disable-short-circuit to disable short circuit for logic
operators && and ||. Also, disable the short circuit by default in the
stdlib.
|
|
* Metal: Vertex/Fragment builtin and layouts.
* Fix.
* Fix test.
* Emit user semantic on vertex/fragment attributes.
|
|
* Replace __target_intrinsics and __specialize_for_target
Partially resolves #3906
Most but not all __target_intrinsics are replaced with __target_switch.
All __specialize_for_target are replaced with __target_switch.
This change is mostly processed by a temporary c++ program mechanically.
Because the change is already too big, the remaining __target_intrinsics
will be replaced later in another commit.
* Fix indentations
* Add diff.meta.slang
* Revert the change in __sizeOf<>().
"$G0" doesn't seem to work. It needs to be addressed later.
* Revert more functions that use `$G0` keyword
|
|
Do not mange the name of identifiers decorated by "__extern_cpp".
For a slang files that are included by the library module and entry
point module, slang could generated two different mangled names for
the same functions, because the function with a struct parameter will
make the mangled function name contains the file name. Therefore, we
allow using "__extern_cpp" on such struct, such that no file name is
associated in the mangled name.
|
|
|
|
* Force Inline if reftype
Fixes #3997.
If we are using a refType, we now ForceInline.
remarks:
1. Modifications were made in slang-ir-glsl-legalize to change how we translate GlobalParam proxy's into GlobalParam.
a. We now handle the senario where a globalParam is used in multiple disjoint blocks (like 2 different functions).
* try to figure out why CI fails but local works
try to inline DispatchMesh, works locally, may fail on CI(?)
* try another fix
* add task tests + don't allow semi-early task-shader inline
Task shader uses DispatchMesh which is a very big 'hack' where we check for the function name and modify the callees in very large ways. This function does inline, but it cannot inline early due to future mangling that this operation requires todo. This is reflected with the `[noRefInline]` modifier. It is a modifier so users may stop mandatory inlines with `__ref` parameter.
|
|
Fixes #4031
Each component of unpackU/Snorm4x8 had to be masked for 8bits.
|
|
* Keep const-ness in generic functions
Closes #3834
The issue was that "const" variables inside of generic functions became
non-const variables. This issue prevented some of GLSL texture
functions from being called inside of generic functions.
When `propagateConstExpr()` iterates the global functions, the generic
functions had to be handled little differently. This commit allows the
iteration to happen for the generic functions.
* Adding an explantion of the test as a comment
|
|
* Support derivative functions in compute & capabilities adjustments
fixes #4000
PR implements derivative functions in compute shaders properly so we have the functionality for SPIR-V & GLSL. Tests reflect fragment and compute paths.
PR also adjusts capabilities to correct wrong SPRI-V target capabilities for when using textures.
Remarks:
1. __requireComputeDerivative(); is a intrinsic_op and not modifier since inlining will destroy the modifier.
2. Derivative mode is tied to an entry point decoration `[DerivativeGroupQuad]`/`[DerivativeGroupLinear]` or GLSL syntax ``derivative_group_linearNV`. Default is to set the mode to `[DerivativeGroupQuad]`
* remove -emit-spirv-directly
* fixes
1. fix minor issue fwidth change where I returned the wrong type
2. fix issue where glslang{glsl->spirv} is wrong, so we don't run that test and just run the glsl test & direct spir-v test for intrinsic-texture.slang
* adjust as per review and refine code
1. add test to ensure multi-diverging-in-logic entry points work -- 2 functions which may cause computeDerivatives + 1 that uses, 1 that does not.
2. naming
3. use entry point ref graph for c-like-targets
4. reordered some code to util's and removed `static linline` since that was just for ease of coding on my end (should not have been pushed).
* Grammer
* split up source file + issolate GLSL emit path change.
---------
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
|
|
* Fix macos CI.
* Fix.
* Fix.
* Fix.
* Fix clang warnings.
* Fix more warnings.
|
|
Adding "override" keywords for member functions whereever they need.
The compiler warning was visible on CI build but not visible on local
visual studio build.
|
|
Resolves #3980
Based on the operator precedence, Slang may omits the parentheses if they
are not needed. DXC prints warnings for such cases and some applications
may treat the warnings as errors.
This commit emits parentheses to avoid the DXC warning even when they
are not needed.
|
|
Fix the issue (#3999).
For a function is defined as extern and export at the same time, don't
report error, we can use the 'export' function to overload the 'extern'
function.
|
|
* Switch to direct-to-spirv backend as default.
* Fix slang-test.
* Fix.
* Fix.
|
|
* Fix a bug in fwd-diff for cross product
* Also add a test for the reverse-mode AD
---------
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
|