cutlass/tools
Andrei Alexandrescu d7b499deff
Fix CUDA_PERROR_EXIT and print failing expression (#446)
`CUDA_PERROR_EXIT ` can lead to incorrect usage (see e.g. [this description](https://www.cs.technion.ac.il/users/yechiel/c++-faq/macros-with-if.html)) because it contains an incomplete `if` expression. Consider:

```
if (condition)
    CUDA_PERROR_EXIT(cudaFree(x))
else
    free(x);
```

The author of the code forgot to add a semicolon after the macro. In that case, the `else` will bind to the `if` inside the macro definition, leading to code that the author did not intend or expect. It the author does use a semicolon, the code will not compile, which is awkward.

The change adds a `do while` around the `if`, which always requires a semicolon.

This PR also adds the text of the failing expression to the printed error message.
2022-04-24 16:29:43 -04:00
..
library CUTLASS 2.9 (#468) 2022-04-23 15:02:38 -04:00
profiler CUTLASS 2.9 (#468) 2022-04-23 15:02:38 -04:00
util Fix CUDA_PERROR_EXIT and print failing expression (#446) 2022-04-24 16:29:43 -04:00
CMakeLists.txt CUTLASS 2.9 (#468) 2022-04-23 15:02:38 -04:00