Skip to content

[SPIR-V] Support KHR Ray tracing's OpTerminateRayKHR and OpIgnoreIntersectionKHR #3285

Closed

Description

These instructions have a different opcode than their NV counterpart, apparently for a reason: both are now terminal instructions.

There is already code in place to emit returns after the NV variant and reorder writes before it, would that be enough to support these functions normally without enforcing AcceptHitAndEndSearch/IgnoreHit to be placed at the end of a shader?

CC JiaoluAMD (@jiaolu) for submitting the intial changes.

Activity

  1. added
    spirv
    on Nov 30, 2020
  2. changed the title [-]Support KHR Ray tracing's OpTerminateRayKHR and OpIgnoreIntersectionKHR[/-] [+][SPIR-V] Support KHR Ray tracing's OpTerminateRayKHR and OpIgnoreIntersectionKHR[/+] on Nov 30, 2020
  3. jiaolu commented on Dec 1, 2020

    @jiaolu
    Contributor

    okay. i will take a look.

  4. jiaolu commented on Dec 3, 2020

    @jiaolu
    Contributor

    a quick look here. new OpIgnoreIntersectionKHR/OpTerminateRayKHR are block terminator. so it is little more complicated than inserting a instruction.

  5. MarijnS95 commented on Dec 3, 2020

    @MarijnS95
    ContributorAuthor

    JiaoluAMD (@jiaolu) Correct. I attempted to make a head-start with a test and adding a new "group" for these two terminals, but am still missing a TerminatorInst. Better if someone else looks into it, I'm not familiar with this codebase at all.

  6. jiaolu commented on Dec 3, 2020

    @jiaolu
    Contributor

    made a quick pull-request, though the internal spirv validator would mis-report one validation error "OpLabel inside basic block"
    though the generated spv can pass the tool spirv-val check.

  7. MarijnS95 commented on Dec 3, 2020

    @MarijnS95
    ContributorAuthor

    jiolu Thanks! The code is pretty much identical to my attempt, goes to show that I ended up understanding it after all, but also ran into the same OpLabel inside basic block error which I assume is the internal validator not knowing that the block ends with that ray tracing terminal?

  8. ehsannas commented on Dec 9, 2020

    @ehsannas
    Contributor

    The SPIRV-Tools fix has been picked up by DXC, and that should fix the issue

  9. MarijnS95 commented on Dec 9, 2020

    @MarijnS95
    ContributorAuthor

    Thanks Ehsan (@ehsannas) and JiaoluAMD (@jiaolu) for quickly picking this up and resolving this issue! We've immediately applied the SPIRV-Tools fixes to our Rust equivalents as well 👍

    Did KhronosGroup/SPIRV-Tools#4049 make it in as well? The same DCE fix but for SPV_KHR_shader_clock which was recently introduced to DXC.
    EDIT: Looks like it does not, the PR was merged barely after the update here. Can we get that in as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    spirv

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions