Skip to content

Add SPIR-V NonSemantic.Shader.DebugInfo.200#186

Open
MrSidims wants to merge 12 commits into
KhronosGroup:mainfrom
MrSidims:update-nonsemantic-debug
Open

Add SPIR-V NonSemantic.Shader.DebugInfo.200#186
MrSidims wants to merge 12 commits into
KhronosGroup:mainfrom
MrSidims:update-nonsemantic-debug

Conversation

@MrSidims

@MrSidims MrSidims commented Feb 7, 2023

Copy link
Copy Markdown
Contributor

It's based on NonSemantic.Shader.DebugInfo.100

New functionality compared to NonSemantic.Shader.DebugInfo.100
New instructions: DebugModule, DebugTypeSubrange,
DebugTypeArrayDynamic and DebugTypeString.

New Debug Operations.

DebugTypeArray no longer has an Component Count <id>
operand. It was replaced by a new operand <id>, <id>, ... Subranges to fully represent all characteristics of the
elements of DebugTypeArray.

Added an optional 'Target function' operand to
DebugFunction.

Added a 'SrcLang' table to be used by DebugCompilationUnit
instruction.

Signed-off-by: Sidorov, Dmitry dmitry.sidorov@intel.com

@MrSidims

MrSidims commented Feb 7, 2023

Copy link
Copy Markdown
Contributor Author

@baldurk hi, may I ask you to take a look? The patch adds new debug instructions, mostly for Fortran and also extends number of debug operations to match DWARF (though some of them require analog of .debug_address and hence are currently just placeholders).

Initially we called the extension as NonSemantic.Kernel.DebugInfo.100 to outline it as debug information for compute and to put less pressure for other vendors to implement it. If you want - this can be restored, but TBH having a single extension looks better.

Comment thread nonsemantic/NonSemantic.Shader.DebugInfo.100.asciidoc Outdated
@baldurk

baldurk commented Feb 7, 2023

Copy link
Copy Markdown
Contributor

I don't think it's a good idea to make significant revisions to this extinst set after it has been released. Generally speaking that's avoided in vulkan and SPIR-V extensions to my knowledge and I think the ecosystem impact would be hard to predict.

I'd also point you to the original OpenCL.DebugInfo.100 extended instruction set, this one is intended for graphics and graphics shaders, so if you're doing OpenCL work that instruction set (or a new one based on it) is likely a better fit. That extension is also managed by Intel I believe so you might be able to discuss it internally too.

@bashbaug

bashbaug commented Feb 8, 2023

Copy link
Copy Markdown
Collaborator

We've discussed this internally already and our current thinking is that a) it'd be better to use a non-semantic extended instruction set going forward vs. the original OpenCL.DebugInfo.100 extended instruction set, and b) it'd be nice to have one unified extended instruction set for debug information vs. two different extended instruction sets that are either potentially different or that we'd need to keep in sync.

We're open to suggestions how best to do this. Perhaps we should do a NonSemantic.Shader.DebugInfo.XYZ version instead (for some values of XYZ) so it is clear this is a newer version?

@baldurk

baldurk commented Feb 8, 2023

Copy link
Copy Markdown
Contributor

In that case yes I think the best thing to do is make a new extended instruction set heavily based on this one, as this one was based on the OpenCL one. Either NonSemantic.Shader.DebugInfo.101 or NonSemantic.Shader.DebugInfo.200, whatever you think is best. Bear in mind though I don't expect the existing users of this set will update to it, so there's still going to be multiple sets in that sense (this version, any new version, and OpenCL.DebugInfo.100).

It's based on NonSemantic.Shader.DebugInfo.100

New functionality compared to NonSemantic.Shader.DebugInfo.100
New instructions: DebugModule, DebugTypeSubrange,
DebugTypeArrayDynamic and DebugTypeString.

New Debug Operations.

DebugTypeArray no longer has an `Component Count <id>`
operand. It was replaced by a new operand `<id>, <id>, ...
Subranges` to fully represent all characteristics of the
elements of DebugTypeArray.

Added an optional 'Target function' operand to
DebugFunction.

Added a 'SrcLang' table to be used by DebugCompilationUnit
instruction.

Signed-off-by: Sidorov, Dmitry <dmitry.sidorov@intel.com>
@MrSidims MrSidims force-pushed the update-nonsemantic-debug branch from 237e35e to 4fab24d Compare February 10, 2023 12:41
@MrSidims MrSidims changed the title Update SPIR-V NonSemantic Kernel DebugInfo Instructions Add SPIR-V NonSemantic Kernel DebugInfo Instructions Feb 10, 2023
@MrSidims

