<feed xmlns='http://www.w3.org/2005/Atom'>
<title>slang.git/tests/cuda/optix-ignore-hit.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>2025-08-07T21:43:25+00:00</updated>
<entry>
<title>Fix intrinsic LoadLocalRootTableConstant for optix (#7949)</title>
<updated>2025-08-07T21:43:25+00:00</updated>
<author>
<name>Harsh Aggarwal (NVIDIA)</name>
<email>haaggarwal@nvidia.com</email>
</author>
<published>2025-08-07T21:43:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=e595743b5aa4f6bd88800cfbcfd6eead3cc3d01b'/>
<id>urn:sha1:e595743b5aa4f6bd88800cfbcfd6eead3cc3d01b</id>
<content type='text'>
Due to an older version of spec referred there was an inconsitency v1.29
2/20/2025 - [HitObject LoadLocalRootArgumentsConstant]

Latest spec

https://microsoft.github.io/DirectX-Specs/d3d/Raytracing.html#hitobject-loadlocalroottableconstant

Refer:
OptiX backend support for Shader Execution Reordering (SER) features as
outlined in issue #6647. -</content>
</entry>
<entry>
<title>Fix operator precedence in OptiX ray payload pointer casting which broke due to (#6326) (#7194)</title>
<updated>2025-05-26T18:22:45+00:00</updated>
<author>
<name>Harsh Aggarwal (NVIDIA)</name>
<email>haaggarwal@nvidia.com</email>
</author>
<published>2025-05-26T18:22:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=5280ca81025d42239fec492eb72d38606308751a'/>
<id>urn:sha1:5280ca81025d42239fec492eb72d38606308751a</id>
<content type='text'>
* Fix operator precedence in OptiX ray payload pointer casting

Added extra parentheses around the cast to ensure proper operator precedence when
dereferencing the OptiX ray payload pointer. This fixes the issue where the compiler
was treating the expression as (RayPayload_0 *)getOptiXRayPayloadPtr()-&gt;color_0 instead of
((RayPayload_0 *)getOptiXRayPayloadPtr())-&gt;color_0.

Error:
  nvrtc 12.9: tests/cuda/optix-cluster.slang(17): error : expression
must have pointer-to-class type but it has type "void *"
  nvrtc 12.9: note :       (RayPayload_0
*)getOptiXRayPayloadPtr()-&gt;color_0 = color_1;
  nvrtc 12.9: note :                       ^

Tested using:
./build/Debug/bin/slangc -target ptx -Xnvrtc
-I"/home/haaggarwal/NVIDIA-OptiX-SDK-9.0.0-linux64-x86_64/include"
-DSLANG_CUDA_ENABLE_OPTIX  -entry closestHitShaderA
./tests/cuda/optix-cluster.slang

* Fix Check</content>
</entry>
<entry>
<title>Fix: Preserve inout param modifications with OptiX IgnoreHit() (#6956)</title>
<updated>2025-05-17T02:06:19+00:00</updated>
<author>
<name>Harsh Aggarwal (NVIDIA)</name>
<email>haaggarwal@nvidia.com</email>
</author>
<published>2025-05-17T02:06:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=0be6970c01d212aac7ea7db9b6c1556c530d6889'/>
<id>urn:sha1:0be6970c01d212aac7ea7db9b6c1556c530d6889</id>
<content type='text'>
* Add noreturn attribute to IgnoreHit

* Revert "Add noreturn attribute to IgnoreHit"

This reverts commit 3cf2354dada71b9a8713b08f3a2e261de4aabfa4.

* Fix: Preserve inout param modifications with OptiX IgnoreHit()

Issue #6326 identified that in OptiX, when using IgnoreHit() (which
maps to the "noreturn" optixIgnoreIntersection() intrinsic), any
modifications made to 'inout' parameters within the shader would be
lost. This was due to IgnoreHit() preventing the execution of the
copy-back operation from the temporary variable (used to implement
'inout' semantics) to the original parameter.

This commit introduces a new IR pass, 'undoParameterCopy', specifically
for CUDA/OptiX targets to address this. The pass operates as follows:

1. Identifies temporary IR variables created for 'inout' parameters,
   which are now decorated with 'TempCallArgVarDecoration'.
2. Maps these temporary variables back to their original parameter
   storage (e.g., the OptiX payload pointer).
3. Replaces all uses of the temporary variable directly with the
   original parameter pointer.
4. Removes the temporary variable declaration and its initializing store
   (which copied from the original parameter to the temporary).

By transforming the IR to operate directly on the original parameter
storage before any potential call to IgnoreHit(), this fix ensures
that all modifications are preserved, correctly resolving issue #6326.
The pass is integrated into the compilation flow for relevant targets.

* Refactor(IR): Optimize GetOptiXRayPayloadPtr for better DCE/CSE

To allow for more effective dead code elimination (DCE) and
common subexpression elimination (CSE) of `getOptiXRayPayloadPtr`
instructions, this commit:

- Marks `kIROp_GetOptiXRayPayloadPtr` as side-effect-free within
  `IRInst::mightHaveSideEffects` (in `slang-ir.cpp`).
- Flags `GetOptiXRayPayloadPtr` as `HOISTABLE` in its definition
  within `slang-ir-inst-defs.h`.

This addresses scenarios where multiple, potentially redundant,
calls to `getOptiXRayPayloadPtr` might appear in the IR,
allowing optimizers to produce cleaner and potentially more
efficient code for OptiX targets. This change supports efforts
to refine IR handling for ray-tracing shader stages.

* Remove debugging code

* Refactor UndoParameterCopyVisitor for improved performance

    - Optimized IR traversal by combining multiple passes into a single scan
    - Removed unnecessary dictionary, immediately replace uses when a temp var is found
    - Reduced duplicate code paths by checking for both temp vars and redundant stores in one loop
    - Better handling of the 'changed' flag to ensure DCE only runs when needed
    - Results in fewer instruction traversals and improved efficiency for large functions

* Add Test</content>
</entry>
</feed>
