Skip to content

Commit caf4c11

Browse files
authored
[SYCLomatic] Fix an issue in migration of __ldcs (#2736)
Signed-off-by: Ziran Zhang <ziran.zhang@intel.com>
1 parent f5621e2 commit caf4c11

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

clang/lib/DPCT/RulesLang/Math/RewriterHalfPrecisionConversionAndDataMovement.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -816,7 +816,7 @@ RewriterMap dpct::createHalfPrecisionConversionAndDataMovementRewriterMap() {
816816
EMPTY_FACTORY_ENTRY("__ldcs"),
817817
EMPTY_FACTORY_ENTRY("__ldcs"),
818818
WARNING_FACTORY_ENTRY(
819-
"__ldcs", DEREF_FACTORY_ENTRY("__ldcs", ARG_WC(0)),
819+
"__ldcs", DEREF_FACTORY_ENTRY("__ldcs", DEREF(0)),
820820
Diagnostics::MATH_EMULATION_EXPRESSION,
821821
std::string("__ldcs"), std::string("'*'"))))
822822
// __ldcv

clang/test/dpct/cpp_lang_extensions.cu

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,20 @@
44

55
#include "cpp_lang_extensions.cuh"
66

7+
template<class ElementType>
8+
struct alignas(16) Packed128 {
9+
static constexpr const size_t size = sizeof(int4) / sizeof(ElementType);
10+
ElementType payload[size];
11+
};
12+
13+
14+
// load a Packed128 from an aligned memory address with streaming cache hint
15+
template<class ElementType>
16+
__device__ Packed128<ElementType> load128cs(const ElementType* address) {
17+
// CHECK: return Packed128<ElementType>{*(reinterpret_cast<const sycl::int4*>(address))};
18+
return Packed128<ElementType>{__ldcs(reinterpret_cast<const int4*>(address))};
19+
}
20+
721
__device__ float df(float f) {
822
float a[23];
923
// CHECK: /*

0 commit comments

Comments
 (0)