|
8 | 8 | // ===--------------------------------------------------------------------===//
|
9 | 9 | //
|
10 | 10 | // This file defines the test cases to check inline device asm parser.
|
11 |
| -// |
| 11 | +// |
12 | 12 | // (1) Floating point/integer constant.
|
13 | 13 | // (2) Binary/Unary/Conditional operators and paren expressions.
|
14 | 14 | // (3) Compound statements.
|
15 | 15 | // (4) Conditional instructions.
|
16 | 16 | // (5) Instructions(mov, setp, and lop3).
|
17 | 17 | //
|
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. |
20 | 20 | //
|
21 | 21 | //===----------------------------------------------------------------------===//
|
22 | 22 |
|
@@ -1386,36 +1386,34 @@ __global__ void lop3(int *ec) {
|
1386 | 1386 |
|
1387 | 1387 | int main() {
|
1388 | 1388 | int ret = 0;
|
1389 |
| - int *ec = nullptr; |
1390 |
| - cudaMalloc(&ec, sizeof(int)); |
1391 |
| - |
| 1389 | + int *d_ec = nullptr; |
| 1390 | + cudaMalloc(&d_ec, sizeof(int)); |
1392 | 1391 |
|
1393 | 1392 | auto wait_and_check = [&](const char *case_name) {
|
1394 | 1393 | 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); |
1399 | 1398 | ret = ret || ec;
|
1400 | 1399 | };
|
1401 | 1400 |
|
1402 |
| - |
1403 |
| - floating_point<<<1, 1>>>(ec); |
| 1401 | + floating_point<<<1, 1>>>(d_ec); |
1404 | 1402 | wait_and_check("floating point");
|
1405 | 1403 |
|
1406 |
| - integer_literal<<<1, 1>>>(ec); |
| 1404 | + integer_literal<<<1, 1>>>(d_ec); |
1407 | 1405 | wait_and_check("integer literal");
|
1408 | 1406 |
|
1409 |
| - expression<<<1, 1>>>(ec); |
| 1407 | + expression<<<1, 1>>>(d_ec); |
1410 | 1408 | wait_and_check("expression");
|
1411 |
| - |
1412 |
| - declaration<<<1, 1>>>(ec); |
| 1409 | + |
| 1410 | + declaration<<<1, 1>>>(d_ec); |
1413 | 1411 | wait_and_check("declaration");
|
1414 | 1412 |
|
1415 |
| - setp<<<1, 1>>>(ec); |
| 1413 | + setp<<<1, 1>>>(d_ec); |
1416 | 1414 | wait_and_check("setp");
|
1417 | 1415 |
|
1418 |
| - lop3<<<1, 1>>>(ec); |
| 1416 | + lop3<<<1, 1>>>(d_ec); |
1419 | 1417 | wait_and_check("lop3");
|
1420 | 1418 |
|
1421 | 1419 | return ret;
|
|
0 commit comments