Skip to content

Commit 5210817

Browse files
aratajewigcbot
authored andcommitted
Fix pointer casting for i64 AtomicSMin builtin
When IGC is built with Khronos SPIRV-LLVM Translator, then builtins mangling is not explicit, so it must be deduced based on arguments types. In this case, pointer was casted to `int` instead of `long` which was resulting in calling incorrect builtin function
1 parent 7de82ab commit 5210817

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

IGC/BiFModule/Implementation/atomics.cl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1315,11 +1315,11 @@ long SPIRV_OVERLOADABLE SPIRV_BUILTIN(AtomicSMin, _p4i64_i32_i32_i64, )( __gener
13151315
__builtin_assume((__local long*)Pointer != 0);
13161316
if(SPIRV_BUILTIN(GenericCastToPtrExplicit, _p3i8_p4i8_i32, _ToLocal)(__builtin_astype((Pointer), __generic char*), StorageWorkgroup))
13171317
{
1318-
return SPIRV_BUILTIN(AtomicSMin, _p3i64_i32_i32_i64, )((__local int*)Pointer, Scope, Semantics, Value );
1318+
return SPIRV_BUILTIN(AtomicSMin, _p3i64_i32_i32_i64, )((__local long*)Pointer, Scope, Semantics, Value );
13191319
}
13201320
else
13211321
{
1322-
return SPIRV_BUILTIN(AtomicSMin, _p1i64_i32_i32_i64, )((__global int*)Pointer, Scope, Semantics, Value );
1322+
return SPIRV_BUILTIN(AtomicSMin, _p1i64_i32_i32_i64, )((__global long*)Pointer, Scope, Semantics, Value );
13231323
}
13241324
}
13251325

0 commit comments

Comments
 (0)