<feed xmlns='http://www.w3.org/2005/Atom'>
<title>slang.git/tests/diagnostics/bad-operator-call.slang, branch master</title>
<subtitle>Making it easier to work with shaders</subtitle>
<id>https://git.yummers.dev/slang.git/atom?h=master</id>
<link rel='self' href='https://git.yummers.dev/slang.git/atom?h=master'/>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/'/>
<updated>2024-10-28T23:40:53+00:00</updated>
<entry>
<title>Replace the word stdlib or standard-library with core-module for source code (#5415)</title>
<updated>2024-10-28T23:40:53+00:00</updated>
<author>
<name>Jay Kwak</name>
<email>82421531+jkwak-work@users.noreply.github.com</email>
</author>
<published>2024-10-28T23:40:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=b7a619b45b0745f166d2dcc5985b994fb1d85d13'/>
<id>urn:sha1:b7a619b45b0745f166d2dcc5985b994fb1d85d13</id>
<content type='text'>
This commit changes the word "stdlib" or "standard library" to "core module" in the source code.</content>
</entry>
<entry>
<title>Improve generic type argument inference. (#3370)</title>
<updated>2023-11-29T19:29:14+00:00</updated>
<author>
<name>Yong He</name>
<email>yonghe@outlook.com</email>
</author>
<published>2023-11-29T19:29:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=4fb3b10b81cf8c976ebd1ebb7fcde7708f022957'/>
<id>urn:sha1:4fb3b10b81cf8c976ebd1ebb7fcde7708f022957</id>
<content type='text'>
* Improve generic type argument inference.

* Fix.

* Fix.

---------

Co-authored-by: Yong He &lt;yhe@nvidia.com&gt;</content>
</entry>
<entry>
<title>Support per field matrix layout (#3101)</title>
<updated>2023-08-14T23:23:19+00:00</updated>
<author>
<name>Yong He</name>
<email>yonghe@outlook.com</email>
</author>
<published>2023-08-14T23:23:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=661d6198bbb9857d3fdc6df477e0742ed0b0765c'/>
<id>urn:sha1:661d6198bbb9857d3fdc6df477e0742ed0b0765c</id>
<content type='text'>
* Support per field matrix layout

* Fix warnings.

* Fix.

* Fix tests.

* Fix spiv gen.

* Fix.

* More test fixes.

* Fix.

* Run only GPU tests on self-hosted servers.

* Remove -use-glsl-matrix-layout-modifier.

* Fix.

---------

Co-authored-by: Yong He &lt;yhe@nvidia.com&gt;</content>
</entry>
<entry>
<title>Make stdlib path just be the filename.  (#1364)</title>
<updated>2020-06-02T18:05:35+00:00</updated>
<author>
<name>jsmall-nvidia</name>
<email>jsmall@nvidia.com</email>
</author>
<published>2020-06-02T18:05:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=f87b6327879ce425531bc1d83f3053c36773d27e'/>
<id>urn:sha1:f87b6327879ce425531bc1d83f3053c36773d27e</id>
<content type='text'>
* Made bad-operaor-call available on all targets.
Fix the line filename to not inclue path, to avoid paths being absolute and therefores value be host environment dependent (causing tests to fail).

* Disable on linux because theres still a problem on gcc x86 where the file path is different.

* Fix to some typos in bad-operator-call.slang

* Fix diagnostic for bad-operator-call.slang</content>
</entry>
<entry>
<title>Define compound intrinsic ops in the standard library (#1273)</title>
<updated>2020-03-16T16:03:19+00:00</updated>
<author>
<name>Tim Foley</name>
<email>tfoleyNV@users.noreply.github.com</email>
</author>
<published>2020-03-16T16:03:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=256a20a163ef6ee93a817472adcb24c076b0c0dc'/>
<id>urn:sha1:256a20a163ef6ee93a817472adcb24c076b0c0dc</id>
<content type='text'>
* Define compound intrinsic ops in the standard library

The current stdlib code has a notion of "compound" intrinsic ops, which use the `__intrinsic_op` modifier but don't actually map to a single IR instruction.
Instead, most* of these map to multiple IR instructions using hard-coded logic in `slang-ir-lower.cpp`.

(* One special case is `kCompoundOp_Pos` that is used for unary `operator+` and that maps to *zero* IR instructions)

All of the opcodes that used to use the `kCompoundOp_` enumeration values now have definitions directly in the stdlib and use the new `[__unsafeForceInlineEarly]` attribute to ensure that they get inlined into their use sites so that the output code is as close as possible to the original.

For the most part, generating the stdlib definitions for the compound ops is straightforward, but here's some notes:

* The unary `operator+` I just defined directly in Slang code, since it doesn't share much structure with other cases

* The unary increment/decrement ops are generated as a cross product of increment/decrement and prefix/postfix. The logic is a bit messy but given that we have scalar, vector, and matrix versions to deal with it still saves code overall

* Because all the compound/assignment cases got moved out, the existing code for generating unary/binary ops can be simplified a bit

* All the no-op bit-cast operations like `asfloat(float)` are now inline identity functions

* A few other small cleanups are made by not having to worry about the compound ops (which used to be called "pseudo ops") sometimes being encoded in to the same type of value as a real IR opcode.

The one big detail here is a fix for how IR lowering works for `let` declarations: they were previously being `materialize()`d which only guarantees that they've been placed in a contiguous and addressable location, but doesn't actually convert them to an r-value. As a result a `let` declaration could accidentally capture a mutable location by reference, which is definitely *not* what we wanted it to do. Fixing this was needed to make the new postfix `++` definition work (several existing tests end up covering this).

One important forward-looking note:

One subtle (but significant) choice in this change is that we actually reduce the number of declarations in the stdlib, because instead of having the compound operators include both per-type and generic overloads (just listing scalar cases for now):

    float operator+=(in out float left, float right) { ... }
    int operator+=(in out int left, int right) { ... }
    ...
    T operator+= &lt;T:__BuiltinBlahBlah&gt;(in out T left, T right) { ... }

We now have *only* the single generic version:

    T operator+= &lt;T:__BuiltinBlahBlah&gt;(in out T left, T right) { ... }

In running our current tests, this change didn't lead to any regressions (perhaps surprisingly).

Given that we were able to reduce the number of overloads for `operator+=` by a factor of N (where N is the number of built-in types), it seems worth considering whether we could also reduce the number of overloads of `operator+` by the same factor by only having generic rather than per-type versions.

One concern that this forward-looking question raises is whether the quality of diagnostic messages around bad calls to the operators might suffer when there are only generic overloads instead of per-type overloads. In order to feel out this problem I added a test case that includes some bad operator calls both to `+=` (which is now only generic with this change) and `+` (which still has per-type overloads). Overall, I found the quality of the error messages (in terms of the candidates that get listed) isn't perfect for either, but personally I prefer the output in the generic case.

As part of adding that test, I also added some fixups to how overload resolution messages get printed, to make sure the function name is printed in more cases, and also that the candidates print more consistently. These changes affected the expected output for one other diagnostic test.

* fixup: disable bad operator test on non-Windows targets</content>
</entry>
</feed>
