Skip to content

Commit 546bc39

Browse files
author
Yihan Wang
authored
[SYCLomatic] Add asm test case in test_feature.py (#359)
Signed-off-by: Wang, Yihan <[email protected]>
1 parent ad056e0 commit 546bc39

File tree

3 files changed

+20
-19
lines changed

3 files changed

+20
-19
lines changed

features/config/TEMPLATE_asm.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,7 @@
55
<files>
66
<file path="feature_case/asm/${testName}.cu" />
77
</files>
8+
<rules>
9+
<optlevelRule GPUFeature="NOT double" excludeOptlevelNameString="gpu" />
10+
</rules>
811
</test>

features/feature_case/asm/asm.cu

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88
// ===--------------------------------------------------------------------===//
99
//
1010
// This file defines the test cases to check inline device asm parser.
11-
//
11+
//
1212
// (1) Floating point/integer constant.
1313
// (2) Binary/Unary/Conditional operators and paren expressions.
1414
// (3) Compound statements.
1515
// (4) Conditional instructions.
1616
// (5) Instructions(mov, setp, and lop3).
1717
//
18-
// Usually, we check the result of inline asm statement to ensure that the migrated
19-
// programe has the same behavior with the inline asmstatement.
18+
// Usually, we check the result of inline asm statement to ensure that the
19+
// migrated programe has the same behavior with the inline asmstatement.
2020
//
2121
//===----------------------------------------------------------------------===//
2222

@@ -1386,36 +1386,34 @@ __global__ void lop3(int *ec) {
13861386

13871387
int main() {
13881388
int ret = 0;
1389-
int *ec = nullptr;
1390-
cudaMalloc(&ec, sizeof(int));
1391-
1389+
int *d_ec = nullptr;
1390+
cudaMalloc(&d_ec, sizeof(int));
13921391

13931392
auto wait_and_check = [&](const char *case_name) {
13941393
cudaDeviceSynchronize();
1395-
int res = 0;
1396-
cudaMemcpy(&res, ec, sizeof(int), cudaMemcpyDeviceToHost);
1397-
if (res != 0)
1398-
printf("Test %s failed: return code = %d\n", case_name, res);
1394+
int ec = 0;
1395+
cudaMemcpy(&ec, d_ec, sizeof(int), cudaMemcpyDeviceToHost);
1396+
if (ec != 0)
1397+
printf("Test %s failed: return code = %d\n", case_name, ec);
13991398
ret = ret || ec;
14001399
};
14011400

1402-
1403-
floating_point<<<1, 1>>>(ec);
1401+
floating_point<<<1, 1>>>(d_ec);
14041402
wait_and_check("floating point");
14051403

1406-
integer_literal<<<1, 1>>>(ec);
1404+
integer_literal<<<1, 1>>>(d_ec);
14071405
wait_and_check("integer literal");
14081406

1409-
expression<<<1, 1>>>(ec);
1407+
expression<<<1, 1>>>(d_ec);
14101408
wait_and_check("expression");
1411-
1412-
declaration<<<1, 1>>>(ec);
1409+
1410+
declaration<<<1, 1>>>(d_ec);
14131411
wait_and_check("declaration");
14141412

1415-
setp<<<1, 1>>>(ec);
1413+
setp<<<1, 1>>>(d_ec);
14161414
wait_and_check("setp");
14171415

1418-
lop3<<<1, 1>>>(ec);
1416+
lop3<<<1, 1>>>(d_ec);
14191417
wait_and_check("lop3");
14201418

14211419
return ret;

features/test_feature.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
from test_utils import *
1919

20-
exec_tests = ['thrust-vector-2', 'thrust-binary-search', 'thrust-count', 'thrust-copy',
20+
exec_tests = ['asm', 'thrust-vector-2', 'thrust-binary-search', 'thrust-count', 'thrust-copy',
2121
'thrust-qmc', 'thrust-transform-if', 'thrust-policy', 'thrust-list', 'module-kernel',
2222
'kernel-launch', 'thrust-gather', 'thrust-gather_if',
2323
'thrust-scatter', 'thrust-unique_by_key_copy', 'thrust-for-hypre', 'thrust-merge_by_key',

0 commit comments

Comments
 (0)