Skip to content

Commit e5a415d

Browse files
aratajewigcbot
authored andcommitted
Allow controling SPV-IR version in BiFModule from cmake level
1 parent 840f0d5 commit e5a415d

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

IGC/AdaptorOCL/DriverInfoOCL.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ namespace TC
3939

4040
bool NeedWAToTransformA32MessagesToA64() const override{ return true; }
4141
bool WALoadStorePatternMatch() const override { return true; }
42-
bool WADisableCustomPass() const override { return false; }
42+
bool WADisableCustomPass() const override { return true; }
4343
bool WAEnableMemOpt2ForOCL() const override { return true; }
4444

4545
unsigned int GetLoopUnrollThreshold() const override { return 1280; }

IGC/BiFModule/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,9 @@ set(FLAG "")
448448
if(${VME_TYPES_DEFINED})
449449
list(APPEND FLAG "__VME_TYPES_DEFINED__")
450450
endif(${VME_TYPES_DEFINED})
451+
if(IGC_OPTION__USE_KHRONOS_SPIRV_TRANSLATOR_IN_SC)
452+
list(APPEND FLAG "__USE_KHRONOS_SPIRV_TRANSLATOR__")
453+
endif(IGC_OPTION__USE_KHRONOS_SPIRV_TRANSLATOR_IN_SC)
451454

452455
igc_bif_find_cl_files(IGC_BUILD__BIF_OCL_COMMON_DEPENDS ${IGC_BUILD__BIF_OCL_COMMON_INC_DIRS} "${IGC_OPTION__BIF_SRC_OCL_DIR}/Implementation")
453456

IGC/BiFModule/Headers/spirv.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,7 @@ typedef size_t uintptr_t;
164164
#define M_SQRT2 0x1.6a09e667f3bcdp+0
165165
#define M_SQRT1_2 0x1.6a09e667f3bcdp-1
166166

167-
#define OLD_SPIRV_BUILTINS
168-
169-
#if defined(OLD_SPIRV_BUILTINS)
167+
#if !defined(__USE_KHRONOS_SPIRV_TRANSLATOR__)
170168
#define SPIRV_OVERLOADABLE
171169
#define SPIRV_BUILTIN(opcode, old_mangling, new_mangling) \
172170
__builtin_spirv_Op##opcode##old_mangling
@@ -262,7 +260,7 @@ typedef enum
262260

263261
// Work-item functions
264262

265-
#if defined(OLD_SPIRV_BUILTINS)
263+
#if !defined(__USE_KHRONOS_SPIRV_TRANSLATOR__)
266264
size_t3 __builtin_spirv_BuiltInNumWorkgroups(void);
267265
size_t3 __builtin_spirv_BuiltInWorkgroupSize(void);
268266
size_t3 __builtin_spirv_BuiltInWorkgroupId(void);
@@ -271,7 +269,7 @@ size_t3 __builtin_spirv_BuiltInGlobalInvocationId(void);
271269
size_t3 __builtin_spirv_BuiltInGlobalSize(void);
272270
size_t3 __builtin_spirv_BuiltInEnqueuedWorkgroupSize(void);
273271
size_t3 __builtin_spirv_BuiltInGlobalOffset(void);
274-
#else
272+
#else // defined(__USE_KHRONOS_SPIRV_TRANSLATOR__)
275273
size_t __attribute__((overloadable)) __spirv_BuiltInNumWorkgroups(int dimindx);
276274
size_t __attribute__((overloadable)) __spirv_BuiltInWorkgroupSize(int dimindx);
277275
size_t __attribute__((overloadable)) __spirv_BuiltInWorkgroupId(int dimindx);
@@ -280,7 +278,7 @@ size_t __attribute__((overloadable)) __spirv_BuiltInGlobalInvocationId(int dimin
280278
size_t __attribute__((overloadable)) __spirv_BuiltInGlobalSize(int dimindx);
281279
size_t __attribute__((overloadable)) __spirv_BuiltInEnqueuedWorkgroupSize(int dimindx);
282280
size_t __attribute__((overloadable)) __spirv_BuiltInGlobalOffset(int dimindx);
283-
#endif // defined(OLD_SPIRV_BUILTINS)
281+
#endif
284282

285283
size_t SPIRV_OVERLOADABLE SPIRV_BUILTIN_NO_OP(BuiltInLocalInvocationIndex, , )(void);
286284
size_t SPIRV_OVERLOADABLE SPIRV_BUILTIN_NO_OP(BuiltInGlobalLinearId, , )(void);

IGC/BiFModule/Implementation/workitem.cl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ uint __intel_LocalInvocationIndex()
133133

134134
////////////////////////
135135

136-
#if defined(OLD_SPIRV_BUILTINS)
136+
#if !defined(__USE_KHRONOS_SPIRV_TRANSLATOR__)
137137

138138
size_t3 __builtin_spirv_BuiltInNumWorkgroups()
139139
{
@@ -183,7 +183,7 @@ size_t3 __builtin_spirv_BuiltInGlobalOffset()
183183
return BuiltinVector(__builtin_IB_get_global_offset);
184184
}
185185

186-
#else // not defined(OLD_SPIRV_BUILTINS)
186+
#else // defined(__USE_KHRONOS_SPIRV_TRANSLATOR__)
187187

188188
size_t OVERLOADABLE __spirv_BuiltInNumWorkgroups(int dimindx)
189189
{
@@ -235,7 +235,7 @@ size_t OVERLOADABLE __spirv_BuiltInGlobalOffset(int dimindx)
235235
return __builtin_IB_get_global_offset(dimindx);
236236
}
237237

238-
#endif // defined(OLD_SPIRV_BUILTINS)
238+
#endif
239239

240240
size_t SPIRV_OVERLOADABLE SPIRV_BUILTIN_NO_OP(BuiltInGlobalLinearId, , )()
241241
{

0 commit comments

Comments
 (0)