Copy link
Copy Markdown
Contributor Author

Thanks! Based on the feedback restored the original name of the instruction set.

vmaksimo added a commit to vmaksimo/SPIRV-LLVM-Translator that referenced this pull request Feb 13, 2023
This patch implements the initial support for the new debug
specification NonSemantic.Kernel.DebugInfo.100.
It also introduces support for the new debug instruction DISubrange.

Spec: KhronosGroup/SPIRV-Registry#186
vmaksimo added a commit to vmaksimo/SPIRV-LLVM-Translator that referenced this pull request Feb 13, 2023
This patch implements the initial support for the new debug
specification NonSemantic.Kernel.DebugInfo.100.
It also introduces support for the new debug instruction DISubrange.

Spec: KhronosGroup/SPIRV-Registry#186
@johnkslang johnkslang marked this pull request as draft February 15, 2023 16:40
MrSidims pushed a commit to KhronosGroup/SPIRV-LLVM-Translator that referenced this pull request Feb 20, 2023
This patch implements the initial support for the new debug specification NonSemantic.Kernel.DebugInfo.100.
It also introduces support for the new debug instruction DISubrange.

Spec: KhronosGroup/SPIRV-Registry#186
MrSidims pushed a commit to MrSidims/SPIRV-LLVM-Translator that referenced this pull request Feb 22, 2023
It's being added in
KhronosGroup/SPIRV-Registry#186

In DWARF it's used in 'trampoline' functions generated for
external function calls.

Signed-off-by: Sidorov, Dmitry <dmitry.sidorov@intel.com>
MrSidims pushed a commit to KhronosGroup/SPIRV-LLVM-Translator that referenced this pull request Feb 23, 2023
…it (#1854)

This extended source language table is used by DebugCompilationUnit instruction when the extension is enabled. It enables support for more languages than exists in a core specification.
Spec: KhronosGroup/SPIRV-Registry#186

Enabling of Fortran language also allowed to fix FortranArray test that was originally XFAIL-ed in 9e234d9.
MrSidims pushed a commit to KhronosGroup/SPIRV-LLVM-Translator that referenced this pull request Feb 23, 2023
…1853)

It's being added in
KhronosGroup/SPIRV-Registry#186

In DWARF it's used in 'trampoline' functions generated for Fortran external function calls.
Signed-off-by: Sidorov, Dmitry <dmitry.sidorov@intel.com>
@MrSidims MrSidims changed the title Add SPIR-V NonSemantic Kernel DebugInfo Instructions Add SPIR-V NonSemantic.Shader.DebugInfo.200 Feb 24, 2023
@MrSidims MrSidims marked this pull request as ready for review February 24, 2023 12:43
Sidorov, Dmitry added 2 commits March 7, 2023 04:41
Signed-off-by: Sidorov, Dmitry <dmitry.sidorov@intel.com>
Signed-off-by: Sidorov, Dmitry <dmitry.sidorov@intel.com>
MrSidims pushed a commit to MrSidims/SPIRV-LLVM-Translator that referenced this pull request Mar 7, 2023
This instruction describes a dynamic array, mostly for Fortran 90.

Unlike DebugTypeArray it has Data Location, Associated, Allocated
and Rank parameters. If the appropriate metadata parameters
appear in LLVM IR in DW_TAG_array_type metadata, then such
debug type becomes treated as dynamic array by the translator
(of course if the appopriate extended instruction set is enabled).

Spec:
KhronosGroup/SPIRV-Registry#186

Signed-off-by: Sidorov, Dmitry <dmitry.sidorov@intel.com>
MrSidims pushed a commit to KhronosGroup/SPIRV-LLVM-Translator that referenced this pull request Mar 8, 2023
This instruction describes a dynamic array, mostly for Fortran 90.

Unlike DebugTypeArray it has Data Location, Associated, Allocated
and Rank parameters. If the appropriate metadata parameters
appear in LLVM IR in DW_TAG_array_type metadata, then such
debug type becomes treated as dynamic array by the translator
(of course if the appropriate extended instruction set is enabled).

Spec:
KhronosGroup/SPIRV-Registry#186

Signed-off-by: Sidorov, Dmitry <dmitry.sidorov@intel.com>
vmaksimo added a commit to vmaksimo/SPIRV-LLVM-Translator that referenced this pull request Mar 9, 2023
This type instruction describes a string, mostly for Fortran 90.

