Skip to content

Commit 6e4b531

Browse files
authored
[SYCLomatic] Fix the issue that type not processed correctly during the migration of BlockReduce.Reduce (#2745)
Signed-off-by: intwanghao <hao3.wang@intel.com>
1 parent b4b7c5a commit 6e4b531

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

clang/lib/DPCT/RulesLangLib/CUBAPIMigration.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1450,7 +1450,7 @@ void CubRule::processBlockLevelMemberCall(const CXXMemberCallExpr *BlockMC) {
14501450
<< ValidItemsEA.getReplacedString() << ") ? "
14511451
<< InEA.getReplacedString() << " : " << MapNames::getClNamespace()
14521452
<< "known_identity_v<" << StringRef(OpRepl).drop_back(2) << ", "
1453-
<< DpctGlobalInfo::getTypeName(InData->getType()) << ">";
1453+
<< DpctGlobalInfo::getReplacedTypeName(InData->getType()) << ">";
14541454
In = std::move(tmp);
14551455
} else
14561456
In = InEA.getReplacedString();

clang/test/dpct/cub/blocklevel/blockreduce_p4.cu

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,11 @@ __global__ void foo() {
1515
// CHECK: v = sycl::reduce_over_group(item_ct1.get_group(), (item_ct1.get_group().get_local_linear_id() < item_ct1.get_local_range(2)) ? v : sycl::known_identity_v<sycl::plus<>, float>, sycl::plus<>());
1616
v = BlockReduce(m).Reduce(v, cub::Sum{}, blockDim.x);
1717
}
18+
19+
__global__ void foo2() {
20+
__half v = 0.0f;
21+
typedef cub::BlockReduce<__half, 1024> BlockReduce;
22+
__shared__ typename BlockReduce::TempStorage m;
23+
// CHECK: v = sycl::reduce_over_group(item_ct1.get_group(), (item_ct1.get_group().get_local_linear_id() < item_ct1.get_local_range(2)) ? v : sycl::known_identity_v<sycl::plus<>, sycl::half>, sycl::plus<>());
24+
v = BlockReduce(m).Reduce(v, cub::Sum{}, blockDim.x);
25+
}

0 commit comments

Comments
 (0)