https://github.com/shader-slang/slang

sort by:
Revision Author Date Message Commit Date
53684ed Fix handling of pointer logic in wgsl backend. (#5129) 21 September 2024, 03:21:18 UTC
c42b5e2 WGSL implement texture intrinsics except gather and sampler-less (#5123) This commit implements all of the texture intrinsics for WGSL except "Gather" and sampler-less. They will be implemented in a separate PR. A few things to note: - texture sampling functions are available only for the fragment shader stage; not for compute - WGSL doesn't have any functions similar to CalculateLevelOfDetail or CalculateLevelOfDetailUnclamped. - WGSL doesn't have a function overlaoding for textureSample with "clamp" or "status" arguments. - WGSL doesn't support Load operation with offset for texture_multisampled_XX and texture_storage_XX. - WGSL supports only four types of depth textures: 2D, 2D_array, cube and cube_array. - WGSL doesn't support "offset" variants for cube and cube_array. 21 September 2024, 02:55:49 UTC
a7fc5b4 Update 003-atomic-t.md 21 September 2024, 01:03:55 UTC
4908349 Initial `Atomic<T>` type implementation. (#5125) * Initial Atomic<T> type implementation. * Update design doc. * Fix. * Add test. * Fixes and add tests. * Fix WGSL. * Fix glsl. * Fix metal. * experiemnt with github metal. * experiment github metal 2 * github metal experiment 3 * experiment with github metal 4. * experiment with metal 5. * experiment 7. * metal experiment 8. * Fix metal tests. --------- Co-authored-by: Yong He <yhe@nvidia.com> 20 September 2024, 22:11:23 UTC
b4c851f Add diagnostic to verify the left hand side of a generic constraint. (#5112) * Add diagnostic to verify the left hand side of a generic constraint. * Fix comment. 20 September 2024, 00:33:24 UTC
0677956 Re-enable slang-test for WGSL (#5120) My previous commit disabled the WGSL test by a mistake. This commit fixes the mistake and run the slang-test for WGSL tests. frexp and modf were still not working for the vector types. 20 September 2024, 00:30:04 UTC
26ca9c5 Synthesize conformance for generic requirements. (#5111) * Synthesize conformance for generic requirements. * Fix. * Fix build error. * address code review. 19 September 2024, 22:44:32 UTC
dd3d80e Allow lookups of overloaded methods. (#5110) * Allow lookups of overloaded methods. * Update slang-reflection-api.cpp * Update slang.cpp --------- Co-authored-by: Yong He <yonghe@outlook.com> 19 September 2024, 20:27:50 UTC
9d40ce4 Update spirv-tools version (#5089) * Update spirv-headers and spirv-tools versions * Fix compute-derivative regressions with upgraded spirv headers Extension was promoted from NV to KHR while retaining same enums. Fixes #5106 * Prevent DCE on ray trace position fetch Adds dummy usage to the intersection positions fetched from HitTriangleVertexPositions to prevent DCE from removing their usage. Fixes #5105 * Update spirv-tools-generated * More DerivativeGroup*KHR test fixes Add fixes for a missing test intrinsic-derivative-function-in-compute.slang Use the {{NV|KHR}} syntax to tolerate either enum. Fixes #5106 * Squash tabs in closesthit test * HACK test CI * Avoid multiple IncomingRayPayloadKHR storage params * Revert "HACK test CI" This reverts commit c2556ea2baef0bd48e4c86f90cf17dfab80015c1. * Avoid multiple IncomingRayPayloadKHR storage params in anyhit 19 September 2024, 20:02:49 UTC
1560326 Add design doc for atomic<T> type. (#5101) * Add design doc for atomic<T> type. * Update design doc. * Fix. * More comment on parameters. 19 September 2024, 18:27:52 UTC
3861be7 refactor render test to use latest slang-rhi (#5119) * refactor render test to use latest slang-rhi * update slang-rhi * update slang-rhi * update slang-rhi * update slang-rhi 19 September 2024, 15:16:48 UTC
fe71eaf Add WGSL intrinsics for synchronization (#5114) This closes issue #5085. 19 September 2024, 08:56:47 UTC
c6b702c Use GITHUB_TOKEN if set (#5070) * Use GITHUB_TOKEN if set We have been having an error from Github saying that API rate limit exceeded for IP. It hits the limit more often if your public IP is shared by many other collegues. {"message":"API rate limit exceeded for 216.228.112.22. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)","documentation_url":"https://docs.github.com/rest/overview/resources-in-the-rest-api#rate-limiting"} The suggested solution from GitHub is to use gh.exe tool with "auth login" arguments. It will store a token and allow us to use API more than the limit set for IP without token. However, our cmake build doesn't use gh.exe and API is called via REST. This commit adds an extra header to the HTTP request with the infomration of the github token if the value is. Usage: cmake.exe --preset vs2019 -DSLANG_GITHUB_TOKEN=your_token_here * Adding a warning message to use LANG_GITHUB_TOKEN --------- Co-authored-by: Yong He <yonghe@outlook.com> 19 September 2024, 07:11:27 UTC
b7617d2 Fix dx on vk with rhi (#5086) Requires this PR https://github.com/shader-slang/slang-rhi/pull/40 Co-authored-by: Yong He <yonghe@outlook.com> 19 September 2024, 07:10:54 UTC
ccc310f Support `IDifferentiablePtrType` (#5031) * initial diff-ref-type interface * Initial support for `IDifferentiablePtrType` * Fix unused vars * More tests + fix switch case fallthrough. * Update slang-ir-autodiff.cpp * Update diff-ptr-type-loop.slang * Add optimization to allow more complex pair types * Update slang-ir-autodiff-primal-hoist.cpp * Update diff-ptr-type-loop.slang * Update slang-ir-autodiff-primal-hoist.cpp * More fixes to address reviews * Update slang-check-expr.cpp * Optimizations + rename `differentiableRefInterfaceType` -> `differentiablePtrInterfaceType` * Move pair logic to ir-builder, unify the type dictionaries. --------- Co-authored-by: Yong He <yonghe@outlook.com> 19 September 2024, 07:10:28 UTC
1781c29 Update auto-diff user guide (#5071) - Remove `dmul` entirely (will be deprecated soon) - Add text about `IDifferentiablePtrType` Co-authored-by: Yong He <yonghe@outlook.com> 19 September 2024, 04:18:00 UTC
b808aa4 Report AD checkpoint contexts (#5058) * Transferring source locations when creating phi instructions * Tracking for simple variables * Deriving source locations for loop counters * Printing checkpoint structure breakdown * More readable output format * Special behavior for loop counters * Writing report to file * Add slangc option to enable checkpoint reports * Display types of checkpointed fields * Message in case there are no checkpointing contexts * Catch source locations for function calls * Source cleanup * Fix compilation warnings * Remove stray dump() * Provide the report through diagnostic notes * Add missing path for sourceLoc during unzip pass * Add tests for reporting intermediates * Include more transfer cases for source locations * Fix ordering in address elimination * Fill in more holes with source location transfer * Remove debugging line * Reverting changes to diagnostic sink * Simplify address elimination using source location RAII contexts * Eliminating manual source loc transfers in forward transcription * Fix local var adaptation to use RAII location setter * Simplify primal hoisting logic for source location transfer * Simplify unzipping with RAII location scopes * Simplify transpose logic * Cleaning up for rev.cpp * Reverting spacing changes * Fix mistake with source loc RAII instantiation * Fix formatting issues 19 September 2024, 03:42:07 UTC
3240799 Lower the priority of looking up the rank of scope (#5065) * 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. 18 September 2024, 21:49:00 UTC
2d83875 Add `IRWArray` interface, and make StructuredBuffer conform to them. (#5097) * Add `IRWArray` interface, and make StructuredBuffer conform to them. * Update user guide. * Fix. * Fixes. 18 September 2024, 20:46:20 UTC
85b996a Add WGSL pack/unpack, constructor, derivatives & misc intrinsics (#5102) * Add WGSL pack/unpack intrinsics This addresses issue #5080. * Add WGSL constructor intrinsics This addresses issue #5081. * Add WGSL derivative and miscellaneous intrinsics This addresses issue #5083. * Add some missing WGSL intrinsics - degrees - faceforward 18 September 2024, 15:36:33 UTC
2f455d3 Fix WGSL frexp and modf that returns a struct (#5096) Two WGSL functions have little different behavior compared to other shader languages: frexp and modf. They return a struct to return two values. 18 September 2024, 02:43:52 UTC
0716646 Implement math intrinsics for WGSL (#5078) * Implement math intrinsics for WGSL This commit implements math related intrinsics and a few others for WGSL. The implementation is based on the following doc, https://www.w3.org/TR/WGSL slang-test was looking for the downstream compiler for WGSL even though it is not used. This commit adds a minimal change to avoid the crash. 17 September 2024, 20:51:08 UTC
25d1559 release-note.sh fixes (#5068) Add a gh.exe search path that works with cygwin installations. Do not bail out from the breaking changes loop when a change is found without PR#. Instead, continue to the next one. This fixes an issue where [BREAKING] changes appear in the detailed change list by not in the summary of breaking changes. 17 September 2024, 05:24:44 UTC
d866c0b Add API method to specialize function reference with argument types (#4966) * Add `FunctionReflection::specializeWithArgTypes()` * Update slang.cpp * Use a shared semantics context on linkage Improve performance on reflection queries * Try to fix linux/mac compile errors 16 September 2024, 20:04:45 UTC
c46ca4c Remove includes of glslang private headers (#5059) 15 September 2024, 19:12:06 UTC
003df7e Fix the issue in resolving the overload functions (#5060) 11 September 2024, 23:48:25 UTC
9fd5381 remove 'test-record-replay.sh' (#5057) Forget removing this the script for testing record-replay. The test is already integrated to slang-test. 10 September 2024, 22:03:25 UTC
d33fad8 Git-ignore VIM temporary files (#5047) Following git-ignore rules are added to ignore VIM temporary files: - *~: Ignores all files ending with a tilde (~), which are Vim's backup files. - .*.swp: Ignores Vim swap files, which have .swp extension. - .*.swo: Ignores Vim swap files created when a .swp file already exists. Co-authored-by: Yong He <yonghe@outlook.com> 10 September 2024, 15:52:11 UTC
1c6e241 Disambiguate subscript decls by preferring the one with more accessors. (#5046) 10 September 2024, 15:13:52 UTC
936c22a Specialize existential return types when possible. (#5044) * Fix inccorect dropping of declref during Unification of DeclaredSubtypeWitness. * Add extension test. * Specialize existential return types when possible. * Fix. * Fix. * Fix falcor issue. 10 September 2024, 15:13:21 UTC
f51b74d Fix inccorect dropping of declref during Unification of DeclaredSubtypeWitness. (#5041) * Fix inccorect dropping of declref during Unification of DeclaredSubtypeWitness. * Add extension test. 10 September 2024, 15:12:36 UTC
e896827 Add proposal for equality constraints (#5043) This proposal builds on the other proposal for `where` clauses. Co-authored-by: Yong He <yonghe@outlook.com> 10 September 2024, 05:30:26 UTC
d9fc7bc Add load paths to return value check (#5042) 10 September 2024, 05:03:27 UTC
170558c Initial WGSL support (#5006) * Add WGSL as a target This is required for #4807. * C-like emitter: Allow the function header emission to be overloaded WGSL-style function headers are pretty different from normal C-style headers: Normal C-style headers: ReturnType Func(...) void VoidFunc(...) WGSL-style headers: fn Func(...) -> ReturnType fn VoidFunc(...) This change allows the header style to be overloaded, in order to accomodate WGSL-style headers as required to resolve issue #4807, but retains normal C-style headers as the default implementation. [1] https://www.w3.org/TR/WGSL/#function-declaration-sec * C-like emitter: Allow emission of switch case selectors to be overloaded The C-like emitter will emit code like this: switch(a.x) { case 0: case 1: { ... } break; ... } This is not allowed in WGSL. Instead, selectors for cases that share a body must [1] be separated by commas, like this: switch(a.x) { case 0, 1: { ... } break; ... } To prepare for addressing issue #4807, this patch makes the emission of switch case selectors overloadable. [1] https://www.w3.org/TR/WGSL/#syntax-case_selectors * C-like emitter: Support WGSL-style declarations This patch helps to address issue 4807. C-like languages declare variables like this: i32 a; WGSL declares variables like this: var a : i32 The patch introduces overloads so that the forthcoming WGSL emitter can output WGSL-style declarations, which helps to resolve #4807. * C-like emitter: Support overloading of declarators Unlike C-like languages, WGSL does not support the following types at the syntax level, via declarators: - arrays - pointers - references For this reason, this patch introduces support for overloading the declarator emitter, in order to help address issue #4807. C-like languages: int a[3]; // Array-ness of type is mixed into the "declarator" WGSL: var a : array<int, 3>; // Array-ness of type is part of the... type_specifier! * C-like emitter: Allow struct declaration separator to be overridden C-like languages use ';' as a separator, and languages like e.g. WGSL use ','. This change prepares for addressing issue #4807. * C-like emitter: Allow overriding of whether pointer-like syntax is necessary Things like e.g. structured buffers map to "ptr-to-array" in WGSL, but ptr-typed expressions don't always need C-style pointer-like syntax. Therefore, make it overrideable whether or not such syntax is emitted in various cases in order to address #4807. * C-like emitter: Emit parenthesis to avoid warning about & and + precedence This helps with #4807 because WGSL compilers (e.g. Tint) treat absence of parenthesis as an error. * C-like emitter: Add hook for emitting struct field attributes WGSL requires @align attributes to specify explicit field alignment in certain cases. Thus, this patch prepares for addressing #4807. * C-like emitter: Add hook for emitting global param types Declarations of structured buffers map to global array declarations in WGSL. However, in all other cases such as when structured buffers are used in operands, their types map to *ptr*-to-array. This patch makes it possible for the WGSL back-end to say that structured buffers generally map to "ptr-to-array" types, but still have a special case of just "array" when declaring the global shader parameter. Thus, this patch helps with addressing #4807. * IR lowering: Use std140 for WGSL uniform buffers This patch just cuts out some logic that prevented std140 to be chosen for WGSL uniform buffers. Note that WGSL buffers in the uniform address space is not quite std140, but for now it's close enough to avoid compile issues. Later on, a custom layout should be created for WGSL uniform buffers. When that's done, this change will be revisited, but for now it helps to resolve #4807. * Don't emit line directives in WGSL by default WGSL does not support line directives [1]. The plan currently seems to be to instead support source-map [2]. This is part of addressing issue #4807. [1] https://github.com/gpuweb/gpuweb/issues/606 [2] https://github.com/mozilla/source-map * WGSL IR legalization: Map SV's The implementation closely follows the cooresponding one for Metal. Supported: - DispatchThreadID - GroupID - GroupThreadID - GroupThreadID Unsupported: - GSInstanceID This is not complete, but it helps to address #4807. * WGSL emitter: Add support for basic language constructs A lot of the basics are added in order to generate correct WGSL code for basic Slang language constructs. This addresses issue #4807. This adds support for at least the following: - statments - if statements - ternary operator - while statement - for statements - variable declarations - switch statements - Note: Slang may emit non-constant case expressions, see issue 4834 - literals - integer literals - u?int[16|32|64]_t - float and half literals - bool literals - vector literals and splatting (e.g 1.xxx) - function definitions - assignments - +=, *=, /= - array assignments - vector assignments/updates - swizzles of other vectors - from matrix rows ('m[i]' notation) - from matrix cols (using swizzle notation, e.g 'm._11_12_13') - matrix assignments/updates - to rows ('m[i]' notation) - to cols (using swizzle notation, e.g 'm._11_12_13') - declarations - arrays [1] https://www.w3.org/TR/WGSL/#syntax-switch_body * Add some WGSL capabilities This patch registers some WGSL capabilities required to pass many of the initial compute shader compile tests. Many capabilities still remain to be added -- this is just an initial set to help resolve issue #4807. - asint - min and max - cos and sin - all and any * WGSL and C-like emitters: Add hack to bitcast case expression In WGSL, the switch condition and case types must match. https://www.w3.org/TR/WGSL/#switch-statement Slang currently allows these types to mismatch, as pointed out in #4921. Issue #4921 should eventually be addressed in the front-end by a patch like [1]. However, at the moment that would break Falcor tests. Thus, this patch temporarily works around the issue in the WGSL emitter only in order to help resolve #4807. In the future, the Falcor tests should be fixed, this patch should be dropped and [1] should be merged instead. [1] a32156ef52f43b8503b2c77f2f1d51220ab9bdea 09 September 2024, 17:08:29 UTC
110d82f Fix generic IInteger `mod` implementation. (#5037) 09 September 2024, 15:18:26 UTC
69ee8f6 Correct control flow in getParentBreakBlockSet (#5024) Co-authored-by: ArielG-NV <159081215+ArielG-NV@users.noreply.github.com> Co-authored-by: Yong He <yonghe@outlook.com> 06 September 2024, 23:52:52 UTC
dcd6c24 Remove incorrect UTF decode assert (#5028) The assert assumed that after removing a BOM and "deflating" UTF* to UTF8, the decoded (UTF8) size should be less than the raw size (UTF8 or UTF16). However, UTF8 is not actually smaller than UTF16 for some UTF16 codepoints. Specifically, UTF16 code points (2 bytes) 0x800+ are 3 to 4 bytes large. The assert is mostly obeyed for source code files, but is easily violated for binary files with more random values. Wikipedia clarifies why: https://en.wikipedia.org/wiki/UTF-8#UTF-16 "Text encoded in UTF-8 will be smaller than the same text encoded in UTF-16 if there are more code points below U+0080 than in the range U+0800..U+FFFF. This is true for all modern European languages. It is often true even for languages like Chinese, due to the large number of spaces, newlines, digits, and HTML markup in typical files." 06 September 2024, 18:38:33 UTC
8662375 Update 000-template.md 06 September 2024, 04:17:28 UTC
db764a0 Update 010-new-diff-type-system.md 06 September 2024, 04:13:09 UTC
e63ac64 Update 007-variadic-generics.md 06 September 2024, 04:11:09 UTC
b4ae24d Update 001-where-clauses.md 06 September 2024, 04:06:48 UTC
20f9086 Update proposal template 06 September 2024, 04:06:28 UTC
f929b42 Fix doc build errors. (#5018) 05 September 2024, 22:31:22 UTC
5f1ba7b Various documentation improvements. (#5017) 05 September 2024, 22:12:52 UTC
3136771 Initial -embed-spirv support (#4974) * Initial -embed-spirv support Add support for SPIR-V precompilation using the framework established for DXIL. Work on #4883 * SLANG_UNUSED * Add linkage attributes to exported spirv functions * Combine DXIL and SPIRV paths * Whitespace fix * Merge remaining precompiled spirv/dxil paths * Change inst accessors to return codegentarget * Add unit test for precompiled spirv --------- Co-authored-by: Yong He <yonghe@outlook.com> 05 September 2024, 18:59:28 UTC
33e8bfd Fix SPIRV SV_TessFactor type adaptation logic. (#5010) * Fix SPIRV SV_TessFactor type adaptation logic. * Fix compile error. 05 September 2024, 18:53:56 UTC
879ee3d Support entrypoints defined in a namespace. (#5011) * Support entrypoints defined in a namespace. * Fix test. 05 September 2024, 18:53:14 UTC
a3b25ce Add language proposal for where clauses (#5015) This is meant to be a starting point, such that we can refine the proposal and the implementation in tandem until we are happy with both. Co-authored-by: Yong He <yonghe@outlook.com> 05 September 2024, 18:27:07 UTC
e5ead40 Fix invalid documentsymbol error in langauge server. (#5012) 05 September 2024, 18:25:09 UTC
77ecad2 Fix spirv emit for global pointer variable. (#5009) 05 September 2024, 18:24:43 UTC
d655302 Support `where` clause and type equality constraint. (#4986) * Support `where` clause. * Fix. * Fix parser. * Enhance test to cover traditional __generic syntax. * Update user-guide. * Support `where` clause on associatedtype. * Fix. * Put in more comments. 05 September 2024, 18:24:19 UTC
a88055c Respect matrix layout in uniform and in/out parameters for HLSL target. (#5013) * Respect matrix layout in uniform and in/out parameters for HLSL target. * Update test. * Fix test. * fix test. * Fix metal layout calculation. * Fix compile error. * Fix compiler error. --------- Co-authored-by: Yong He <yhe@nvidia.com> 05 September 2024, 17:26:59 UTC
959f55d Remove unused package in primary benchmark script (#5014) Also fixes the self-hosted machine that is used for benchmarking, so that variance of timings can be reduced. 05 September 2024, 15:20:50 UTC
d4aeb18 Document All Capability Atoms and Profiles (#5008) * Document All Capability Atoms and Profiles Fixes: #4125 Unimplemented Considerations: 1. This PR does not add support to query all capability-atom's from a command-line option. It is understood that this might be desired, due to this, the logic to generate `docs\user-guide\a3-02-reference-capability-atoms.md` was made to be "command-line friendly" so minimal changes are needed to pipe our documentation into a command-line option if this change is to be added. Changes: 1. Added a way to document atoms inside `.capdef`. Method to document is described under `source\slang\slang-capabilities.capdef`. The goal is to error if a public atom does not have any form of documentation to ensure we always have up-to-date documentation to guide user on what an atom is/does. * The following `.capdef` file syntax was added * /// [HEADER_GROUP] * /// regular comment 2. When capability generator runs it auto-generates `docs\user-guide\a3-02-reference-capability-atoms.md` 3. Added to the user-guide 3 sections: `Reference`, `Reference -> Capability Profiles`, `Reference -> Capability atoms` section 05 September 2024, 14:41:35 UTC
65dd3b7 Add Documentation For Auto-Generated Constructors & Initializer Lists (#4988) * Add documentation for auto-generated constructors & Initializer Lists fixes: #4903 Add documentation for auto-generated constructors & Initializer Lists, the logic behind this PR is on #4854 * clean up documentation as per review comments --------- Co-authored-by: Yong He <yonghe@outlook.com> 05 September 2024, 02:12:05 UTC
a7e9119 Preserve name in DeclRefExpr for correct highlighitng of `This`. (#4980) * Preserve name in DeclRefExpr for correct highlighitng of `This`. * Fix test. 05 September 2024, 02:10:38 UTC
dc3f2d6 Fix resource specialization with `-embed-dxil` (#4990) * Fix resource specialization with `-embed-dxil` fixes: #4989 Changes: 1. Before handing off to DCE an `oldFunc` which should be removed, clean up any leftover `IRKeepAliveDecoration` (else DCE won't remove our `oldFunc`s) 04 September 2024, 23:57:06 UTC
599dae5 Open existential on arguments after overload resolution. (#4982) * Open existential on arguments after overload resolution. * Fix. * Update source/slang/slang-check-overload.cpp Co-authored-by: ArielG-NV <159081215+ArielG-NV@users.noreply.github.com> --------- Co-authored-by: ArielG-NV <159081215+ArielG-NV@users.noreply.github.com> 04 September 2024, 20:26:16 UTC
ddd2905 Fix extension override behavior, and disallow extension on interface types. (#4977) * Add a test to ensure extension does not override existing conformance. * Fix doc. * Update documentation. * Fix doc. * Add diagnostic test. 04 September 2024, 20:25:37 UTC
56a3c02 Push benchmark results to a viewable page (#4996) * Push benchmark results to slang-material-modules results page (#4993) * Increasing sample count for push benchmark pipeline * Enable only for master branch 04 September 2024, 17:18:54 UTC
1673cf9 Add Path::removeNonEmpty() to remove non-empty dir (#4984) We've implemented a function in slang-record-replay unit test to remove the non-empty directory, now move this function into slang `Path` namespace to make this function as an utility. Close issue #4916 03 September 2024, 20:02:48 UTC
45e0eee fix slang-rhi compile error (#4979) 31 August 2024, 13:30:38 UTC
3033b42 User guide page for SPIR-V target specific information (#4815) Adding a user guide page for SPIR-V specific features. 31 August 2024, 05:10:19 UTC
ca2317a Fix prelude generation by using relative paths for including `slang.h` (#4973) * Change `slang.h` path in `slang-common.h` to allow `slang-embed` to resolve correctly. * Change `slang.h` path in all slang/core files --------- Co-authored-by: Yong He <yonghe@outlook.com> 30 August 2024, 23:58:07 UTC
24df551 Support extension on generic type. (#4968) 30 August 2024, 23:32:34 UTC
49862e7 Updated MDL shader sources for benchmarks (#4965) * Updated MDL shader sources for benchmarks * Shifting sources to external repository * Changing repo URL syntax benchmark.yml * Refactoring entry point names 30 August 2024, 22:18:14 UTC
3cf5935 capture component type (#4967) * Refactor the IComponentType recording Refactor the `IComponentType` recording by creating a abstract class `IComponentTypeRecorder` to record all the methods of `IComponentType`, so that `ICompositeComponentType`, `IModule`, 'IEntryPoint', 'ITypeConformance' can share the same recording implementation. Capture the out IComponentType from linkWithOptions() link() specialize() renameEntryPoint() * fix bugs * Finish the unimeplemented functions in json consumer Fix the address print to use 64 bit hex. Fix the reference count issue when allocating new recorder object. * Disable few examples using reflection APIs * Add gpu-printing example into slang-test * Replace of using std::unique_ptr with RefPtr 30 August 2024, 20:57:11 UTC
de83628 Support specialization constants. (#4963) * Support specialization constants. * Fix. * Fix. * Fix. * Fix. * Make sure specialization constants have names. * Clean up and support the dxc [vk::constant_id] syntax. * Fix. * Fix. * Fix. 30 August 2024, 19:03:23 UTC
f428a05 Draft: integrate slang-rhi (#4970) * add slang-rhi submodule * refactor render-test to use slang-rhi and remove OpenGL support * remove -vk -glsl tests * remove gl test * disable failing test * allow recursive submodules in github actions * update slang-rhi * update slang-rhi --------- Co-authored-by: Yong He <yonghe@outlook.com> 30 August 2024, 16:50:19 UTC
12137e9 Fix redundant decorations in IRParam (#4964) * Fix redundant decorations in IRParam Closes #4922 The problem was that same decorations were added to an IRParam multiple times while running `specializeIRForEntryPoint()`. `cloneGlobalValueWithCodeCommon()` kept cloning decorations for the params that were already processed. 30 August 2024, 14:35:01 UTC
ddf4a32 Support mixture of precompiled and non-precompiled modules (#4860) * Support mixture of precompiled and non-precompiled modules This changes the implementation of precompile DXIL modules to accept combinations of modules with precompiled DXIL, ones without, and ones with a mixture of precompiled DXIL and Slang IR. During precompilation, module IR is analyzed to find public functions which appear to be capable of being compiled as HLSL, and those functions are given a HLSLExport decoration, ensuring they are emitted as HLSL and preserved in the precompiled DXIL blob. The IR for those functions is then tagged with a new decoration AvailableInDXIL, which marks that their implementation is present in the embedded DXIL blob. The DXIL blob is attached to the IR as before, inside a EmbeddedDXIL BlobLit instruction. The logic that determines whether or not functions should be precompiled to DXIL is a placeholder at this point, returning true always. A subsequent change will add selection criteria. During module linking, the full module IR is available, as well as the optional EmbeddedDXIL blob. The IR for functions implemented by the blob are tagged with AvailableInDXIL in the module IR. After linking the IR for all modules to program level IR, the IR for the functions marked AvailableInDXIL are deleted from the linked IR, prior to emitting HLSL and compiling linking the result. This change also changes the point of time when the module IR is checked for EmbeddedDXIL blobs. Instead of happening at load time as before, it happens during immediately before final linking, meaning that the blob does not need to be independently stored with the module separate from the IR as was done previously. Work on #4792 * Clean up debug prints * Call isSimpleHLSLDataType stub * Address feedback on precompiled dxil support Allow for IR filtering both before and after linking. Only mark AvailableInDXIL those functions which pass both filtering stages. Functions are corrlated using mangled function names. Rather than delete functions entirely when linking with libraries that include precompiled DXIL, instead convert the IR function definitions to declarations by gutting them, removing child blocks. * Use artifact metadata and name list instead of linkedir hack * Use String instead of UnownedStringSlice * Update tests * Renaming * Minor edits * Don't fully remove functions post-link * Unexport before collecting metadata 30 August 2024, 06:23:26 UTC
87d3d4f Fix typo SV_DomainLsocation (#4960) * Fix typo SV_DomainLsocation * Fix CI failures --------- Co-authored-by: Yong He <yonghe@outlook.com> 29 August 2024, 17:25:53 UTC
aaf3f5e Make sure `NullDifferential` and its witness are removed after autodiff. (#4958) * Make sure `NullDifferential` and its witness are removed after autodiff. * Fix. * Add a test. 29 August 2024, 06:52:04 UTC
e9f52a6 Fix typo SV_DispatchThreadIndex (#4962) A correct semantic name is SV_DispatchThreadID with "ID" not "Index". Those tests don't actually run and they haven't caused any problems yet. Co-authored-by: Yong He <yonghe@outlook.com> 29 August 2024, 06:26:18 UTC
6e32976 Fix partial inference of variadic generic functions. (#4956) 29 August 2024, 05:32:04 UTC
b85792f Add structured binding propsoal. (#4953) 29 August 2024, 05:29:33 UTC
7893b45 Add `ReportIntersectionOptix` for optix. (#4949) 29 August 2024, 05:27:23 UTC
69e0f87 Update `IFunc` proposal to reflect its implementation. (#4950) 29 August 2024, 05:26:50 UTC
efda04f Migrate 3 more examples to slang-unit-test (#4927) * Convert 'ray-tracing-pipeline' example into slang-test * Convert model-view and 'autodiff-texture' examples to slang-test * Add more error message in RecordReplay test * Fix a shader issue in autodiff-texture 29 August 2024, 00:36:31 UTC
d3a5a47 Ignoring construct field warnings on delegatory methods (#4911) * 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 28 August 2024, 21:42:14 UTC
9192ee4 Metal: Fix metal primitive_id semantic (#4951) 28 August 2024, 20:00:35 UTC
f75816f Update README.md 28 August 2024, 19:08:47 UTC
7c6b71b Metal: Mesh Shaders (#4280) * Metal: mesh shading skeleton * Metal: fixing mesh payload * Metal: improving mesh shader indices output * Metal: Implementing conditional mesh output set * Metal: Trying to not break other backends * Metal: trying to fix mesh output set * Metal: Fixing MeshOutputSet usages * Metal: Fixing vertex and primitive semantics * Metal: Fixing code style * Metal: Fixed hlsl indices set * Fixed HLSL mesh output set disappearing and GLSL mesh output crashing * Metal: Adjusting task test matching --------- Co-authored-by: Yong He <yonghe@outlook.com> 28 August 2024, 19:07:49 UTC
65240d0 Allow capabilities to be used with `[shader("...")]` (#4928) * Allow capabilities to be used with `[shader("...")]` Fixes: #4917 Changes: 1. Allow using capabilities instead of `Stage`s with `EntryPointAttribute`. 2. When resolving capabilities for an entrypoint+profile (per entrypoint) in `resolveStageOfProfileWithEntryPoint` add our `EntryPointAttribute` and resolved capability 3. Added tests and some capabilities related clean-up * fix a warning made by a mistake in syntax * change fineStageByName to assume it is passed a stage without a '_' * test with and without prefix '_' * cleanup some profiles and reprisentation to work better with 'Stage' and 'Profile' This use case is why we need to clean all profile-usage into `CapabilityName`s directly. * change how we compare * only change profiles * let all capabilities be resolved by 'shader' profile for now * fix warning checks I accidently broke * meshshading_internal to _meshshading --------- Co-authored-by: Yong He <yonghe@outlook.com> 28 August 2024, 19:06:23 UTC
638e5fb Make tuple types work in autodiff. (#4923) 28 August 2024, 16:23:08 UTC
16595a8 Auto-cancel obsolete MDL benchmark jobs. (#4929) 28 August 2024, 16:22:26 UTC
4f6f827 Add functor syntax support. (#4926) 28 August 2024, 01:48:41 UTC
fbaa444 Document notable `__ref` uss in stdlib. Remove user docs use of '__ref'. (#4799) 1. Document `__ref` in stdlib. 2. Remove `__ref` example in `docs\user-guide\a1-04-interop.md` 3. New example in `docs\user-guide\a1-04-interop.md` to compensate for no longer providing an example that uses `&` and `OpCapability`/`OpExtension`. Co-authored-by: Yong He <yonghe@outlook.com> 28 August 2024, 01:16:42 UTC
b677949 Adding a document of how to update external/spirv-* (#4902) Co-authored-by: Yong He <yonghe@outlook.com> 28 August 2024, 01:15:59 UTC
5645ecf Script for generating a release note (#4776) * Script for generating a release note Related to #4718 * Adding a comment about how to run --------- Co-authored-by: Yong He <yonghe@outlook.com> 28 August 2024, 01:13:52 UTC
6bb32aa Adds a warning for using `[PreferRecompute]` on methods that may contain side effects (#4707) * Adds a warning for using prefer-recompute on methods that contain side effects * Rename `SideEffects` -> `SideEffectBehavior` --------- Co-authored-by: Yong He <yonghe@outlook.com> 28 August 2024, 01:13:00 UTC
a9882c6 Avoid inlining functions with inline ASM blocks. (#4925) 28 August 2024, 01:10:11 UTC
4aac22d Add ability to specialize generic references to functions, types and more (#4909) * More reflection API features. + Lookup methods and members (by string) on types + Fix issue with looking up non-static members through the scope operator '::' + `GenericReflection`: Cast a decl to generic to access unspecialized generic parameter names and constraints + `GenericReflection`: Use `getGenericContainer()` from function, variable or type to access the 'nearest' generic parent along with specialization info + `GenericReflection::getConcreteType` and `GenericReflection::getConcreteIntVal`: to get the concrete type of a param in the context of the reflection object + `GenericReflection::getOuterGenericContainer` to go up one level and get the outer generic declarations (if there are more than one enclosing generic scopes) + `DeclReflection::getParent`: go to parent declaration. + Change `VariableReflection` to be a `DeclRef` rather than a decl (allows us to return properly substituted types for methods, members, and more) * Fix Falcor issue * Initial namespace reflection support * FIx issue with specializing witness tables * Add API method for specializing parameters of a generic decl * Add ability to specialize generic references to functions, types and more This PR adds the following end-points: - `specializeGeneric()` method that can be called on a generic reflection to substitute arguments for generic type and value parameters. It returns another generic reflection, but this time with the appropriate substitution. - `applySpecializations()` method to then copy these specializations onto an existing type or function reflection. - `isSubType()` to check if a type is a subtype of another type (useful to check if a type is differentiable by checking `IDifferentiable`) This PR also: - Adds `DeclReflection::Kind::Namespace` so that namespace containers are correctly reflected when walking the decl-tree. the name can be obtained through `getName()` but there's no need to cast to a namespace (since there's nothing else we can do with a namespace decl) - Fixes an issue with name-based lookups that fail if a type or function is referenced without specializations. Its helpful to be able to form a reference to a function with default substitutions, so that we can we can specialize it later (either directly, or via argument types). * Update slang.h * Fix up naming * Update slang-compiler.h * Update slang-reflection-api.cpp * Update slang.cpp * Update slang.cpp * Update slang.cpp * Use `checkGenericAppWithCheckedArgs` to do specialization * Update slang-reflection-api.cpp * Update slang-check-decl.cpp 27 August 2024, 20:47:05 UTC
d40c143 Explicitly detach derivative when forming a non-differentiable struct out of differentiable args (#4901) * Explicitly detach derivative when forming a non-differentiable struct out of differentiable args This fixes an issue where initializer lists get optimized out and lose information about non-differentiability. There are 2 places where this could have been fixed: 1. When coercing initializer-list exprs, we can check for non-differentiable aggregate types and use a detach derivative on all the args. 2. Add an extra case in the peephole optimization step that adds detach-derivative when simplifying a make-struct of a non-differentiable type. Even though solution 2 is more elegant, this PR goes with solution 1 simply to avoid having to use a differentiable-type-conformance-context that is used in the auto-diff IR passes to check for differentiability. * Change test name + add expected vals 27 August 2024, 19:00:43 UTC
59c23b9 Migrate examples (#4920) * Migrate cpu-hello-world to new slang API Migrate cpu-hello-world to new slang API, and also convert this example as one of the unit test. * Add 'shader-object' to slang-unit-test * Convert ray-tracing example into unit-test Convert ray-tracing example into unit-test * Fix some replay bugs: - Wrong decode type in 'getEntryPointHostCallable'. - Mistakes in computing the output buffer size. - Wrong decode type in array size in specialize() call. - When capture entrypoint, we should increase the reference count for the allocated entrypoint recorder object, because that is allocated by record layer, it should be owned by the layer, user should not be able to free it. - Improve json consumer on the prelude text. * Test verify change: In our test, we add a "callIdx" string at beginning of the hash-code string, as there could be more than one modules in the example, so they could call 'getEntryPointHash' multiple times, in order for the test can identify them, add "callIdx: <number>" as the key word. 27 August 2024, 16:53:16 UTC
f0ba756 Fix Varying Variable Location Assignments With Hull Shaders (#4915) * Fix Varying Variable Location Assignments With Hull Shaders Fixes: #4913 Fixes: #4540 Changes: 1. Added `kIROp_ControlBarrier` to HLSL/GLSL emitting. 2. Added a method to track 'used' and 'unused' varyings for when legalizing GLSL. This allows us to assign correct offsets to automatically added varyings * Added a `ZeroLSB` check to UIntSet for this purpose * add missing return * code comment adjustment * cleanup * comment and HLSL controlBarrier mistake * assume space for glsl/spriv varying is irrelevant 26 August 2024, 23:07:10 UTC
6c3261b Correct the `generic-jvp.slang` test (#4900) Fixes: #4899 Fixes invalid test results since `{...}` was differentiating the constructor of `myvector` when it should not (see #4877). This change modifies the test so it is correct so other PRs may be merged if indirectly/directly fixing the old use-case for this test. 26 August 2024, 21:17:28 UTC
e1c6fec Implement `-fvk-use-dx-layout` (#4912) * Implement `-fvk-use-dx-layout` Fixes: #4126 Changes: * Added fvk-use-dx-layout * Modified `HLSLConstantBufferLayoutRulesImpl` for correctness (ex: Array is always 16 byte aligned) * Added kFXCShaderResourceLayoutRulesFamilyImpl and kFXCConstantBufferLayoutRulesFamilyImpl to handle fvk-use-dx-layout * Added `ConstantBufferLayoutRules` to manage constant buffer rules * Added `alignCompositeElementOfNonAggregate`/`alignCompositeElementOfAggregate` to handle forced alignment of composites for ConstantBuffers * `StructuredBuffer` rules are mostly equal to `scalar` layout, not much was needed to be changed to support this behavior. * seperate legacy constant buffer and how Slang does constant-buffer normally * undo an addition * remove accidental test * Address review and fix Address review and remove GLSL support since GLSL requires a seperate legalization (need to linearlize structs like with `legalizeMetalIR` to assign explicit offsets) * comments * remove aggregate and non-aggregate logic We don't need this distinction for the logic --------- Co-authored-by: Yong He <yonghe@outlook.com> 26 August 2024, 19:11:41 UTC
7699978 Feature/record unit test (#4910) * Fix the slang-test bug Since we reorganize the build directory, now the libraries are located at different directory with executables in non-Windows platform, we have to change the code on how to find the dll directory. * Integrate the record/replay test into slang-unit-test We create a unit-test-record-replay.cpp to run the converted slang examples in child process as our tests for the record-replay layer. * Disable the test on Apple Due to the limitation of current examples, we temporarily disable them on apples. Change the ci to make this test only be run on the gpu-equipped runners, for other runners we add a white-list file "expected-failure-record-replay-tests.txt". * Remove 'hello-world' example from unit test "hello-world" doesn't use gfx abstract library, instead it uses vk directly, it's not a preferable way. So we will drop this test, instead, we will use cpu-hello-world example. 26 August 2024, 18:54:10 UTC
b2ca2d5 Make variadic generics work with interfaces and forward autodiff. (#4905) 24 August 2024, 04:45:59 UTC
back to top