Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

Commit a53d726

Browse files
authored
[SYCL] Localize variables declared in inline asms. (#105)
Signed-off-by: rdeodhar <[email protected]>
1 parent 6cf85c6 commit a53d726

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

SYCL/InlineAsm/asm_if.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,11 @@ template <typename T = DataType> struct KernelFunctor : WithOutputBuffer<T> {
2121
](cl::sycl::id<1> wiID) [[intel::reqd_sub_group_size(8)]] {
2222
int Output = 0;
2323
#if defined(__SYCL_DEVICE_ONLY__)
24-
asm volatile(".decl P1 v_type=P num_elts=1\n"
24+
asm volatile("{\n"
25+
".decl P1 v_type=P num_elts=1\n"
2526
"cmp.eq (M1_NM, 8) P1 %1(0,0)<0;1,0> 0x0:b\n"
2627
"(P1) sel (M1_NM, 8) %0(0,0)<1> 0x7:d 0x8:d"
28+
"}\n"
2729
: "=rw"(Output)
2830
: "rw"(switchField));
2931

SYCL/InlineAsm/asm_loop.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ struct KernelFunctor : WithInputBuffers<T, 2>, WithOutputBuffer<T> {
2929
cl::sycl::range<1>{this->getOutputBufferSize()}, [=
3030
](cl::sycl::id<1> wiID) [[intel::reqd_sub_group_size(8)]] {
3131
#if defined(__SYCL_DEVICE_ONLY__)
32-
asm volatile(".decl P1 v_type=P num_elts=8\n"
32+
asm volatile("{\n"
33+
".decl P1 v_type=P num_elts=8\n"
3334
".decl P2 v_type=P num_elts=8\n"
3435
".decl temp v_type=G type=d num_elts=8 align=dword\n"
3536
"mov (M1, 8) %0(0, 0)<1> 0x0:d\n"
@@ -42,6 +43,7 @@ struct KernelFunctor : WithInputBuffers<T, 2>, WithOutputBuffer<T> {
4243
"cmp.lt (M1, 8) P2 temp(0,0)<0;8,1> %1(0,0)<0;8,1>\n"
4344
"(P2) goto (M1, 8) label1\n"
4445
"label0:"
46+
"}\n"
4547
: "+rw"(C[wiID])
4648
: "rw"(A[wiID]), "rw"(B[wiID]));
4749
#else

SYCL/InlineAsm/asm_switch.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ template <typename T = DataType> struct KernelFunctor : WithOutputBuffer<T> {
2121
](cl::sycl::id<1> wiID) [[intel::reqd_sub_group_size(8)]] {
2222
int Output = 0;
2323
#if defined(__SYCL_DEVICE_ONLY__)
24-
asm volatile(".decl P1 v_type=P num_elts=1\n"
24+
asm volatile("{\n"
25+
".decl P1 v_type=P num_elts=1\n"
2526
".decl P2 v_type=P num_elts=1\n"
2627
".decl P3 v_type=P num_elts=1\n"
2728
"cmp.ne (M1_NM, 8) P1 %1(0,0)<0;1,0> 0x0:d\n"
@@ -37,6 +38,7 @@ template <typename T = DataType> struct KernelFunctor : WithOutputBuffer<T> {
3738
"(P3) goto (M1, 1) label2\n"
3839
"mov (M1, 8) %0(0,0)<1> 0x7:d\n"
3940
"label2:"
41+
"}\n"
4042
: "=rw"(Output)
4143
: "rw"(switchField));
4244

0 commit comments

Comments
 (0)