Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DebugInfo] Fix instruction enumeration #2248

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

frasercrmck
Copy link
Contributor

These two opcodes were mistakenly swapped when they were originally added, at least according to the DebugInfo, OpenCL.DebugInfo.100, and NonSemantic.Shader.DebugInfo.100 extended instruction sets.

This might break existing third-party SPIR-V translators if they are accommodating this bug, mistakenly or otherwise.

@frasercrmck
Copy link
Contributor Author

I'm new to this repo so I don't know how best to test this. This isn't a bug that is easily observed within the closed-loop llvm-spirv cycle, but could be seen with external tools using the correct instruction enumeration. I only spotted one test using spirv-dis so I thought I'd check here first.

Copy link
Contributor

@MrSidims MrSidims left a comment

Choose a reason for hiding this comment

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

Thanks for noticing and the patch! It can be tested via adding .spvasm test, calling spirv-as to it and then reverse translating it. Though I personally won't insist on it.

One thing that worries me, that llvm-spirv based SPIR-V consumers, that might be slightly lagging from the trunk will become broken after this fix. Probably it should be fixed on the downstream. Anyway, can we give some graceful period before merging the fix?

@frasercrmck
Copy link
Contributor Author

Thanks for noticing and the patch! It can be tested via adding .spvasm test, calling spirv-as to it and then reverse translating it. Though I personally won't insist on it.

Ah yes, good idea!. I'll try my hand at that while I wait for reviews etc.

One thing that worries me, that llvm-spirv based SPIR-V consumers, that might be slightly lagging from the trunk will become broken after this fix. Probably it should be fixed on the downstream.

Yes, I'm a bit worried about that too. I've no idea what's generally done in these situations!

I don't think it's possible for downstream consumers to reliably distinguish between these two opcodes, unless the pack has > 1 optional operand, but that could also be seen as an invalid SPIR-V binary.

I was also wondering if this sort of thing is back-ported to the older LLVM branches?

Anyway, can we give some graceful period before merging the fix?

That might make sense. What kind of period do you have in mind? I (Codeplay) have an interest in getting this fixed in Intel's DPC++ quite shortly, so I might need to look into patching it "downstream" there first.

@frasercrmck
Copy link
Contributor Author

I've added a LIT test.

These two opcodes were mistakenly swapped when they were originally
added, at least according to the `DebugInfo`, `OpenCL.DebugInfo.100`,
and `NonSemantic.Shader.DebugInfo.100` extended instruction sets.

This might break existing third-party SPIR-V translators if they are
accommodating this bug, mistakenly or otherwise.
@frasercrmck
Copy link
Contributor Author

I've updated the test to remove the invalid DebugCompilationUnit source language (I copied from another test)

The test still isn't spirv-val clean, but spirv-val doesn't seem to accept DebugInfoNone in many places.

@asudarsa asudarsa closed this Jan 18, 2024
@asudarsa asudarsa reopened this Jan 18, 2024
@asudarsa
Copy link
Contributor

Closed and reopened to rerun tests.
@MrSidims and @frasercrmck
Is this ready to be merged?
May be we can add a '[DONOTMERGE]' label if it's not ready?

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants