Skip to content

Commit 27dbd12

Browse files
Maetveisgergely.meszaros
andauthored
[SYCL] Use defined(__SPIRV__) instead of !defined(all other targets) (NFC) (#18148)
This is a simpler logic, the `#else` branch already assumes built-in SPIR-V variables anyway, so any future target would not want to take it. Also this removes one point that needs to be modified if new targets were to be added. NOTE: I could have flipped the logic to make the `#if` positive, but I didn't that to make this a smaller diff. Let me know if that would be preferable. Co-authored-by: gergely.meszaros <gergelym@ubuntu-server>
1 parent 20c0ba0 commit 27dbd12

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

sycl/include/sycl/__spirv/spirv_vars.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
#define __SPIRV_VAR_QUALIFIERS extern "C" const
2020

21-
#if defined(__NVPTX__) || defined(__AMDGCN__) || defined(__SYCL_NATIVE_CPU__)
21+
#if !(defined(__SPIR__) || defined(__SPIRV__))
2222

2323
__DPCPP_SYCL_EXTERNAL size_t __spirv_GlobalInvocationId_x();
2424
__DPCPP_SYCL_EXTERNAL size_t __spirv_GlobalInvocationId_y();
@@ -54,7 +54,7 @@ __DPCPP_SYCL_EXTERNAL uint32_t __spirv_NumSubgroups();
5454
__DPCPP_SYCL_EXTERNAL uint32_t __spirv_SubgroupId();
5555
__DPCPP_SYCL_EXTERNAL uint32_t __spirv_SubgroupLocalInvocationId();
5656

57-
#else // defined(__NVPTX__) || defined(__AMDGCN__)
57+
#else // !(defined(__SPIR__) || defined(__SPIRV__))
5858

5959
typedef size_t size_t_vec __attribute__((ext_vector_type(3)));
6060
__SPIRV_VAR_QUALIFIERS size_t_vec __spirv_BuiltInGlobalSize;
@@ -163,7 +163,7 @@ __DPCPP_SYCL_EXTERNAL inline uint32_t __spirv_SubgroupLocalInvocationId() {
163163
return __spirv_BuiltInSubgroupLocalInvocationId;
164164
}
165165

166-
#endif // defined(__NVPTX__) || defined(__AMDGCN__)
166+
#endif // !(defined(__SPIR__) || defined(__SPIRV__))
167167

168168
#undef __SPIRV_VAR_QUALIFIERS
169169

0 commit comments

Comments
 (0)