Skip to content

[SPIR-V]Support KHR_Ray_tracing terminate Ops - #3295

Merged
Ehsan (ehsannas) merged 7 commits into
microsoft:masterfrom
jiaolu:khr_ray_tracing
Dec 4, 2020
Merged

Ehsan (ehsannas) merged 7 commits into
microsoft:masterfrom
jiaolu:khr_ray_tracing

Conversation

@jiaolu

Copy link
Copy Markdown
Contributor

Add OpIgnoreIntersectionKHR/OpTerminateRayKHR related
#3285

@ehsannas
Ehsan (ehsannas) self-requested a review December 3, 2020 15:14
@ehsannas Ehsan (ehsannas) added the spirv Work related to SPIR-V label Dec 3, 2020
@AppVeyorBot

Copy link
Copy Markdown

@ehsannas

Copy link
Copy Markdown
Contributor

@AppVeyorBot

Copy link
Copy Markdown

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Ehsan (@ehsannas)! Unfortunately this still seems to run into failed to optimize SPIR-V: OpLabel inside basic block

SourceLocation loc)
: SpirvTerminator(IK_RayTracingTerminate, opcode, loc) {
assert(opcode == spv::Op::OpTerminateRayKHR ||
spv::Op::OpIgnoreIntersectionKHR);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
spv::Op::OpIgnoreIntersectionKHR);
opcode == spv::Op::OpIgnoreIntersectionKHR);

Praise clang for catching this one:

../tools/clang/lib/SPIRV/SpirvInstruction.cpp:994:47: warning: converting the enum constant to a boolean [-Wint-in-bool-context]
  assert(opcode == spv::Op::OpTerminateRayKHR ||
                                              ^
../tools/clang/lib/SPIRV/SpirvInstruction.cpp:995:10: error: value of type 'spv::Op' is not contextually convertible to 'bool'
         spv::Op::OpIgnoreIntersectionKHR);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ouch. Sad that MSVC didn't catch this. Also not sure why Appveyor bot is passing.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know why appveyor is passing... MSVC doesn't catch the build warning and the FileCheck tests run without optimizations.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, we need to update SPIRV-Tools to recognize these instructions as terminator as well :) Will do so soon

@MarijnS95 Marijn Suijten (MarijnS95) Dec 3, 2020 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another explanation would be Clang version. There are a few new warnings on Clang 11 but Appveyor is still at 10.0.1.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should land this PR, and we will separately make fixes to SPIRV-Tools for recognizing these instructions as termination instructions.

@jiaolu

Copy link
Copy Markdown
Contributor Author

Look good to me.

@AppVeyorBot

Copy link
Copy Markdown

Comment thread tools/clang/lib/SPIRV/SpirvEmitter.cpp Resolved

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clang 11 build is green now, thanks!

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

Labels

spirv Work related to SPIR-V

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants