Skip to content

Commit b3d425c

Browse files
MrSidimsvmaksimo
authored andcommitted
[Backport to 15] Deprecate SPV_INTEL_hw_thread_queries extension from forward llvm-spirv (#3130)
Apparently it was never used. Since it was in preview mode - we can remove it. Signed-off-by: Sidorov, Dmitry <[email protected]>
1 parent 5470cf7 commit b3d425c

File tree

6 files changed

+34
-82
lines changed

6 files changed

+34
-82
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,3 +255,19 @@ LLVM/Clang release and there are no objections from the maintainer(s). There
255255
is no guarantee that older release branches are proactively kept up to date
256256
with main, but you can request specific commits on older release branches by
257257
creating a pull request or raising an issue on GitHub.
258+
259+
## Deprecation of "preview extensions"
260+
261+
In a case if a "preview extension" has to be deprecated, as the first step one
262+
should disable support for forward translation of the extension in the main branch
263+
(this will prevent new SPIR-V modules from being generated using the extension).
264+
Meanwhile support reverse translation for the extension should be continued
265+
(this retains compatibility with existing SPIR-V modules).
266+
* Addition of deprecation warning for the extension is not required, yet recommended for extensions adding
267+
instructions representable in LLVM IR only via SPIR-V friendly LLVM IR.
268+
* We encourage backporting the changes to other branches to speed up removal, but this is not required.
269+
270+
After at least one release cycle one may remove support for reverse translation in the main branch as well,
271+
at which point support for the "preview extension" is considered removed.
272+
273+
These are guidelines, not requirements, and we will consider exceptions on a case-by-case basis.

lib/SPIRV/SPIRVWriter.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1925,14 +1925,12 @@ LLVMToSPIRVBase::transValueWithoutDecoration(Value *V, SPIRVBasicBlock *BB,
19251925
if (static_cast<uint32_t>(Builtin) >= internal::BuiltInSubDeviceIDINTEL &&
19261926
static_cast<uint32_t>(Builtin) <=
19271927
internal::BuiltInGlobalHWThreadIDINTEL) {
1928-
if (!BM->isAllowedToUseExtension(
1929-
ExtensionID::SPV_INTEL_hw_thread_queries)) {
1930-
std::string ErrorStr = "Intel HW thread queries must be enabled by "
1931-
"SPV_INTEL_hw_thread_queries extension.\n"
1932-
"LLVM value that is being translated:\n";
1933-
getErrorLog().checkError(false, SPIRVEC_InvalidModule, V, ErrorStr);
1934-
}
1935-
BM->addExtension(ExtensionID::SPV_INTEL_hw_thread_queries);
1928+
const std::string ErrorStr =
1929+
"SPV_INTEL_hw_thread_queries\n"
1930+
"Please report to "
1931+
"https://github.com/intel/llvm in case if you see "
1932+
"this error.\nRef LLVM Value:";
1933+
getErrorLog().checkError(false, SPIRVEC_DeprecatedExtension, V, ErrorStr);
19361934
}
19371935

19381936
BVar->setBuiltin(Builtin);

lib/SPIRV/libSPIRV/SPIRVErrorEnum.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,8 @@ _SPIRV_OP(InvalidVersionNumber,
2929
"Invalid Version Number.")
3030
_SPIRV_OP(UnspecifiedMemoryModel, "Unspecified Memory Model.")
3131
_SPIRV_OP(RepeatedMemoryModel, "Expects a single OpMemoryModel instruction.")
32+
_SPIRV_OP(DeprecatedExtension,
33+
"Feature requires the following deprecated SPIR-V extension:\n")
34+
35+
/* This is the last error code to have a maximum valid value to compare to */
36+
_SPIRV_OP(InternalMaxErrorCode, "Unknown error code")

test/transcoding/SPV_INTEL_hw_thread_queries/intel_hw_thread_queries_function_call.ll

Lines changed: 0 additions & 35 deletions
This file was deleted.

test/transcoding/SPV_INTEL_hw_thread_queries/intel_hw_thread_queries_load_from_global.ll

Lines changed: 0 additions & 34 deletions
This file was deleted.

test/transcoding/SPV_INTEL_hw_thread_queries/negative_intel_hw_thread_queries.ll

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
; Negative test for SPV_INTEL_hw_thread_queries feature
2-
; Check for errors in case if the extension is not enabled, but the appropriate
3-
; SPV-IR patter is found
1+
; Deprecation test for SPV_INTEL_hw_thread_queries extension.
2+
; Check for errors in case if LLVM IR module contains HW thread queries as a for of
3+
; SPIR-V friendly LLVM IR.
44
; RUN: llvm-as %s -o %t.bc
55
; RUN: not llvm-spirv %t.bc -o %t.spv 2>&1 | FileCheck %s
66

7-
; CHECK: InvalidModule: Invalid SPIR-V module: Intel HW thread queries must be enabled by SPV_INTEL_hw_thread_queries extension.
8-
; CHECK: LLVM value that is being translated:
7+
; CHECK: DeprecatedExtension: Feature requires the following deprecated SPIR-V extension:
8+
; CHECK: SPV_INTEL_hw_thread_queries
9+
; CHECK: Please report to https://github.com/intel/llvm in case if you see this error.
10+
; CHECK: Ref LLVM Value:
911
; CHECK: @__spirv_BuiltInSubDeviceIDINTEL = external addrspace(1) global i32
1012

1113
target datalayout = "e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024"

0 commit comments

Comments
 (0)