Skip to content

Commit e334ad8

Browse files
author
Sergey Kanaev
committed
[SYCL] Add assume in size_t conversion operator
Signed-off-by: Sergey Kanaev <[email protected]>
1 parent cbc5e69 commit e334ad8

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

sycl/include/CL/sycl/id.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,9 @@ template <int dimensions = 1> class id : public detail::array<dimensions> {
9797
* int a = id<1>(value); */
9898

9999
operator EnableIfT<(dimensions == 1), size_t>() const {
100-
return this->common_array[0];
100+
size_t Result = this->common_array[0];
101+
__SYCL_ASSUME_INT(Result);
102+
return Result;
101103
}
102104
#endif // __SYCL_DISABLE_ID_TO_INT_CONV__
103105

sycl/test/basic_tests/id_queries_fit_int.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ int main() {
3939
// CHECK: call void @llvm.assume(i1 {{.*}})
4040
int LocalRange = TestNDItem.get_local_range(0);
4141

42+
int GlobalIdConverted = TestNDItem.get_global_id();
43+
// CHECK: call void @llvm.assume(i1 {{.*}})
44+
int LocalIdConverted = TestNDItem.get_local_id();
45+
// CHECK: call void @llvm.assume(i1 {{.*}})
46+
int OffsetConferted = TestNDItem.get_offset();
47+
// CHECK: call void @llvm.assume(i1 {{.*}})
48+
4249
return 0;
4350
}
4451
// CHECK: }

0 commit comments

Comments
 (0)