Issue 210514.1: Add GPU shading and kernel languages

Author: Stuart Brady
Champion: Tony Tye
Date submitted: 2021-05-14
Date revised: 2023-10-23
Date closed: 2023-10-16
Type: Enhancement
Status: Accepted
DWARF Version: 6

Section 7.12, pg 231

Problem

Several common GPU shading and kernel languages are missing from the list of DWARF languages:

This request does not list specific versions of each of the shading and kernel languages, partly on the basis that 210419.1 (or a refinement of that proposal) may be accepted. There are a great many versions of GLSL, in particular, and so adding separate language IDs for each language version does not seem practical. However, it would be desirable if a source language could be specified as being one of the shading or kernel languages without implicitly specifying a specific default version.

OpenCL

In DWARF 5, DW_LANG_OpenCL is unfortunately a misnomer. The correct name would have been DW_LANG_OpenCL_C, as OpenCL refers to the host API and C-based kernel language collectively, rather than the kernel language alone, which would be more properly referred to as "OpenCL C".

It would be incorrect to use DW_LANG_OpenCL to refer to C++ for OpenCL code, regardless of whether the OpenCL host API is used. Also, OpenCL C can be used with other host APIs, e.g. a subset of the language can be used with the Vulkan API.

If possible, it would therefore be desirable to rename DW_LANG_OpenCL to DW_LANG_OpenCL_C, and to add DW_LANG_OpenCL as a (possibly deprecated) alias for compatibility purposes, to avoid potential confusion.

Note that "C++ for OpenCL" and "OpenCL C++" are distinct languages. Although the latter is deprecated in OpenCL 3.0, its language ID within the SPIR-V specification can still occur in the SPIR-V representation of DWARF information provided by SPIR-V's "NonSemantic.Shader.DebugInfo.100" and "OpenCL.DebugInfo.100" specifications, and so requires a corresponding DWARF language ID.

GLSL

GLSL ES is often known as ESSL (and is referred to as ESSL within the SPIR-V specification). However, the name "GLSL ES" may be more meaningful to those not deeply familiar with these languages.

GLSL ES could be considered to be its own set of GLSL language versions, but it seems beneficial to treat GLSL and GLSL ES as separate languages, given that they have separate version histories.

DWARF 5 Proposal

Add the following GPU shading and kernel language names to Section 3.1.1, page 62 Table 3.1 Language names:

Language name Meaning
DW_LANG_GLSL OpenGL Shading Language
DW_LANG_GLSL_ES OpenGL ES Shading Language
DW_LANG_HLSL High-Level Shading Language
DW_LANG_OpenCL_CPP OpenCL C++
DW_LANG_CPP_for_OpenCL C++ for OpenCL
DW_LANG_SYCL SYCL

Change the following in Table 3.1 Language names:

Language name Meaning
DW_LANG_OpenCL OpenCL C

Add the following entries to Section 7.12, page 231 Table 7.17 Language encodings:

Language name Value Default Lower Bound
DW_LANG_GLSL 0x0034 0
DW_LANG_GLSL_ES 0x0035 0
DW_LANG_HLSL 0x0036 0
DW_LANG_OpenCL_CPP 0x0037 0
DW_LANG_CPP_for_OpenCL 0x0038 0
DW_LANG_SYCL 0x0039 0

DWARF 6 (20221116) Proposal

Add the following GPU shading and kernel language names to Section 3.1.1, page 63 Table 3.1 Language names:

Language name Meaning Version Scheme
DW_LNAME_GLSL OpenGL Shading Language VVMMPP
DW_LNAME_GLSL_ES OpenGL ES Shading Language VVMMPP
DW_LNAME_HLSL High-Level Shading Language YYYY
DW_LNAME_OpenCL_C OpenCL C VVMM
DW_LNAME_OpenCL_CPP OpenCL C++ VVMM
DW_LNAME_CPP_for_OpenCL C++ for OpenCL VVMM
DW_LNAME_SYCL SYCL YYYYRR

Remove the following from Table 3.1 Language names:

Language name Meaning Version Scheme
DW_LNAME_OpenCL OpenCL

Add the following to Table 3.2 Version Encoding Schemes:

Scheme Encoding
VVMMPP Major version number times 10,000 plus the minor version number times 100 plus the patch version number. For example, 30607 represents version 3.6.7 while 31215 represents version 3.12.15.
YYYYRR Year in which the language definition was released times 100 plus the revision number. For example, 202007 represents version 2020 revision 7 while 202011 represents version 2020 revision 11.

Add the following entries to Section 7.12, page 235 Table 7.17 Language encodings:

Language name Value Default Lower Bound
DW_LNAME_OpenCL_C 0x0014 0
DW_LNAME_GLSL 0x0020 0
DW_LNAME_GLSL_ES 0x0021 0
DW_LNAME_HLSL 0x0022 0
DW_LNAME_OpenCL_CPP 0x0023 0
DW_LNAME_CPP_for_OpenCL 0x0024 0
DW_LNAME_SYCL 0x0025 0

Remove the following entry from Section 7.12, page 235 Table 7.17 Language encodings:

Language name Value Default Lower Bound
DW_LNAME_OpenCL 0x0014 0

References


2023-08-06: Rewritten into formal proposal.

2023-10-23: Accepted with minor editorial corrections; updated assigned values.