Spec:
KhronosGroup/SPIRV-Registry#186
vmaksimo added a commit to vmaksimo/SPIRV-LLVM-Translator that referenced this pull request Mar 9, 2023
This type instruction describes a string, mostly for Fortran 90.

Spec:
KhronosGroup/SPIRV-Registry#186
MrSidims pushed a commit to KhronosGroup/SPIRV-LLVM-Translator that referenced this pull request Mar 31, 2023
)

This instruction describes a dynamic array, mostly for Fortran 90.

Unlike DebugTypeArray it has Data Location, Associated, Allocated
and Rank parameters. If the appropriate metadata parameters
appear in LLVM IR in DW_TAG_array_type metadata, then such
debug type becomes treated as dynamic array by the translator
(of course if the appropriate extended instruction set is enabled).

Spec:
KhronosGroup/SPIRV-Registry#186

Signed-off-by: Sidorov, Dmitry <dmitry.sidorov@intel.com>
MrSidims pushed a commit to KhronosGroup/SPIRV-LLVM-Translator that referenced this pull request Mar 31, 2023
This type instruction describes a string, mostly for Fortran 90.

Spec:
KhronosGroup/SPIRV-Registry#186
MrSidims pushed a commit to KhronosGroup/SPIRV-LLVM-Translator that referenced this pull request Mar 31, 2023
This entity represents a module in the programming language, for example a Fortran module.
Spec:
KhronosGroup/SPIRV-Registry#186

The implementation is the same as for SPV_INTEL_debug_module extension. Spec for extension:
https://github.com/intel/llvm/blob/sycl/sycl/doc/design/spirv-extensions/SPV_INTEL_debug_module.asciidoc
MrSidims pushed a commit to KhronosGroup/SPIRV-LLVM-Translator that referenced this pull request Mar 31, 2023
@MrSidims MrSidims marked this pull request as draft April 3, 2023 12:18
@MrSidims

MrSidims commented Apr 3, 2023

Copy link
Copy Markdown
Contributor Author

Moved to draft for a while to figure out how to express virtuality.

MrSidims pushed a commit to KhronosGroup/SPIRV-LLVM-Translator that referenced this pull request Apr 3, 2023
)

This patch implements the initial support for the new debug specification NonSemantic.Kernel.DebugInfo.100.
It also introduces support for the new debug instruction DISubrange.

Spec: KhronosGroup/SPIRV-Registry#186
MrSidims pushed a commit to KhronosGroup/SPIRV-LLVM-Translator that referenced this pull request Apr 3, 2023
… DebugFunction (#1853)

It's being added in
KhronosGroup/SPIRV-Registry#186

In DWARF it's used in 'trampoline' functions generated for Fortran external function calls.
1. added complex type encoding
2. added bitfield flag
3. fixed debug operations
4. added inline namespace

Signed-off-by: Sidorov, Dmitry <dmitry.sidorov@intel.com>
Sidorov, Dmitry and others added 4 commits July 5, 2023 07:36
Signed-off-by: Sidorov, Dmitry <dmitry.sidorov@intel.com>
Signed-off-by: Sidorov, Dmitry <dmitry.sidorov@intel.com>
Signed-off-by: Lu, John <john.lu@intel.com>
This reverts commit 4cdd415.

Calculation of memory size is done with (element size)*bit_ceil(# elements). 'Memory Size' field is not needed.
@spencer-lunarg

Copy link
Copy Markdown
Contributor

Now that we have a published NonSemantic.Shader.DebugInfo.101, can we go that route and add as much "additive" stuff here and make a NonSemantic.Shader.DebugInfo.102 instead?

It seems the only thing you can't "add" is DebugTypeArray but you could honestly make a DebugTypeArray2 at this point

It is going to MUCH easier to have tools "ignore" unknown things than having to manage 2 complete, 90% the same DebugInfo instruction sets

@MrSidims

MrSidims commented Apr 23, 2026

Copy link
Copy Markdown
Contributor Author

can we go that route and add as much "additive" stuff here and make a NonSemantic.Shader.DebugInfo.102 instead

Yes, it's on my TODO list to start porting few things to the rolling version of debug info. Though Fortran-specific things (like TypeArray) should probably be ported by somebody else who are interested in offloading of Fortran through SPIR-V :) . I'd keep this PR open for a while, also I don't expect .200 extension to be completely abandon for few reasons, which @vmaksimo might (or might not) comment on.

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.

6 participants