summaryrefslogtreecommitdiffstats
path: root/tests/diagnostics
Commit message (Collapse)AuthorAge
...
* Warnings target switch intrinsic asm (#4727)venkataram-nv2024-07-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* Fixes for Metal ParameterBlock support. (#4752)Yong He2024-07-30
|
* Disable warnings for input global variables (#4745)venkataram-nv2024-07-26
| | | | | | | | | | | | | | | | | | | * 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 mangling (#4691)kaizhangNV2024-07-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* Warnings for uninitialized fields in constructors (#4680)venkataram-nv2024-07-18
| | | | | | | | | | | | | * 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
* Fix bug with uninititialized warnings in nested scopes (#4677)venkataram-nv2024-07-18
| | | Previously the warning system ignores undefined variables in nested scopes (blocks in IR).
* Add unexpected end of input error to lexer (#4673)Ellie Hermaszewska2024-07-18
| | | | | | | * Add unexpected end of input error to lexer * Add end of input test * Simplify testcase
* Warnings function parameters (#4626)venkataram-nv2024-07-16
| | | | | | | | | | | | | | | | | | | | | * 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
* Warnings for uninitialized values (#4530)venkataram-nv2024-07-09
| | | | | | | | | | | | | | | | | | | | | | 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 (#4329)Jay Kwak2024-06-11
| | | | | | | * 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.
* Fix `GetAttributeAtVertex` for spirv and glsl targets. (#4334)Yong He2024-06-11
|
* SPIRV `Block` decoration fixes. (#4303)Yong He2024-06-08
| | | | | | | | | | | | | | | * 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 (#4255)Jay Kwak2024-06-04
| | | | | | | | | * 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 variables. (#4168)Yong He2024-05-15
| | | | | | | | | | | | | | | * 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.
* Add host shared library target. (#4098)Yong He2024-05-03
| | | | | | | | | | | | | * Add host shared library target. * Attempt fix. * Fix warnings. * try fix. * Fix test. * Fix.
* Added diagnostics & built-in type lowering for `[CUDAKernel]` functions (#4042)Sai Praveen Bangaru2024-04-30
| | | | | | | | | | | | | | | | | | | | | * 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>
* Switch to direct-to-spirv backend as default. (#4002)Yong He2024-04-23
| | | | | | | | | * Switch to direct-to-spirv backend as default. * Fix slang-test. * Fix. * Fix.
* Fix __init() functions that returns an existing value (#3866)sriramm-nv2024-04-05
| | | | | | | | | | | | | | | | | | 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.
* Fix assertions due to malformed switch statements (#3858)sriramm-nv2024-04-03
| | | | | | | | | | | | | * 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
* Support SM6.6 keyword "WaveSize" (#3871)Jay Kwak2024-04-01
| | | | | | | | | 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. (#3862)Yong He2024-04-01
| | | | | * Allow bit operators on enum types. * Fix.
* Support arrow operator `->` on pointers. (#3812)Yong He2024-03-21
|
* Fix SPIRV for mesh shaders, checks for invalid target code&recursion. (#3788)Yong He2024-03-18
| | | | | | | | | | | | | | | | | | | | | | | | | * Fix #3780. * Fixers #3781. * Add test for #3781. * Diagnose error on unsupported builtin intrinsic types. * Add check for recursion. * Fix. * Fix. * Fix recursion detection. * Fix. * Fix. * Fix recursion logic. * More fix.
* Add diagnostic on invalid type constraint. (#3769)Yong He2024-03-14
|
* Link-time constant and linkage API improvements. (#3708)Yong He2024-03-07
| | | | | | | | | | | | | * Link-time constant and linkage API improvements. * Fix. * Allow module name to be empty. * Fix. * Fix. * Fix compile error.
* [slangc] generate an error when `-entry` is not specified for targets that ↵Yong He2024-03-05
| | | | | | | | | require them. (#3679) * [slangc] generate an error when `-entry` is not specified for targets that require them. * Fix. * Fix.
* Make slangc commandline parsing compatible with renderdoc. (#3658)Yong He2024-03-01
| | | | | * Make slangc commandline parsing compatible with renderdoc. * Fix tests.
* Allow default values for `extern` symbols. (#3632)Yong He2024-02-26
| | | | | | | * Allow default values for `extern` symbols. * Fix. * Fix test.
* Language server robustness fix. (#3607)Yong He2024-02-20
| | | | | | | | | * Language server robustness fix. * Allow parameter name to be the same as its type. * fix * Fix test.
* Support link time type specialization. (#3604)Yong He2024-02-20
|
* Improve Capability System (#3555)Yong He2024-02-06
| | | | | | | | | | | | | * Improve capability system. * Update documentation. * Tuning semantics. * LSP: hierarchical diagnostics. * Fix test. * Fix test.
* Capability type checking. (#3530)Yong He2024-02-02
| | | | | | | | | * Capability type checking. * Fix. --------- Co-authored-by: Yong He <yhe@nvidia.com>
* Add slangc option to specialize entrypoint + auto glsl mode. (#3531)Yong He2024-02-01
| | | | | | | | | | | * Add slangc option to specialize entrypoint. * Auto enable glsl mode when input file has glsl extension name. * Fix test. --------- Co-authored-by: Yong He <yhe@nvidia.com>
* Define `Texture::Sample` for float element types only. (#3403)Yong He2023-12-12
| | | | | | | | | | | | | | | * Define `Texture::Sample` for float element types only. * Fixes #490. * Fix checking of groupshared. * Add test. * Fix. --------- Co-authored-by: Yong He <yhe@nvidia.com>
* Add check for invalid use of modifiers. (#3402)Yong He2023-12-12
| | | | | | | | | | | * Add check for invalid use of modifiers. * Fixes. * Add test. --------- Co-authored-by: Yong He <yhe@nvidia.com>
* Diagnose for invalid decl nesting + namespace lookup fixes. (#3397)Yong He2023-12-11
| | | | | | | | | | | | | | | | | | | | | | | * Diagnose for invalid decl nesting. * Fix. * Fix. * Fix. * Fix `namespace` lookup and `using` resolution. * fix project files. * revert project files. * Enhance namespace syntax, docs. * Fixes. --------- Co-authored-by: Yong He <yhe@nvidia.com>
* Change default visibility of interface members and update docs. (#3381)Yong He2023-12-06
| | | | | | | | | * Update behavior around interfaces and docs. * Update toc --------- Co-authored-by: Yong He <yhe@nvidia.com>
* Support visibility control and default to `internal`. (#3380)Yong He2023-12-06
| | | | | | | | | | | | | | | | | | | * Support visibility control and default to `internal`. * Fix wip. * Fixes. * Fix. * Fix test. * Add legacy language detection and compatibility for existing code. * Add doc. --------- Co-authored-by: Yong He <yhe@nvidia.com>
* Improve generic type argument inference. (#3370)Yong He2023-11-29
| | | | | | | | | | | * Improve generic type argument inference. * Fix. * Fix. --------- Co-authored-by: Yong He <yhe@nvidia.com>
* Add GLSL Compatibility. (#3321)Yong He2023-11-14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Parse glsl buffer blocks to GLSLInterfaceBlockDecl * Parse glsl local size layout declarations * Parse (and ignore) glsl version directives * spelling * Better l-value interpretation for glsl interface blocks * Better l-value interpretation for glsl interface blocks * Add compile flag for enabling glsl * Parse and ignore precision modifiers. * Automatically import `glsl` module for compatiblity. * Complete vector and matrix types for glsl * Remove generated file from repo * Bump .gitignore * do not mark out globals as params * Synthesize entrypoint layout from global inout vars. * update test result. * Allow HLSL semantic on global variables. * Fix. * Fix test. * Fix win32 compile error. * Add more builtin input/output and texture intrinsics. * Add struct/array constructor syntax. * Skip `#extension` lines. * overide operator * for matrix/vector multiplication. * Add `matrixCompMult`. * Parse modifiers in for loop init var declr. * Add more glsl intrinsics, add stage into to var layout. * Allow `int[3] x` syntax. * Fix array type syntax. --------- Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com> Co-authored-by: Yong He <yhe@nvidia.com>
* Fix ICE when lowering an associatedtype declref from an derived interface. ↵Yong He2023-11-06
| | | | | | | | | | | | | | | | | (#3312) * Fix ICE when lowering an associatedtype declref from an derived interface. * Fixes. * Fix test. * Fix GLSL/SPIRV image subscript swizzle store regression. * Fix. --------- Co-authored-by: Yong He <yhe@nvidia.com>
* Add more diagnostics around use of custom derivatives. (#3291)Yong He2023-10-26
| | | Co-authored-by: Yong He <yhe@nvidia.com>
* Update slang-glslang binaries to v13.0.0.x-g (#3268)Yong He2023-10-09
| | | | | | | | | * Update slang-glslang binaries to v13.0.0.x-g * Update tests. --------- Co-authored-by: Yong He <yhe@nvidia.com>
* Small type system fixes. (#3265)Yong He2023-10-06
|
* Support `constref` parameters passing. (#3249)Yong He2023-09-28
| | | | | | | | | | | | | | | * Support `constref` parameters passing. * Fix. * Fix. * Add test and diagnostic on mix use of __constref and no_diff. * check for [constref] on differentiable member method. --------- Co-authored-by: Yong He <yhe@nvidia.com>
* Added `[AutoPyBindCUDA]` for automatic kernel binding + `[PyExport]` for ↵Sai Praveen Bangaru2023-09-19
| | | | | | | | | | | | | | | | | | | | | | | exporting type information (#3209) * Initial: add a DiffTensor impl * Auto-binding and diff tensor implementations now work * Refactored diff-tensor implementation + added py-export for struct types * Cleanup * Update slang-ir-pytorch-cpp-binding.cpp * Updated test names * Update autodiff-data-flow.slang.expected * Add more versions of load/store & default generic args for DiffTensorView. * Add diagnostic for default generic arg and more tests * Add more `[AutoPyBind]` tests
* Fix attribute highlighting + language server crash. (#3198)Yong He2023-09-08
| | | | | | | | | | | | | * Fix attribute highlighting + language server crash. * Fix wave intrinsic. * Fix. * Fix. --------- Co-authored-by: Yong He <yhe@nvidia.com>
* Fix compiler crashing when `[BackwardDerivativeOf(fn)]` refers to an ↵Sai Praveen Bangaru2023-09-07
| | | | | | | | | | | unresolved `fn` (#3191) * Fix compiler crashing on unresolved decl-ref * Update autodiff-custom-diff-unresolved.slang --------- Co-authored-by: Yong He <yonghe@outlook.com>
* Make a warning if a [mutating] method is called on an in param. (#3184)jsmall-nvidia2023-09-06
| | | | | | | | | * Make a warning if a [mutating] method is passed as an in param. * Kick CI. --------- Co-authored-by: Yong He <yonghe@outlook.com>
* Allow loop counters to be used as constexpr arguments. (#3139)Yong He2023-08-18
| | | | | | | | | | | | | | | * Allow loop counters to be used as constexpr arguments. * Fix. * Fix. * Fix. * Fix. --------- Co-authored-by: Yong He <yhe@nvidia.com>