Skip to content

[SPIR-V] Add SPIRV to LLVM_ALL_TARGETS (reapply) #123654

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

Conversation

michalpaszkowski
Copy link
Member

@michalpaszkowski michalpaszkowski commented Jan 20, 2025

This commit promotes the SPIR-V backend from experimental to official status. As a result, SPIR-V will be built by default, simplifying integration and increasing accessibility for downstream projects.

Discussion and RFC on Discourse: https://discourse.llvm.org/t/rfc-promoting-spir-v-to-an-official-target/83614

The PR reapplies the original patch #119653, reverted due to buildbot failures.

This commit promotes the SPIR-V backend from experimental to official
status. As a result, SPIR-V will be built by default, simplifying
integration and increasing accessibility for downstream projects.

Discussion and RFC on Discourse: https://discourse.llvm.org/t/rfc-promoting-spir-v-to-an-official-target/83614
@llvmbot
Copy link
Member

llvmbot commented Jan 20, 2025

@llvm/pr-subscribers-github-workflow

Author: Michal Paszkowski (michalpaszkowski)

Changes

This commit promotes the SPIR-V backend from experimental to official status. As a result, SPIR-V will be built by default, simplifying integration and increasing accessibility for downstream projects.

Discussion and RFC on Discourse: https://discourse.llvm.org/t/rfc-promoting-spir-v-to-an-official-target/83614

The PR reapplies the original patch #119653, reverted due to buildbot failures.


Full diff: https://github.com/llvm/llvm-project/pull/123654.diff

4 Files Affected:

  • (modified) .github/workflows/spirv-tests.yml (+1-1)
  • (modified) llvm/CMakeLists.txt (+1-1)
  • (modified) llvm/Maintainers.md (+5-2)
  • (modified) llvm/docs/ReleaseNotes.md (+6)
diff --git a/.github/workflows/spirv-tests.yml b/.github/workflows/spirv-tests.yml
index 34c77a398c1504..ea466dc6c52e57 100644
--- a/.github/workflows/spirv-tests.yml
+++ b/.github/workflows/spirv-tests.yml
@@ -25,5 +25,5 @@ jobs:
     with:
       build_target: check-llvm-codegen-spirv
       projects:
-      extra_cmake_args: '-DLLVM_TARGETS_TO_BUILD="" -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="SPIRV" -DLLVM_INCLUDE_SPIRV_TOOLS_TESTS=ON'
+      extra_cmake_args: '-DLLVM_TARGETS_TO_BUILD="SPIRV" -DLLVM_INCLUDE_SPIRV_TOOLS_TESTS=ON'
       os_list: '["ubuntu-22.04"]'
diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index f14065ab037990..ad12100fdb5b89 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -486,6 +486,7 @@ set(LLVM_ALL_TARGETS
   PowerPC
   RISCV
   Sparc
+  SPIRV
   SystemZ
   VE
   WebAssembly
@@ -498,7 +499,6 @@ set(LLVM_ALL_EXPERIMENTAL_TARGETS
   CSKY
   DirectX
   M68k
-  SPIRV
   Xtensa
 )
 
diff --git a/llvm/Maintainers.md b/llvm/Maintainers.md
index 74dcc5abf5645e..2e995dc27dcd04 100644
--- a/llvm/Maintainers.md
+++ b/llvm/Maintainers.md
@@ -284,8 +284,11 @@ [email protected] (email), [koachan](https://github.com/koachan) (GitHub)
 
 #### SPIRV backend
 
-Ilia Diachkov \
-[email protected] (email), [iliya-diyachkov](https://github.com/iliya-diyachkov) (GitHub)
+Vyacheslav Levytskyy \
+[email protected], [email protected] (email), [VyacheslavLevytskyy](https://github.com/VyacheslavLevytskyy) (GitHub)
+
+Nathan Gauër \
+[email protected] (email), [Keenuts](https://github.com/Keenuts) (GitHub)
 
 #### SystemZ backend
 
diff --git a/llvm/docs/ReleaseNotes.md b/llvm/docs/ReleaseNotes.md
index 8f88b824f965aa..48f962d212e86d 100644
--- a/llvm/docs/ReleaseNotes.md
+++ b/llvm/docs/ReleaseNotes.md
@@ -47,6 +47,12 @@ for adding a new subsection. -->
   same semantics. The normalizer makes it easier to spot semantic differences
   when diffing two modules which have undergone different passes.
 
+* The SPIR-V backend is now an official LLVM target, providing OpenCL and SYCL
+  conformance and establishing a foundation for broader applicability to other
+  APIs, including Vulkan, GLSL, and HLSL. This backend aims to offer a unified
+  approach for diverse compute and graphics workloads, providing a robust
+  alternative to the Khronos SPIR-V LLVM Translator.
+
 * ...
 
 <!-- If you would like to document a larger change, then you can add a

@michalpaszkowski michalpaszkowski merged commit f427fef into llvm:main Jan 20, 2025
12 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Jan 20, 2025

LLVM Buildbot has detected a new failure on builder clang-debian-cpp20 running on clang-debian-cpp20 while building .github,llvm at step 5 "build-unified-tree".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/108/builds/8354

Here is the relevant piece of the build log for the reference
Step 5 (build-unified-tree) failure: build (failure)
...
133.175 [3463/17/2487] Building AMDGPUGenRegisterBank.inc...
134.397 [3462/17/2488] Building RISCVGenInstrInfo.inc...
136.109 [3461/17/2489] Building RISCVGenGlobalISel.inc...
136.998 [3460/17/2490] Building AMDGPUGenRegisterInfo.inc...
139.646 [3459/17/2491] Building CXX object lib/Target/SPIRV/CMakeFiles/LLVMSPIRVCodeGen.dir/SPIRVInstrInfo.cpp.o
140.455 [3458/17/2492] Building RISCVGenDAGISel.inc...
142.522 [3457/17/2493] Building CXX object lib/Target/SPIRV/CMakeFiles/LLVMSPIRVCodeGen.dir/SPIRVInlineAsmLowering.cpp.o
142.680 [3456/17/2494] Building CXX object lib/Target/SPIRV/CMakeFiles/LLVMSPIRVCodeGen.dir/SPIRVAPI.cpp.o
143.638 [3455/17/2495] Building CXX object lib/Target/SPIRV/CMakeFiles/LLVMSPIRVCodeGen.dir/SPIRVMetadata.cpp.o
145.792 [3454/17/2496] Building CXX object lib/Target/SPIRV/CMakeFiles/LLVMSPIRVCodeGen.dir/SPIRVBuiltins.cpp.o
FAILED: lib/Target/SPIRV/CMakeFiles/LLVMSPIRVCodeGen.dir/SPIRVBuiltins.cpp.o 
ccache /usr/bin/clang++-17 -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/vol/worker/clang-debian-cpp20/clang-debian-cpp20/build/lib/Target/SPIRV -I/vol/worker/clang-debian-cpp20/clang-debian-cpp20/llvm-project/llvm/lib/Target/SPIRV -I/vol/worker/clang-debian-cpp20/clang-debian-cpp20/build/include -I/vol/worker/clang-debian-cpp20/clang-debian-cpp20/llvm-project/llvm/include -Wno-deprecated-enum-enum-conversion -Wno-deprecated-declarations -Wno-deprecated-anon-enum-enum-conversion -Wno-ambiguous-reversed-operator -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG -std=c++20 -fvisibility=hidden  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -MD -MT lib/Target/SPIRV/CMakeFiles/LLVMSPIRVCodeGen.dir/SPIRVBuiltins.cpp.o -MF lib/Target/SPIRV/CMakeFiles/LLVMSPIRVCodeGen.dir/SPIRVBuiltins.cpp.o.d -o lib/Target/SPIRV/CMakeFiles/LLVMSPIRVCodeGen.dir/SPIRVBuiltins.cpp.o -c /vol/worker/clang-debian-cpp20/clang-debian-cpp20/llvm-project/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp
/vol/worker/clang-debian-cpp20/clang-debian-cpp20/llvm-project/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp:615:15: error: invalid operands to binary expression ('std::memory_order' and 'unsigned int')
  615 |     if (Order == Semantics) {
      |         ~~~~~ ^  ~~~~~~~~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_pair.h:812:5: note: candidate template ignored: could not match 'pair<_T1, _T2>' against 'std::memory_order'
  812 |     operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
      |     ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_iterator.h:534:5: note: candidate template ignored: could not match 'reverse_iterator<_IteratorL>' against 'std::memory_order'
  534 |     operator==(const reverse_iterator<_IteratorL>& __x,
      |     ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_iterator.h:593:5: note: candidate template ignored: could not match 'reverse_iterator<_Iterator>' against 'std::memory_order'
  593 |     operator==(const reverse_iterator<_Iterator>& __x,
      |     ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_iterator.h:1678:5: note: candidate template ignored: could not match 'move_iterator<_IteratorL>' against 'std::memory_order'
 1678 |     operator==(const move_iterator<_IteratorL>& __x,
      |     ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_iterator.h:1678:5: note: candidate template ignored: could not match 'move_iterator<_IteratorL>' against 'unsigned int'
/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_iterator.h:1748:5: note: candidate template ignored: could not match 'move_iterator<_Iterator>' against 'std::memory_order'
 1748 |     operator==(const move_iterator<_Iterator>& __x,
      |     ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/tuple:1905:5: note: candidate template ignored: could not match 'tuple<_TElements...>' against 'std::memory_order'
 1905 |     operator==(const tuple<_TElements...>& __t,
      |     ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/tuple:1905:5: note: candidate template ignored: could not match 'tuple<_TElements...>' against 'unsigned int'
/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/std_function.h:737:5: note: candidate template ignored: could not match 'function<_Res (_Args...)>' against 'std::memory_order'
  737 |     operator==(const function<_Res(_Args...)>& __f, nullptr_t) noexcept
      |     ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/std_function.h:737:5: note: candidate template ignored: could not match 'function<_Res (_Args...)>' against 'unsigned int'
/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/allocator.h:237:5: note: candidate template ignored: could not match 'allocator<_T1>' against 'std::memory_order'
  237 |     operator==(const allocator<_T1>&, const allocator<_T2>&)
      |     ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/allocator.h:237:5: note: candidate template ignored: could not match 'allocator<_T1>' against 'unsigned int'
/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/unordered_map.h:2143:5: note: candidate template ignored: could not match 'unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>' against 'std::memory_order'
 2143 |     operator==(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
      |     ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/unordered_map.h:2157:5: note: candidate template ignored: could not match 'unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>' against 'std::memory_order'
 2157 |     operator==(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
      |     ^

@michalpaszkowski
Copy link
Member Author

michalpaszkowski commented Jan 20, 2025

Two more sanitizer-aarch64-linux-bootstrap-hwasan and sanitizer-aarch64-linux-bootstrap issues:

@llvm-ci
Copy link
Collaborator

llvm-ci commented Jan 20, 2025

LLVM Buildbot has detected a new failure on builder openmp-s390x-linux running on systemz-1 while building .github,llvm at step 6 "test-openmp".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/88/builds/7024

Here is the relevant piece of the build log for the reference
Step 6 (test-openmp) failure: 1200 seconds without output running [b'ninja', b'-j 4', b'check-openmp'], attempting to kill
...
PASS: ompd-test :: openmp_examples/example_3.c (439 of 449)
PASS: ompd-test :: openmp_examples/example_4.c (440 of 449)
PASS: ompd-test :: openmp_examples/example_5.c (441 of 449)
PASS: ompd-test :: openmp_examples/example_task.c (442 of 449)
UNSUPPORTED: ompd-test :: openmp_examples/ompd_bt.c (443 of 449)
PASS: ompd-test :: openmp_examples/fibonacci.c (444 of 449)
UNSUPPORTED: ompd-test :: openmp_examples/ompd_parallel.c (445 of 449)
PASS: ompd-test :: openmp_examples/parallel.c (446 of 449)
PASS: ompd-test :: openmp_examples/nested.c (447 of 449)
PASS: ompd-test :: openmp_examples/ompd_icvs.c (448 of 449)
command timed out: 1200 seconds without output running [b'ninja', b'-j 4', b'check-openmp'], attempting to kill
process killed by signal 9
program finished with exit code -1
elapsedTime=1322.987521

github-actions bot pushed a commit to arm/arm-toolchain that referenced this pull request Jan 20, 2025
michalpaszkowski added a commit to michalpaszkowski/llvm-project that referenced this pull request Jan 20, 2025
Fixed a type mismatch issue in the comparison of std::memory_order with
unsigned.

This fixes an issue reported by clang-debian-cpp20 buildbot for
llvm#123654
michalpaszkowski added a commit to michalpaszkowski/llvm-project that referenced this pull request Jan 21, 2025
Fixed a type mismatch issue in the comparison of std::memory_order with
integers.

This fixes an issue reported by clang-debian-cpp20 buildbot for
llvm#123654
michalpaszkowski added a commit that referenced this pull request Jan 21, 2025
Fixed a type mismatch issue in the comparison of std::memory_order with
integers.

This fixes an issue reported by clang-debian-cpp20 buildbot for
#123654
github-actions bot pushed a commit to arm/arm-toolchain that referenced this pull request Jan 21, 2025
…s (#123676)

Fixed a type mismatch issue in the comparison of std::memory_order with
integers.

This fixes an issue reported by clang-debian-cpp20 buildbot for
llvm/llvm-project#123654
michalpaszkowski added a commit that referenced this pull request Jan 21, 2025
This commit promotes the SPIR-V backend from experimental to official
status. As a result, SPIR-V will be built by default, simplifying
integration and increasing accessibility for downstream projects.

Discussion and RFC on Discourse:
https://discourse.llvm.org/t/rfc-promoting-spir-v-to-an-official-target/83614

The PR reapplies the original patch
#119653 and consecutive
#123654, reverted due to
buildbot failures.
github-actions bot pushed a commit to arm/arm-toolchain that referenced this pull request Jan 21, 2025
This commit promotes the SPIR-V backend from experimental to official
status. As a result, SPIR-V will be built by default, simplifying
integration and increasing accessibility for downstream projects.

Discussion and RFC on Discourse:
https://discourse.llvm.org/t/rfc-promoting-spir-v-to-an-official-target/83614

The PR reapplies the original patch
llvm/llvm-project#119653 and consecutive
llvm/llvm-project#123654, reverted due to
buildbot failures.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants